Skip to content

fix: restore the entry fixture's captain tool count after the amendment tool - #180

Merged
NanmiCoder merged 2 commits into
mainfrom
fix-progressive-entry
Sep 16, 2026
Merged

NanmiCoder merged 2 commits into
mainfrom
fix-progressive-entry

Conversation

@NanmiCoder

@NanmiCoder NanmiCoder commented Sep 16, 2026

Copy link
Copy Markdown
Owner

问题

main 从合并 #155fa5803d)起 CI 就是红的:4 个 Real Harness job 全部只挂同一个 scenario,报同一条错。

AssertionError: 14 !== 13
    at fixtures/harness-runtime-entry.mjs:43

progressive-entry 断言队长固定暴露的团队工具数量。agent_teams_amend_task(e651d50,随 #155 进来)把 TEAM_TOOL_NAMES 从 13 个变成 14 个,但 fixture 里 4 处硬编码的 13 没跟着改。

这不是工具本身的问题

agent_teams_amend_task 的接线是对的,无需改源码:

  • 队长专属 —— CAPTAIN_TOOL_NAMESsrc/tool-names.ts:14 派生;
  • 成员不可见 —— src/capabilities.ts:91harness-compat.tsmemberToolFilter 两条路径都挡住;
  • 注册名与工具集声明逐字一致(src/tools.ts:1784);
  • 队长的首次请求就可见 —— 这正是固定暴露契约要求的(该契约禁止会话中途变更,不禁止版本间变更)。

所以只有 fixture 那份「数量的镜像」过期了。

顺带修掉的文档

#155 只更新了模型可见的 prompt(src/index.ts:146),README 和 docs 里仍写着「13 个工具」,且 docs/usage.md 的工具表缺 agent_teams_amend_task 这一行。

历史快照(docs/releases/**docs/*verification.jsonrelease-notes/**)保持不动 —— 那些是版本化的存档,protocol-compatibility 用的 13 项白名单也是有意为之的 legacy 允许列表。

第二个 commit:修掉 gate 上的一条 flake

计数修好之后,Real Harness (0.1.5-rc.1) 仍然间歇性失败(3 次 run 挂 2 次),但所有实质断言都过:

SessionHandleClosedError: session "<id>": flush on a closed handle
  at JsonlSessionHandle.assertOpen (dsh-session-persistence-jsonl)
  at fixtures/harness-runtime-web-approval.mjs:181

CI 驱动的 4 个 runtime fixture 共用同一个收尾 idiom:遍历 ctx.agents.list(),等每个 agent idle,再 flush 仍注册着的 session。存活检查与 flush 之间隔着一个 await,别的 agent 的 handle 可能正好在这个窗口里关掉。关闭本身已经完成持久化,这次 flush 无事可做,但宿主会拒绝这个调用并让整个 scenario 非零退出。

给每个 flush 点只针对这个错误加保护;其他失败照旧抛出。entry / idle / resume 用的是同一个 idiom,同样可命中,一并修掉。harness-model-driver.mjs 有同样的写法,但只跑在真实模型 benchmark lab、不在 CI gate 里,未改动。

验证

用 CI 同一个 harness 在本地跑了全部 4 个宿主0.1.5-rc.1 / 0.1.2-rc.1 / 0.1.2-alpha.5 / 0.1.2-alpha.2),每个都是 10/10,含此前失败的 progressive-entry

pnpm verify 通过(exit 0)。

…nt tool

`progressive-entry` asserts the captain's fixed team-tool exposure, and that set
grew from 13 to 14 when `agent_teams_amend_task` landed (e651d50, via #155). The
fixture kept the old count, so every Real Harness job went red on main
immediately after that merge:

  AssertionError: 14 !== 13
    at scripts/fixtures/harness-runtime-entry.mjs:43

The tool itself is wired correctly: captain-only (src/tool-names.ts derives
CAPTAIN_TOOL_NAMES), hidden from members through both capabilities.ts and
memberToolFilter, registered under the exact name the set declares, and visible
from the captain's first request, which is what the fixed-exposure contract
requires. Only the fixture's mirror of the count was stale.

Also update the prose that still stated the old count, and add the missing
`agent_teams_amend_task` row to the usage tool table.

Verified locally with the same harness CI runs, on all four supported hosts
(0.1.5-rc.1, 0.1.2-rc.1, 0.1.2-alpha.5, 0.1.2-alpha.2): all ten scenarios pass,
including the previously failing progressive-entry.
…n flush

`web-approval` on 0.1.5-rc.1 fails intermittently (2 of the last 3 CI runs) even
though every substantive assertion passes:

  SessionHandleClosedError: session "<id>": flush on a closed handle
    at JsonlSessionHandle.assertOpen (dsh-session-persistence-jsonl)
    at fixtures/harness-runtime-web-approval.mjs:181

The four runtime fixtures that the CI gate drives share one teardown idiom: walk
`ctx.agents.list()`, await each agent's idle, then flush the sessions still
registered. The liveness check and the flush are separated by an await, so
another agent's handle can close in that window. Closing persists the session,
so the flush has nothing left to do — but the host refuses the call and the
whole scenario exits non-zero.

Guard each flush site against exactly that error; any other failure still
propagates. The same race is reachable in entry, idle and resume, which use the
identical idiom.

fixtures/harness-model-driver.mjs carries the same idiom but runs only in the
real-model benchmark lab, not in the CI gate, so it is left alone.
@NanmiCoder
NanmiCoder merged commit a97f072 into main Sep 16, 2026
7 checks passed
@NanmiCoder
NanmiCoder deleted the fix-progressive-entry branch September 16, 2026 16:11
Tonited added a commit to Tonited/dsh-agent-teams that referenced this pull request Sep 17, 2026
Brings in v0.1.18 plus NanmiCoder#155, NanmiCoder#167, NanmiCoder#180 and NanmiCoder#172.

Conflict resolution:
- package.json: both sides appended to the `verify` chain, so both steps are
  kept — `dispatch-visibility-tdd.mjs` (this branch) and
  `verify:member-spawn-recovery` (NanmiCoder#172).
- src/tools.ts `dispatchMember`: NanmiCoder#172 and this branch record a rejected spawn
  on two different surfaces, and both are kept — the member carries
  `spawnError` (with the failing stack, rendered as `start failed:` under the
  member) and the team carries `lastDispatchError` (rendered above the roster
  as `Last dispatch rejection:`). The successful-spawn path now clears both
  (`delete member.spawnError` + `clearDispatchFailure`). Guard rejections
  (`halted`, `staged`, member stopping, stale attempt, …) remain unique to
  this branch: NanmiCoder#172 only covers the thrown-spawn path.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant