Repository navigation
feat(threads): an agent that asks with notify is told when the other thread settles - #1232
Merged
Merged
Conversation
bvsr365
force-pushed
the
thread-settle-notice
branch
from
November 15, 2026 15:41
763f005 to
1db25f2
Compare
…thread settles thread_send and thread_create take notify: true. Mousse keeps one durable watch per message (run database v20, thread_watches) that follows it through a re-queue, a steer handed back and a usage-limit pause, and tells the sender once when the work waits on a person and once when it ends, or once without a turn after 24 hours. The notice is Mousse's own kind (settleNotice), shows the thread as its thread chip, goes through the sender's queue like a goal turn, never starts a turn in a subagent, a stopped sender or one kept in Plan, and carries the watched run's count of agent messages in a row. Refs #1160 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
bvsr365
force-pushed
the
thread-settle-notice
branch
from
November 15, 2026 16:02
1db25f2 to
e9395f5
Compare
This was referenced Nov 15, 2026
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 messages another thread (
thread_send, orthread_createwith a first message) gets back only a run id. To hear the result it must callthread_waitin the same turn. An agent that ends its turn never learns that the other thread finished, and one that waits holds its own turn open for minutes.Change
thread_sendandthread_createtakenotify: true. Mousse then keeps one durable watch for that message and tells the sending thread when the work settles. The result says what to do next: "Mousse will tell you when it settles. Do not call thread_wait or thread_read to check. End your turn when nothing else is left."queue:<itemId>run), a promotion to a steer, and a steer handed back. A queued message removed before it ran ends as "never ran".ChatMessage.settleNotice), written by Mousse. It carries the status, the reply cut to 2,000 characters with a pointer tothread_read, and the thread'smousse://thread/<id>link. The chat and the queue show it as a notice row: the thread as its thread chip (title and live status, a click opens it) and what happened there, not the person's message or an agent's bubble./goalturns use: a queue item with sourcethread-notice. It starts a turn when the sender is idle and runs after the current turn when the sender is busy. Notices that meet in the queue are delivered as one turn. A notice never starts a turn in a subagent's thread, in a sender a person stopped after it subscribed, in a sender kept in Plan, or for the 24-hour notice. There it waits in the queue (heldNotice) until a person sends it, the person's next turn (outside Plan) lets it run after, or a notice that may start a turn joins it. In a subagent's thread the waiting text joins the nextcontinue_subagentfollow-up.noticeHopson the run). A sender and a target can go back and forth three times before a person must step in, and a thread that started several threads hears from each of them.originis an agent's, and the repeat refusal (duplicate_message) and the caps are checked only on an agent's send and queue commands. A notice item has nooriginand is written into the sender's queue by Mousse (queueSettleNotice), so it is never refused by them and never takes an agent's place under the caps. Thethread_sendresult keepsdelivery(feat(threads): thread_read is bounded and reads on; agent messages are capped per sender #1222) and addsnotify: { watchId, next }.thread_sendandthread_createdescriptions say to setnotifywhen the result is needed.thread_waitis described as only for a turn that cannot continue without the answer. The agent instructions, SPEC §15.1 and the glossary match.The watch's target (
target_thread_id,target_node) is stored apart from the way it learns about the run (WatchTargetinsrc/mms/run/settle/follow.ts). The later notice for a thread on another computer adds a follower without changing the table.How to review
src/mms/run/settle/follow.ts, how a message is followed between runs, with its table intests/run/settleFollow.test.ts.src/mms/run/settle/ThreadWatches.tsand migration 20 (thread_watches). Each decision is written asduebefore delivery and assentafter, so a restart delivers what was decided.src/mms/orchestrator/settleNotices.ts: when to tell, what the notice says, when it is held, and expiry.OrchestratorService.ts:startSettleNotices,queueSettleNotice,releaseHeldNotices,heldNoticesOf(thecontinue_subagentfold), thesettleNoticefield carried from the queue item to the turn's message, and Send now releasing a held notice.ThreadMessageQueue.ts:mergeSettleNotice, and the drain skipping held notices.thread.ts: thenotifyargument and the result wording.message-list.tsx,SubagentNotice.tsxandQueuedMessages.tsx.Where the risk is: the queue drain now skips
heldNoticeitems (claimNextNormal). A person's turn releases them only outside Plan and outside subagent threads.Verification
Tier 5 (run engine and persistence). Tested commit:
e9395f541, rebased onorigin/master9bcedd70c.Run locally with
npx vitest run --maxWorkers=3 <files>. All 33 files passed (860 tests):tests/run/threadSettleNoticeDaemon.test.ts: a real orchestrator, run engine, effect worker and MCP server with scripted runtimes. It covers:tests/run/settleFollow.test.ts: the follow rules, including the pause continuation, a steer joined and a steer handed back.tests/run/settleNoticeExpiry.test.ts: 24 hours tell the sender once, held; the work's later end tells nothing more.tests/renderer/settleNoticeRow.test.ts: the mounted chat shows a notice row with the thread's chip, which opens it, not a user bubble and not the model's text.tests/renderer/queuedMessagesInChat.test.ts: a queued notice row offers no Edit.threadActionsDaemon,threadActionsTools,threadCreateDaemon,queueEditDaemon,threadCreateTools,mcpToolRegistry,queueHoldAfterStopRestart,usageLimitPause,profileDatabase,queueJournal,threadMessageQueue*(4 files),threadTitleText,queueTools,stopThread,botThreadTools,leaseRaceQueuedSend,queueSteerExactlyOnce,continueAfterRestart,nextSteerableQueueItem,findInThread,mcpAttachment,botThreadsDaemon,remoteSubagents,contractVersions(run database 19 → 20), anddelegationGuidance(its inline snapshot of the agent instructions changes on purpose).npx tsc --noEmitfortsconfig.node.jsonandtsconfig.web.json, andeslinton the changed files.Not checked:
followMessagetable, not end to end.expireDueis called directly; the daemon arms the timer at start and on each new watch.continue_subagentfold of held notices has no test.Notes
The watch table is run database migration 20 (18 is #1220's, 19 is #1235's). The notice for a thread on another computer is PR 11 of #1160 and builds on this.
Refs #1160
🤖 Generated with Claude Code