Skip to content

sminos: MW4 one agent stopped or told — stop-agent and tell (1.14.0) - #399

Merged
SSFSKIM merged 3 commits into
mainfrom
desk-ctl-mw4
Oct 26, 2026
Merged

SSFSKIM merged 3 commits into
mainfrom
desk-ctl-mw4

Conversation

@SSFSKIM

@SSFSKIM SSFSKIM commented Oct 26, 2026 •

Copy link
Copy Markdown
Owner

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

  • Bridge (sminos/hooks/mods/bridge-agent-ops.tsx, new; routed from bridge.tsx): DX5 ops stop-agent and tell. The agent is named by its id or its Agent call's name, resolved against $.agent.list(): an id first, then the name of exactly one running agent; none → unknown-agent, two → ambiguous-agent naming their ids. stop-agent runs TaskStop on 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?}. An Agent call's result waits for a pending stop note (at most INTERRUPT_HOLD_MS, as an interrupted turn's Bash call does), so a foreground parent reads the note with the interruption. tell sends through $.session.send to 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.
  • Capabilities: controls['stop-agent'] and controls.tell turn available; ops lists both.
  • Daemon (sminos_rpc.py): RPCs stop-agent and tell — shape (agentId 1–128 characters, not blank, no control character; tell's text non-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 no op events follow; a claim the daemon stopped mid-flight is reconciled from the answer the child kept under the nonce (KEPT_READERS in trace()), as a steer's is.
  • Not built (as scoped): launched workflows held as running.

Validation Evidence

  • Full sminos suite — sminos/tests/run-sminos-tests.sh: all 2416 assertions passed, exit 0.
  • Mods — claude plugin test sminos: 551/551 pass (new stop-agent ×10, tell ×5 in bridge.test.ts; controls list in reads.test.ts). tests/mods/typecheck.sh: exit 0.
  • Daemon — 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 — ci-gate from 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)
  • Live check, Claude Code 2.1.310 fully isolated (fresh HOME/CLAUDE_CONFIG_DIR/SMINOS_HOME under /private/tmp, env -i, a recording stub on 127.0.0.1, a dummy key, zero inference), driving the bridge's child directly:
    • Background agent bg-sleeper: tell by 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-agent by 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 → no resolvedAgentId. A second stop, nobody, and the spelling bg sleeper → unknown-agent. The daemon's running_agent against the live child: id True, bg-sleeper True, spaced / unknown / description False.
    • Foreground agent (CLAUDE_CODE_FORK_SUBAGENT=0): tell reached 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.
    • A stop by a name holding a space could not be staged live: 2.1.310's Agent tool refuses such a 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 mw4 producer, spec Decision Log): SSFSKIM/MAWS#168

Review fix wave (d4d8e04)

  • The daemon resolves the spelling to an id against the child's tree (an id first, then exactly one running name; a shared name is refused ambiguous-agent before the claim) and passes it as resolvedAgentId. The bridge acts on that agent alone, so an agent that took the name since is never stopped or told in its place.
  • When a hook refuses TaskStop ({deny}), the stop is refused and no note is written.
  • A background agent's <task-notification> row is held in the session.append hook until the stop's note is kept (at most INTERRUPT_HOLD_MS), so the parent's next request carries the note.
  • The note goes to the stopped agent's parent loop (parentId). If it is not kept, the answer says so in noteError.

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-gate on d4d8e04: GREEN, all 8 gates PASS (https://github.com/SSFSKIM/doperpowers/actions/runs/40320039414).
  • Live on 2.1.310, a plugin copy that keeps the note 750 ms after TaskStop (the reviewer's probe delay): the parent's first request came at 0.79 s and carried the note, then the notification. Without the fix, the probe's request came at 52 ms with no note. At normal timing (bg) the request came at 0.05 s with both. Foreground with resolvedAgentId: the interrupted result and the note arrived in one user message.

Sminos-Session: desk-sminos-orchestrator#b4948247 (doperpowers on macbook)

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)
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-26T11:40:52.879038Z 2681b50 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread sminos/hooks/mods/bridge-agent-ops.tsx Outdated
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 }] } })

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Comment on lines +84 to +86
const r = await $.tool.call({ tool: 'TaskStop', task_id: id })
if (r.isError === true) {
return { ok: false, error: engineError(r.text) }

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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)
@SSFSKIM
SSFSKIM merged commit acd2006 into main Oct 26, 2026
10 checks passed
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