Skip to content

feat(threads): remote subagents expire with their thread, count their time limit as running time, and keep their Stops until delivered - #1472

Merged
TheAnimatrix merged 1 commit into
masterfrom
issue-1454-remote-stop-expiry
Nov 17, 2026
Merged

TheAnimatrix merged 1 commit into
masterfrom
issue-1454-remote-stop-expiry

Conversation

@TheAnimatrix

Copy link
Copy Markdown
Collaborator

Problem

A subagent started on another computer did not follow the thread that started it:

  • Its thread there kept living after the parent thread here expired (A thread's subagents on other computers outlive its expiry #685).
  • maxMinutes was wall-clock time on the calling computer, so time the task spent waiting for a person's answer used up its limit.
  • A Stop that could not reach the other computer showed nothing on the subagent's row, and a launched thread's kept Stop was dropped after a day.

Change

  • Expiry. A remote subagent's thread there gets its root thread's expiry when it is created, and every later change or removal. Each change is a durable intent (remote_expiry) sent with the existing threads.setExpiry until 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.
  • Running-time limit. maxMinutes now travels with the task as running time: a marked orchestrator.send carries deadlineMinutes (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.
  • Stops. A subagent whose Stop has not reached its computer yet shows "Stop requested" in Lineage (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_task describes maxMinutes as running time. Glossary (Expiry), threat model and Run Engine spec updated.

Run DB migration 24 adds remote_subagents.limit_minutes, remote_expiry and run_time_limits.

How to review

  • src/mms/orchestrator/RemoteSubagents.ts: sendExpiry, runningLimitThere, and the limitTaken check in advanceStart.
  • 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 of deadlineMinutes on the owner.
  • src/shared/bridge/routed.ts: orchestrator.send version 8. The agent-mark table test now checks the mark's own since instead of the row's newest version.
  • src/mms/orchestrator/RemoteLaunchedThreads.ts: when a kept Stop is given up.

Verification

  • Typecheck (tsconfig.node.json, tsconfig.web.json) clean.
  • Named tests on Windows, 348 passed: 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.
  • Two real daemons: the owner keeps the limit, stops the run at it with the message, the caller's task ends with that reason, and the owner's thread gets the parent's expiry.
  • tests/run/profileDatabase.test.ts fails one POSIX permission check on Windows; it fails the same way on master.

Notes

Left for later:

Fixes #685
Refs #1454

… 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
@TheAnimatrix
TheAnimatrix merged commit b5971f8 into master Nov 17, 2026
7 checks passed
@TheAnimatrix
TheAnimatrix deleted the issue-1454-remote-stop-expiry branch November 17, 2026 14:08
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.

A thread's subagents on other computers outlive its expiry

1 participant