Repository navigation
feat(threads): an agent that asks with notify is told when a thread on another computer settles - #1328
Merged
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
An agent that starts work on another computer (
thread_createwithcomputer, orthread_sendto a thread it launched there) could not setnotify: both tools refused it. The agent had to keep callingthread_wait, or it never learned the result.Change
notifyis 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.thread_watches) getstarget_nodeset, andtarget_thread_idholds the thread's id on that computer. The column was already there, so no migration is needed (the run database stays at 22).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 withRemoteLaunchedThreads.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 samefollowMessageused 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 freshqueue:<itemId>run), and a steer handed back to the queue.thread_wait. A thread deleted there ends the watch asdeleted.SettleNotices.start()resumes every active remote watch from its row, and the loop finds the message again before it waits.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 thatruns.waitreturned. That computer cuts the reply to 4,000 characters; here it is cut to 2,000, with the full length and athread_readpointer. 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.notifycarry the sameNOTIFY_NEXTwording. Thethread_senddescription andsrc/mms/run/mcp/instructions.tsdrop "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.waitdoes not report (it counts whatquestions.listPendingForThreadholds there). On a computer withoutruns.wait, the reply text is not read (polling reads statuses only), so the notice gives the status and thethread_readpointer. 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
src/mms/orchestrator/remoteSettleFollow.ts: the loop, the codes that end a watch and the ones that are waited out, andlocate(the routed reads given tofollowMessage). Most of the risk is here.src/mms/orchestrator/settleNotices.ts:watchRemote, the start, stop and expiry hooks,planRemote, and theplanSettleNoticeadditions (computer,resultChars, theunreachable:phrases). The local path is unchanged apart from the sentence-ending dot, which is now computed on the whole line.src/mms/run/mcp/appTools/thread.ts: the two refusals becomewatchSent(..., { node }).OrchestratorService.ts, plus two small edits inRemoteLaunchedThreads.ts: a publicreadThread, andremoteReachRefusalkeeps thereasonof acomputer_forbidden.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.settleNoticeRemote.test.ts(two real daemons linked by Bridge):queue:<itemId>run.remoteSettleFollow.test.tsis 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.delegationGuidancesnapshots changed only by thethread_senddescription and the instructions sentence.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) widensRemoteLaunchedThreads.reach()and editsappTools/thread.ts. My edits there are small:readThreadand thereasondetail inRemoteLaunchedThreads.ts, and the twonotifybranches inthread.ts. #1311 also changesnotifyArginthread.ts, which is a one-line conflict. Whichever merges second rebases.Refs #1160
🤖 Generated with Claude Code