Repository navigation
feat(threads): remote subagents expire with their thread, count their time limit as running time, and keep their Stops until delivered - #1472
Merged
Conversation
… time limit as running time, and keep their Stops until delivered A remote subagent's thread on the other computer gets its root thread's expiry, and every later change or removal, sent until that computer takes it. A maxMinutes limit is sent with a marked orchestrator.send (version 8, deadlineMinutes) and counted there as running time; older computers keep the wall-clock stop. A Stop that has not reached the other computer shows as Stop requested, and a launched thread's kept Stop no longer expires after a day. Refs #1454
37 of 39 tasks
This was referenced Nov 17, 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
A subagent started on another computer did not follow the thread that started it:
maxMinuteswas wall-clock time on the calling computer, so time the task spent waiting for a person's answer used up its limit.Change
remote_expiry) sent with the existingthreads.setExpiryuntil that computer takes it, also across restarts and while it is offline. An expiry that passed while that computer was offline is sent as a minute and a half from now (the soonest it takes), so its thread still goes. A refusal for good (for example a computer that does not let this one change its threads) is kept as the reason and not asked again.maxMinutesnow travels with the task as running time: a markedorchestrator.sendcarriesdeadlineMinutes(routed version 8). The executing computer counts only the time the run works (not queued, paused, or waiting on a question or approval in it or below it) and stops the run when the limit is used, with "Stopped after its limit of N minutes of running time." The calling computer stops the task by the clock only when that computer is older or did not echo the limit back.SubagentComputer.stopRequested) until it is delivered. A launched thread's kept Stop no longer expires after a day; it is given up only when that computer is no longer one of the user's computers, and is skipped while that computer is listed as offline.delegate_taskdescribesmaxMinutesas running time. Glossary (Expiry), threat model and Run Engine spec updated.Run DB migration 24 adds
remote_subagents.limit_minutes,remote_expiryandrun_time_limits.How to review
src/mms/orchestrator/RemoteSubagents.ts:sendExpiry,runningLimitThere, and thelimitTakencheck inadvanceStart.src/mms/orchestrator/RunTimeLimits.ts: the counting rules (at most two ticks per tick, so a sleeping computer adds nothing).src/mms/bridge/routed/remoteAgent.ts: validation ofdeadlineMinuteson the owner.src/shared/bridge/routed.ts:orchestrator.sendversion 8. The agent-mark table test now checks the mark's ownsinceinstead of the row's newest version.src/mms/orchestrator/RemoteLaunchedThreads.ts: when a kept Stop is given up.Verification
tsconfig.node.json,tsconfig.web.json) clean.tests/run/{remoteSubagents,runTimeLimits,delegationGuidance,remoteSubagentEngine,subagentView,agentActionsEngine,stopThread}.test.ts,tests/sideCardLineage.test.ts,tests/threadExpiry.test.ts,tests/net/bridge/routed/{table,remoteSubagents,threadToolsRemote,threadCreateRemote,accessClasses}.test.ts. Two routed files report the known Windows EPERM at teardown after all their tests pass.tests/run/profileDatabase.test.tsfails one POSIX permission check on Windows; it fails the same way on master.Notes
Left for later:
thread_createon another computer do not get the launcher's expiry.Fixes #685
Refs #1454