chat: 已停用 skill 经 agent pin / 线程挂载仍会进入 run 并执行——三条 skill 来源缺一道统一的「当前可执行」门
- Dominant language
- TypeScript
- Stars
- 0
- Forks
- 0
- Avg merge
- 1h 7m
- Merged PRs (30d)
- 969
Description
来源:PR #2519 独立复核第 2 点(人类 2026-09-03 要求单独跟踪)。**本 PR 之前就存在的行为**,不是 #2514 引入的;#2514 新增的默认加载源是三条源里唯一过 `skills.status='enabled'` 的。
## 现象(读代码)
run 的 skill 列表 = `(agent 钉的 ?? 组织全部已启用) ∪ 线程挂载`(`message-roundtrip.ts` `resolveRunSkillVersionIds`)。三条源对「这个 skill 此刻还能不能用」的判断不一致:
| 来源 | 读口 | 过滤条件 | 已停用 skill 会怎样 |
|---|---|---|---|
| 默认加载 | `PgEnabledSkillVersionReader` | `sk.status='enabled'` ∧ 有 `published` 版本 | 不进 |
| agent pin | `agent_versions.skill_version_ids` → `readPinnedSkills`(`pg-agent-run-repository.ts`) | 只看 `v.published`,**不看 `sk.status`** | 照样进、照样执行 |
| 线程挂载 | `PgThreadMountedSkillReader` | `removed_at IS NULL` + 模型 A 可达,**不看 `sk.status`** | 照样进、照样执行 |
即:管理员在后台把某个 skill 停用后,凡是钉了它的 agent、以及此前挂过它的线程,下一次 run 仍会把它的 `SKILL.md` 拼进 system prompt 并可触发沙箱执行。`disable-skill.ts` 只改了目录里的 `status`,没有任何执行路径读它。
## 要决定的事(进契约束,需签核)
1. **快照 vs 撤销语义**:run 快照是不可变的(D-30)。停用是「从下一次 run 起不再加载」(在 `acceptHumanMessage` 快照时过滤),还是「已排队未执行的 run 也要拒绝」(在 `execute-run.ts` 读正文时再判一次)?建议前者 + 后者 fail-closed(同 `SKILL_VERSION_UNAVAILABLE` 的形状:钉了 N 个读回 M
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with resolveRunSkillVersionIds in message-roundtrip.ts, then trace readPinnedSkills in pg-agent-run-repository.ts and PgThreadMountedSkillReader to compare the three skill sources. Read execute-run.ts, disable-skill.ts, and set-agent-skill-pins.ts before resolving the snapshot and failure semantics. Done means the agreed design-delta is recorded and real-database checks confirm disabled skills do not enter the prompt, while re-enabled skills load again.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- authorization, backend
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Needs clarification
- Newbie friendliness
- 28/100