Repository navigation
desk-hub: MW4 one agent stopped or told — stop-agent, tell, unknown-agent - #168
Conversation
…n-agent
RPC_NAMES gains stop-agent ({session, agentId}, answered {agentId, accepted:
true, resolvedAgentId?}) and tell ({session, agentId, text}, answered {sent:
true}); each answer is the outcome, no op follows. RpcErrorCode gains
unknown-agent (an agent the session's subagent tree does not hold as running,
before the claim). The hub admits both by name, as every RPC. The fake
machine's mw4 producer (sminos 1.14.0) answers from the MW4 live check's
recording (dx4/mw4-agents.json): both ops and controls available, the recorded
named agent spawned once played, the tree check before the claim, a stop's
note and its tree entry, each message kept in `told`; an older producer
refuses both bad-shape.
Sminos-Session: desk-sminos-orchestrator#b4948247 (doperpowers on macbook)
… interfaces 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: 525b511dd2
ℹ️ 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".
| const running = [...this.bridgeAgents.values()].filter((a) => a.running); | ||
| return running.find((a) => a.agentId === ref) ?? running.find((a) => a.name === ref) ?? null; |
There was a problem hiding this comment.
Reject ambiguous agent names instead of choosing the first
When two running agents have the same name, runningAgent() selects the first entry, so stop-agent stops an arbitrary agent and tell delivers to that agent instead of refusing the ambiguous reference. This contradicts the MW4 resolution contract in docs/doperpowers/specs/2026-10-22-desk-control-surface-design.md, which explicitly requires an ambiguous-agent refusal naming both IDs. A direct check with two spawned agents named duplicate confirms that stopping by name stops the first and leaves the second running. Preserve exact-ID precedence, but reject multiple name matches before claiming or executing either RPC so the fake producer does not validate behavior the real bridge rejects.
Useful? React with 👍 / 👎.
| const id = depth.stopAgent(asked); | ||
| if (id === null) return fail('failed', `unknown-agent: no running agent has the id or name ${asked}`); | ||
| await this.flush(); | ||
| return this.traced(rpc, record, depth.id, { agentId: asked, accepted: true, ...(id !== asked && { resolvedAgentId: id }) }); |
There was a problem hiding this comment.
Restore stopped-agent effects when rebuilding from memory
When a fake machine is reconstructed with the same memory after a crash, this trace preserves only the successful answer, not the stopped agent's state or its parent note. The constructor restores effects for steer, stop, and spawn, but has no restoration path for stop-agent. Replaying the agent's spawn therefore makes it running again and drops the note, while retrying the original nonce still returns the successful stop from the ledger or trace without executing it. A direct restart check with the committed two-subagents recording reproduces both losses. Persist and restore the resolved agent's stop and note, including when its spawn is encountered during replay, as the existing task-stop recovery does.
Useful? React with 👍 / 👎.
…d on, a stop kept across a crash - DX6 gains ambiguous-agent (a name two running agents hold, before the claim); stop-agent's result gains noteError? (the parent's note not kept). - The fake machine resolves an id first, then one running agent's name, and acts on the agent its check resolved, never a later namesake. - A stop-agent's effect is restored after a crash from its trace: the agent stopped again, its note once, as an ordinary stop's rows are. - Spec: dated DX5/DX6 lines and a Decision Log entry for the review fixes. Sminos-Session: desk-sminos-orchestrator#b4948247 (doperpowers on macbook)
…play, tell only a running agent - A stop restored after a crash is an overlay over later replay updates: a resync of the tree that lists the agent running neither undoes the stop nor writes its note again (written once, tracked apart). - The fake's tell checks that the agent its check resolved still runs, as its stop does, and never falls back to a namesake. - Spec: the bridge's resolvedAgentId is checked by membership in the list (a teammate's id is <name>@<team>), and the fixes above. Sminos-Session: desk-sminos-orchestrator#b4948247 (doperpowers on macbook)
…tored stop held over the replay The spec half that 8358966's message names but did not carry. Sminos-Session: desk-sminos-orchestrator#b4948247 (doperpowers on macbook)
…refer-const) Sminos-Session: desk-sminos-orchestrator#b4948247 (doperpowers on macbook)
Sminos-Session: desk-sminos-orchestrator#b4948247 (doperpowers on macbook)
MW4 of the desk control surface (spec
docs/doperpowers/specs/2026-10-22-desk-control-surface-design.md, Plan of Work, the machine-side wave): the hub's half of one subagent stopped or told. Nothing inapps/desk-webchanges.What it builds
apps/desk-hub/src/protocol/rpc.ts): RPCsstop-agent{agentId}→{agentId, accepted: true, resolvedAgentId?}andtell{agentId, text}→{sent: true}; the new DX6 codeunknown-agent.session.ts: lane A sends noopfor either — the RPC's answer is the outcome.mw4producer (--producer mw4, sminos 1.14.0) answering from the live check's recording (fake-machine/dx4/mw4-agents.json): its capabilities, a recorded agent spawned on a played session (spawnRecordedAgent,bg-sleeper),unknown-agentbefore the claim when the tree holds no running agent by that id or name, a stop's note and tree end, each message kept intold; older producers refuse bothbad-shape(no RPC "…").Validation Evidence
apps/desk-hub/test/fake-machine/desk-mw4.test.ts: 8/8 (RED with the implementation stashed: 6 failed, e.g. fm.spawnRecordedAgent is not a function).frames.test.tsupdated for the two results.scripts/ci-gate.sh /tmp/maws-desk-mw4 --gates static,unit:run 40313151577 success, exit 0 (https://github.com/SSFSKIM/MAWS/actions/runs/40313151577).mw4producer replays: stop by name{agentId:'bg-sleeper', accepted:true, resolvedAgentId}in ~19 ms, by id withoutresolvedAgentId;tell{sent:true}read by the agent at its next step (1–2 s); a second stop, an unknown name and a spaced spelling refusedunknown-agent; the parent's next request carried the note (background: ahead of the<task-notification>; foreground: with the interrupted tool result). Detail in the doperpowers PR.The doperpowers half (bridge, daemon, sminos 1.14.0): SSFSKIM/doperpowers#399
Review fix wave (ddbe8fd)
ambiguous-agent.stop-agent's result gainsnoteError?, present when the parent's note was not kept.stop-agenteffect is restored after a crash, from its trace: the agent is stopped again and its note written once.Validation:
desk-mw4.test.ts: 10/10. RED before the fix: 2 failed.test/fake-machineandtest/protocol: 371/371. desk-hub typecheck: exit 0.scripts/ci-gate.sh … --gates static,uniton ddbe8fd: success (https://github.com/SSFSKIM/MAWS/actions/runs/40320041474).Sminos-Session: desk-sminos-orchestrator#b4948247 (doperpowers on macbook)