Skip to content

feat(threads): an agent that asks with notify is told when a thread on another computer settles - #1328

Merged
bvsr365 merged 1 commit into
masterfrom
settle-notice-across-computers
Nov 15, 2026
Merged

bvsr365 merged 1 commit into
masterfrom
settle-notice-across-computers

Conversation

@bvsr365

@bvsr365 bvsr365 commented Nov 15, 2026

Copy link
Copy Markdown
Collaborator

Problem

An agent that starts work on another computer (thread_create with computer, or thread_send to a thread it launched there) could not set notify: both tools refused it. The agent had to keep calling thread_wait, or it never learned the result.

Change

notify is now accepted in both places. Mousse tells the sending thread when that work ends, and once before that if the work stops to wait on a person there, the same way it does for a thread on this computer.

  • The watch. The feat(threads): an agent that asks with notify is told when the other thread settles #1232 watch (thread_watches) gets target_node set, and target_thread_id holds the thread's id on that computer. The column was already there, so no migration is needed (the run database stays at 22).
  • Following (src/mms/orchestrator/remoteSettleFollow.ts, new). There is one loop per active watch, and only for watches; nothing follows a launched thread nobody asked about. Each loop waits with RemoteLaunchedThreads.follow() (runs.wait, or polling on an older computer). When the run it follows ends, it reads that computer's newest 30 runs and its queue (runs.list, runs.get, queue.list) and finds the message with the same followMessage used on one computer. That covers a run a usage-limit pause handed on, a queued message a person edited there (its run is cancelled and it gets a fresh queue:<itemId> run), and a steer handed back to the queue.
  • Never a false end. A computer that does not answer (offline, Bridge off here, slow) is asked again with back-off from 5 s to 5 min. Bridge coming up wakes the loops. A computer that refuses this device, stops sharing or is too old ends the watch with one notice that names it. So does the person turning agents off for that computer here, because that would also refuse the launcher's own thread_wait. A thread deleted there ends the watch as deleted.
  • Restart. SettleNotices.start() resumes every active remote watch from its row, and the loop finds the message again before it waits.
  • The notice is the feat(threads): an agent that asks with notify is told when the other thread settles #1232 kind, written here by Mousse. It names the thread by its qualified link (mousse://thread/<node>:<id>) so feat(threads): a thread an agent started says so, and the thread that started it links to it #1224's chip draws it with the computer's state, says "on ", and quotes the reply that runs.wait returned. That computer cuts the reply to 4,000 characters; here it is cut to 2,000, with the full length and a thread_read pointer. The hop count is the run's count read there, and never below what the send carried. The rules for at most two notices, holding the notice (subagent, sender stopped, Plan, expiry), merging and the 24-hour expiry are the same code as on one computer. The expiry notice says the work had not ended when Mousse last reached that computer. A new end status, unreachable, gets a renderer verb.
  • What the other computer sees: reads only. There is no new routed row, and nothing there knows a watch exists.
  • Tool results with notify carry the same NOTIFY_NEXT wording. The thread_send description and src/mms/run/mcp/instructions.ts drop "notify does not reach it yet". SPEC §15.1 gets a "thread on another computer" paragraph, and the threat model gets one bullet.

What cannot be seen from here: a hand-off older than the newest 30 runs of that thread, and a needs-input state that runs.wait does not report (it counts what questions.listPendingForThread holds there). On a computer without runs.wait, the reply text is not read (polling reads statuses only), so the notice gives the status and the thread_read pointer. A notice decided just before a crash and delivered after the restart carries its status and the count the send carried, but not the reply.

How to review

  1. src/mms/orchestrator/remoteSettleFollow.ts: the loop, the codes that end a watch and the ones that are waited out, and locate (the routed reads given to followMessage). Most of the risk is here.
  2. src/mms/orchestrator/settleNotices.ts: watchRemote, the start, stop and expiry hooks, planRemote, and the planSettleNotice additions (computer, resultChars, the unreachable: phrases). The local path is unchanged apart from the sentence-ending dot, which is now computed on the whole line.
  3. src/mms/run/mcp/appTools/thread.ts: the two refusals become watchSent(..., { node }).
  4. Wiring in OrchestratorService.ts, plus two small edits in RemoteLaunchedThreads.ts: a public readThread, and remoteReachRefusal keeps the reason of a computer_forbidden.
  5. Tests, then docs.

Verification

Tier 5 (run engine, networking). Tested commit ca79f3def4787df0b526ca97213fd25dc4b568d4.

  • npx vitest run tests/net/bridge/routed/settleNoticeRemote.test.ts tests/run/remoteSettleFollow.test.ts tests/net/bridge/routed/threadToolsRemote.test.ts tests/run/threadSettleNoticeDaemon.test.ts tests/run/settleFollow.test.ts tests/run/settleNoticeExpiry.test.ts tests/renderer/settleNoticeRow.test.ts tests/run/delegationGuidance.test.ts tests/run/mcpAttachment.test.ts tests/run/codexAdapter.test.ts tests/run/mcpRelayTurnStart.test.ts: 11 files, 177 tests passed. The two new files also passed in two more runs.
  • npm run typecheck: clean.
  • Which test observes each part of the claim, in settleNoticeRemote.test.ts (two real daemons linked by Bridge):
    • The end notice arrives once, with the reply cut to 2,000 characters, the full length in the pointer, the qualified link and the computer's name. The watch ends, and nothing follows it afterwards.
    • A needs-input notice comes first. It is told once while the work keeps waiting, and the end notice still comes.
    • The notice carries the count of the run there (set to 3 there, while the send carried 1), and the idle launcher's notice turn carries that count.
    • A queued message that a person edited there is followed into its queue:<itemId> run.
    • A restart of this daemon while the link is down: the run ends meanwhile, there is no notice and the watch stays active while the computer is unreachable. Once the link is back, the end notice arrives.
    • A blocked device ends the watch with one notice (" refused this device") and stops asking.
    • Expiry gives one held notice, and nothing more after the work ends.
    • No turn starts in a launcher kept in Plan or in a subagent's thread.
  • remoteSettleFollow.test.ts is a table of what ends a watch. Offline, slow and Bridge off keep it active. Blocked, sharing off, too old, agents turned off here and the thread deleted end it with one notice that says which.
  • The delegationGuidance snapshots changed only by the thread_send description and the instructions sentence.
  • Not checked: the real app with two machines, and a computer without runs.wait (its polling path is feat(threads): an agent reads, waits on, messages, steers and stops a thread it launched on another computer #1310's and is not exercised by these new tests).

Notes

Overlap: PR 12 (thread-list-search-other-computers, not pushed yet) widens RemoteLaunchedThreads.reach() and edits appTools/thread.ts. My edits there are small: readThread and the reason detail in RemoteLaunchedThreads.ts, and the two notify branches in thread.ts. #1311 also changes notifyArg in thread.ts, which is a one-line conflict. Whichever merges second rebases.

Refs #1160

🤖 Generated with Claude Code

…n another computer settles

thread_create with computer and notify, and thread_send to a launched thread
with notify, are accepted. The watch's target is the thread there
(thread_watches.target_node, no new column); RemoteSettleFollower follows each
active one through the reads thread_wait makes (runs.wait, or polling), finds
the message among that computer's runs and queue with followMessage when its
run ends, and hands what it decides to SettleNotices, which writes the same
notice kind here: the qualified link, the computer's name, the reply cut to
2,000 characters with its full length, and the run's count there.

A computer that does not answer is asked again with back-off and never ends a
watch; one that refuses this device, stops sharing or is too old (or that the
user turned agents off for) ends it with one notice. A restart resumes every
watch from its row; the 24-hour expiry holds.

Refs #1160

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@bvsr365
bvsr365 merged commit 63c3dbb into master Nov 15, 2026
7 checks passed
@bvsr365
bvsr365 deleted the settle-notice-across-computers branch November 15, 2026 23:04
bvsr365 added a commit that referenced this pull request Nov 15, 2026
…fused

#1328 made notify work for a thread started on another computer; the case that expected a refusal
is removed (settleNoticeRemote.test.ts covers the notice).

Refs #1160

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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