Skip to content

feat: mcp --no-register keeps one-off agents out of the directory - #223

Open
reason-machines[bot] wants to merge 5 commits into
mainfrom
reason/reason-network-mcp-no-re-e8b9025d
Open

reason-machines[bot] wants to merge 5 commits into
mainfrom
reason/reason-network-mcp-no-re-e8b9025d

Conversation

@reason-machines

@reason-machines reason-machines Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Scheduled Claude Desktop tasks start reason-network mcp, which registers each one-off agent as its own numbered/folder-named session in the team directory, so teammates' agents can route to throwaway workers (feedback from workspace "S Line"). This adds a per-invocation opt-out. Default behaviour is unchanged.

What changes

  • reason-network mcp --no-register (or REASON_NETWORK_NO_REGISTER set, read via paths::env_var_os like NO_SERVICE) skips the startup registration and never registers a session of its own.
  • list_team calls Who { me: None }: no registration.
  • send_message / check_inbox / message_status / ask_user go by one kept mailbox cli:tasks (<you>/tasks, same as listen --as tasks), shared by all such processes on the machine. Deliberately not terminal: messages from /terminal render "typed in a terminal", skip the daemon's agent-loop limiter and may message groups; tasks stays an agent sender (groups refused, loop limit applies).
  • MCP instructions get a note when the flag is on; check_inbox is never hidden in this mode.
  • README and the DESIGN identity table document it; --help shows the flag.
  • New tests/mcp_no_register.rs: register-off (flag and env) -> list_team, send, and reply via check_inbox work and the directory holds only alice/role + alice/tasks, no agent session; default -> a -codex session is registered and is the sender.

Checks (Linux cloud machine, stable 1.99.1)

  • cargo fmt --check: pass
  • cargo clippy --all-targets --locked -- -D warnings: pass
  • cargo test --locked: pass (341 unit, config_typo 5, install_script 2, mcp_no_register 2)
  • Before handover the register-off test was confirmed to FAIL on main @ 5442c8b and pass with the patch; the default test passes on both.

Also bumps Cargo.toml/Cargo.lock to 0.12.18 (as #174–#178 did) so the v0.12.18 tag can be cut from the merge commit.

Not verified here: macOS/Windows (CI covers them).

Review fixes (head d04f411)

An independent review (GPT-6.1 Sol) reproduced four problems with the shared cli:tasks mailbox. All four are fixed, and each is covered by a test that fails without the fix:

  1. Two --no-register agents got the same reply. check_inbox now returns (and marks read) only messages whose reply_to is one this process sent. Other mail to <you>/tasks stays for reason-network listen --as tasks.
  2. Cancelling one agent's wait ended every wait on the mailbox (StopWaiting bumps the shared stop_gen). This mode no longer sends StopWaiting, so a cancelled wait only stops locally.
  3. ask_user answers were shared across agents (one pending question per session). ask_user is hidden and refused with --no-register.
  4. A session whose hooks said its folder is off could still send through a shared server. A new daemon request, OffFor, applies the same off-folder and BUSY_OFF refusal as registering, without registering anything.

Checks (Linux, rustc 1.99.1):

  • cargo fmt --check: pass
  • cargo clippy --all-targets --locked -- -D warnings: pass
  • cargo test --locked: pass (341 unit, config_typo 5, install_script 2, mcp_no_register 4)
  • The new tests no_register_agents_get_only_their_own_replies and no_register_keeps_a_session_in_an_off_folder_off FAIL with the fix's src/ changes stashed and PASS with them.

Review fixes, round 3 (head 14b1867)

The reviewer re-checked 76c4bc6 and confirmed the earlier fixes (idempotency per process, reply threading, post-peek cancellation check). It then reproduced two more problems, both now fixed:

  1. A follow-up sent as instructed lost its reply. check_inbox in this mode told the agent to reply with reason-network send … --from alice/tasks, a send this process never saw, so the answer to it was filtered out. It now names the client's own send_message tool, so a follow-up goes through the process and its reply comes back.
  2. An old off-folder conversation blocked a later allowed one in the same agent process. Command Code has no end hook, so A's off-folder record stayed until it expired. A hook from a new conversation in an allowed folder now retires off-folder records with the same agent and pid (agents known by their hooks run one conversation per process).

Checks (Linux, rustc 1.99.1):

  • cargo fmt --check, cargo clippy --all-targets --locked -- -D warnings, git diff --check: pass
  • cargo test --locked: pass (341 unit, config_typo 5, install_script 2, mcp_no_register 8)
  • New tests no_register_follow_ups_sent_as_instructed_get_their_replies (two rounds, following the emitted instructions) and no_register_lets_a_new_conversation_past_an_old_off_one (Gemini hooks: g1 off, then g2 allowed, no end hook) FAIL with this commit's src/ changes stashed and PASS with them.

reason-machines Bot and others added 5 commits November 12, 2026 09:22
Co-authored-by: svemyh <40596752+svemyh@users.noreply.github.com>
Co-authored-by: svemyh <40596752+svemyh@users.noreply.github.com>
…off and honour off folders

Agents sharing the cli:tasks mailbox no longer receive each other's replies, one cancelling a wait no longer ends another's, ask_user (one pending question per session) is off in this mode, and a caller whose hooks said its folder is off is refused via the daemon's new OffFor request instead of being sent through the mailbox.

Co-authored-by: svemyh <40596752+svemyh@users.noreply.github.com>
…d hook-known off folders

Reply instructions to a tasks-mailbox sender name the message they answer (--reply-to / reply_to), so a reply sent as told reaches the agent that asked. Idempotency keys are namespaced per --no-register process, so two agents reusing one key send two messages. OffFor checks an agent known only by its hooks (Gemini, Command Code) by its process, as its hooks noted it in an off folder. check_inbox rechecks cancellation before marking a reply read, and send_message names the mailbox's actual address.

Co-authored-by: svemyh <40596752+svemyh@users.noreply.github.com>
…ation retires its process's old off-folder one

Co-authored-by: svemyh <40596752+svemyh@users.noreply.github.com>
@reason-machines

Copy link
Copy Markdown
Contributor Author

Independent review (GPT-6.1 Sol) found no remaining issues at 14b1867 after three fix rounds; all 8 checks pass. Merge is queued and needs one approving review. After merge, v0.12.18 (version already bumped here) needs its tag pushed by the engine owner to run release.yml.

@reason-machines
reason-machines Bot requested a review from svemyh November 12, 2026 10:21
@reason-machines

Copy link
Copy Markdown
Contributor Author

@svemyh friendly nudge from Feedback resolver: #223 is ready for your approving review. All 8 checks pass on head 14b1867, the independent reviewer (GPT-6.1 Sol) reports no remaining findings, and the squash merge is already requested so it lands as soon as it is approved. After merge, the engine owner pushes v0.12.18 on the merge commit to cut the release.

@reason-machines

Copy link
Copy Markdown
Contributor Author

@svemyh friendly reminder: this still needs one approving review to merge. Head 14b1867 passes all 8 checks, has no conflicts, and the independent review (GPT-6.1 Sol) has no remaining findings. It also bumps the version to 0.12.18, so the v0.12.18 tag can go on the merge commit afterwards.

— Feedback resolver

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.

0 participants