Repository navigation
sminos: MW4 one agent stopped or told — stop-agent and tell (1.14.0) - #399
Conversation
The desk can stop one subagent or send it a message. The bridge resolves the agent by id, then by the name of exactly one running agent, against $.agent.list(); stop-agent runs TaskStop and leaves the parent a note that its next request carries (an Agent call's result waits for it), tell sends through the engine's own delivery under a line saying the person wrote it. The daemon checks the child's subagent tree before the claim (unknown-agent), carries the nonce to the bridge and reconciles an interrupted claim from the child's kept answer. Controls stop-agent and tell turn available. Sminos-Session: desk-sminos-orchestrator#b4948247 (doperpowers on macbook)
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2681b50172
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| async function recordAgentStop($: EngineInterface, ref: string, from: unknown) { | ||
| const text = agentStopNote(ref, from) | ||
| try { | ||
| const stored = await $.session.append({ message: { type: 'user', content: [{ type: 'text', text }] } }) |
There was a problem hiding this comment.
Deliver the stop note to the stopped agent's actual parent
When the desk stops a nested subagent, this append writes the note into the main session rather than the coordinator that spawned it. The bridge already supports nested agents (ListedAgent.parentId, propagated as parentAgentId in bridge-agents.tsx), but stopAgent discards that parent information and recordAgentStop always records a main-loop row (agentId: null). Consequently, the nested coordinator receives the interruption without the instruction not to restart the agent or redo its task—the exact behavior this note is intended to prevent. Preserve the resolved parent and deliver the note to that loop before releasing its Agent call.
Useful? React with 👍 / 👎.
| const r = await $.tool.call({ tool: 'TaskStop', task_id: id }) | ||
| if (r.isError === true) { | ||
| return { ok: false, error: engineError(r.text) } |
There was a problem hiding this comment.
Handle TaskStop denials before reporting the agent stopped
When a permission rule or a tool.call hook refuses TaskStop with a { deny } result, this check treats the refusal as success because isError is absent. That result shape is already handled explicitly for plugin-origin tool calls in hooks/mods/appeal.tsx, and devcloud/hooks/mods/secrets.tsx can also return it. Here, the agent can remain running while the desk receives accepted: true and the parent receives a false instruction that it is no longer running. Check r.deny alongside r.isError and return the refusal without appending the stop note.
Useful? React with 👍 / 👎.
…n the parent's next request - The daemon resolves the spelling against the child's tree (an id first, then exactly one running name; a shared name is ambiguous-agent before the claim) and passes the id as resolvedAgentId; the bridge acts on that agent alone and refuses it once it no longer runs, so an agent that took its name since is never stopped or told in its place. - A hook's refusal of TaskStop is no stop: refused, no note. - A background agent's task notification waits for the stop's note (the session.append hook, at most INTERRUPT_HOLD_MS), as a foreground agent's Agent call result already did. - The note goes to the stopped agent's parent loop (its parentId), main for main's own agents. - A note the session did not keep is in the answer as noteError. Sminos-Session: desk-sminos-orchestrator#b4948247 (doperpowers on macbook)
…list, not a shape The daemon always sends resolvedAgentId, and a teammate's id is its <name>@<team> address, which the task-id pattern refused: a running teammate could be neither stopped nor told. The bridge now takes any resolved id an agent ref may be (1 to 128 characters, not blank, no control character) and checks it by exact membership in $.agent.list(). Sminos-Session: desk-sminos-orchestrator#b4948247 (doperpowers on macbook)
MW4 of the desk control surface (MAWS spec
docs/doperpowers/specs/2026-10-22-desk-control-surface-design.md, Plan of Work, the machine-side wave): one subagent stopped or told from the desk. Sminos 1.14.0.What it builds
sminos/hooks/mods/bridge-agent-ops.tsx, new; routed frombridge.tsx): DX5 opsstop-agentandtell. The agent is named by its id or its Agent call'sname, resolved against$.agent.list(): an id first, then the name of exactly one running agent; none →unknown-agent, two →ambiguous-agentnaming their ids.stop-agentrunsTaskStopon the resolved id and appends the parent's note (Agent X was stopped by the person from the desk: it is not running. Do not start it again or redo its task unless the person asks.), answering{agentId, accepted: true, resolvedAgentId?}. AnAgentcall's result waits for a pending stop note (at mostINTERRUPT_HOLD_MS, as an interrupted turn's Bash call does), so a foreground parent reads the note with the interruption.tellsends through$.session.sendto the resolved id under the first line From the person at the desk, not from your coordinator:, since the engine's envelope credits a plugin's send to the coordinator.controls['stop-agent']andcontrols.tellturn available;opslists both.sminos_rpc.py): RPCsstop-agentandtell— shape (agentId1–128 characters, not blank, no control character;tell'stextnon-blank), check 9 against the bridge child's subagent tree (GET /agents) before the claim (unknown-agent), execution through the bridge carrying the nonce. Both answer when the engine has, so the RPC result is the outcome and noopevents follow; a claim the daemon stopped mid-flight is reconciled from the answer the child kept under the nonce (KEPT_READERSintrace()), as a steer's is.Validation Evidence
sminos/tests/run-sminos-tests.sh:all 2416 assertions passed, exit 0.claude plugin test sminos: 551/551 pass (newstop-agent×10,tell×5 inbridge.test.ts; controls list inreads.test.ts).tests/mods/typecheck.sh: exit 0.python3 -m unittest sminos/tests/test_rpcs.py -k test_n_: 8 OK (RED before: 7 failures, 1 error, no RPC "stop-agent"/"tell" on this machine), including the reconcile-from-kept-answer case.ci-gatefrom the worktree: GREEN — shell-lint, repo-checks, sminos-mods, mods-types, sminos, board-api, issue-tracker, sminos-suites all PASS on 2681b50 (https://github.com/SSFSKIM/doperpowers/actions/runs/40314636501)HOME/CLAUDE_CONFIG_DIR/SMINOS_HOMEunder/private/tmp,env -i, a recording stub on 127.0.0.1, a dummy key, zero inference), driving the bridge's child directly:bg-sleeper:tellby name →{ok:true, result:{sent:true}}; the agent's next request (~2 s) carried The coordinator sent a message while you were working:\nFrom the person at the desk, not from your coordinator:\nMW4-TELL ….stop-agentby name →{agentId:'bg-sleeper', accepted:true, resolvedAgentId:<id>}in ~19 ms; the parent's next request, 0.05 s later, carried the note then the engine's<task-notification>(killed). Stop by id → noresolvedAgentId. A second stop,nobody, and the spellingbg sleeper→unknown-agent. The daemon'srunning_agentagainst the live child: id True,bg-sleeperTrue, spaced / unknown / description False.CLAUDE_CODE_FORK_SUBAGENT=0):tellreached it in ~1 s; stop by name ok; the parent's next request (0.06 s) held[Request interrupted by user for tool use]and the note in one user message.name(^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$); the unit tests cover it end to end.The MAWS half (protocol types, fake-machine
mw4producer, spec Decision Log): SSFSKIM/MAWS#168Review fix wave (d4d8e04)
ambiguous-agentbefore the claim) and passes it asresolvedAgentId. The bridge acts on that agent alone, so an agent that took the name since is never stopped or told in its place.{deny}), the stop is refused and no note is written.<task-notification>row is held in thesession.appendhook until the stop's note is kept (at mostINTERRUPT_HOLD_MS), so the parent's next request carries the note.parentId). If it is not kept, the answer says so innoteError.Validation:
claude plugin test sminos: 557 pass, 0 fail. RED before the fix: 6 new tests failing.python3 -m unittest test_rpcs -k test_n_: 10 OK. RED before: 3 failures, 2 errors.tests/mods/typecheck.sh: exit 0.ci-gateon d4d8e04: GREEN, all 8 gates PASS (https://github.com/SSFSKIM/doperpowers/actions/runs/40320039414).resolvedAgentId: the interrupted result and the note arrived in one user message.Sminos-Session: desk-sminos-orchestrator#b4948247 (doperpowers on macbook)