Skip to content

Coordinator settle tool, agent turn rule, continuation result delivery - #44

Merged
nickrroberts merged 1 commit into
mainfrom
feat/agent-settle-and-turn-rules
Sep 29, 2026
Merged

nickrroberts merged 1 commit into
mainfrom
feat/agent-settle-and-turn-rules

Conversation

@nickrroberts

Copy link
Copy Markdown
Collaborator

Summary

  • cp_agent_settle (coordinator only, agent, optional archive): settles an idle agent with the same thread.settle command the UI sends. Busy agent, standing agent, or non-coordinator caller gets a clear error.
  • Coordinator prompt: settle agents once their work is complete and merged, or when one-off and reported.
  • Agent prompt: never end a turn just to wait for a command, test run, or sub-agent. Standing agents keep the cp_agent_create exception, since their agents report as messages.
  • Agent browser rule: load the preview_* tools and call preview_status/preview_open before concluding the built-in browser is unavailable.
  • Lost final report fix (AgentCompletionReactor): a request whose own turn ended with no reply and was answered by a later turn no message started (SDK resume or wake-up) now delivers that reply once, as cp-push:<agent>:cp-turn:<turnId>. Before, the coordinator got "finished (no final message)" and the real report was never pushed, because that turn has no request row (pending_message_id NULL).
  • Work log shows "Settled " for the new tool.

Test plan

  • handlers tests: settle idle success, archive, busy, engine-blocked, not-yours, coordinator-only, standing
  • assistantRuntime.test.ts: settle rule, turn rule (and standing exception), preview rule
  • reactor tests: empty request then continuation reply delivered once; no double delivery when the reply is already in the request result; no push for a later wake-up after a request that reported
  • Full server suite: 51 failed in 10 files, identical to main (ThreadSettlementReactor 37 confirmed failing on clean main); typecheck clean for server and client-runtime; lint warnings only

🤖 Generated with Claude Code

- cp_agent_settle (coordinator only): settles an idle agent the caller
  manages with the same thread.settle command the UI sends; optional archive.
  Busy agents, standing agents and other callers get clear errors.
- Coordinator prompt: settle agents once their work is complete and merged,
  or when they are one-off and have reported.
- Agent prompt: never end a turn just to wait for a command, test run or
  sub-agent. Standing agents keep ending their turn after cp_agent_create.
- Agent browser rule: load the preview_* tools and call preview_status or
  preview_open before concluding the built-in browser is unavailable.
- AgentCompletionReactor: a request whose own turn ended with no reply and
  was answered by a later turn no message started (a resume or wake-up) now
  delivers that reply once, as cp-push:<agent>:cp-turn:<turnId>. Before, the
  coordinator got "finished (no final message)" and the real report was
  never pushed.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@nickrroberts
nickrroberts merged commit b1c1c67 into main Sep 29, 2026
3 of 12 checks passed
@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:L labels Sep 29, 2026
@nickrroberts
nickrroberts deleted the feat/agent-settle-and-turn-rules branch September 29, 2026 20:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant