Skip to content

desk-hub: MW4 one agent stopped or told — stop-agent, tell, unknown-agent - #168

Merged
SSFSKIM merged 7 commits into
masterfrom
desk-ctl-mw4
Oct 26, 2026
Merged

SSFSKIM merged 7 commits into
masterfrom
desk-ctl-mw4

Conversation

@SSFSKIM

@SSFSKIM SSFSKIM commented Oct 26, 2026 •

Copy link
Copy Markdown
Owner

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 in apps/desk-web changes.

What it builds

  • Protocol (apps/desk-hub/src/protocol/rpc.ts): RPCs stop-agent {agentId} → {agentId, accepted: true, resolvedAgentId?} and tell {agentId, text} → {sent: true}; the new DX6 code unknown-agent. session.ts: lane A sends no op for either — the RPC's answer is the outcome.
  • Fake machine: a mw4 producer (--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-agent before the claim when the tree holds no running agent by that id or name, a stop's note and tree end, each message kept in told; older producers refuse both bad-shape (no RPC "…").
  • Spec: Surprises (three 2.1.310 observations: the Agent tool's name pattern, the coordinator envelope on a plugin's send, where the stop's note lands), the Decision Log's MW4 as built (with one Open item: an engine-allocated name reaches the bridge but not the child's tree), dated DX4/DX5/DX6 interface paragraphs. The MW4 Progress tick is left to the orchestrator.

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.ts updated for the two results.
  • CI — scripts/ci-gate.sh /tmp/maws-desk-mw4 --gates static,unit: run 40313151577 success, exit 0 (https://github.com/SSFSKIM/MAWS/actions/runs/40313151577).
  • Live check (Claude Code 2.1.310, isolated profile behind a recording stub, zero inference), whose answers the mw4 producer replays: stop by name {agentId:'bg-sleeper', accepted:true, resolvedAgentId} in ~19 ms, by id without resolvedAgentId; tell {sent:true} read by the agent at its next step (1–2 s); a second stop, an unknown name and a spaced spelling refused unknown-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)

  • DX6 gains ambiguous-agent. stop-agent's result gains noteError?, present when the parent's note was not kept.
  • The fake machine resolves an id first, then exactly one running name, and acts on the agent its check resolved.
  • A stop-agent effect is restored after a crash, from its trace: the agent is stopped again and its note written once.
  • Spec: dated DX5 and DX6 lines, and a Decision Log entry for the fixes.

Validation:

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

…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)
@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:37.810468Z 525b511 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: 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".

Comment thread apps/desk-hub/fake-machine/session.ts Outdated
Comment on lines +766 to +767
const running = [...this.bridgeAgents.values()].filter((a) => a.running);
return running.find((a) => a.agentId === ref) ?? running.find((a) => a.name === ref) ?? null;

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 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 }) });

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 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)
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