Repository navigation
feat(threads): thread_create starts a thread on another of the user's computers - #1290
Merged
Merged
Conversation
…dule remote subagents and launched threads share create, setModel, composer.options, setPermissionMode and send now run from runRemoteThreadStart. Every write has its own idempotency key from the start's key; the mode's key names the mode, which is narrowed afresh each time. Remote subagents keep their create and send keys and behave as before. Refs #1160 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…itory when it has no single answer Refs #1160 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… computers thread_create takes computer (and a project id of that computer to choose among checkouts). The local checks run first, then the launch is recorded with its receipt in a new remote_launches table (run database 21) and RemoteThreadLaunches runs the shared start sequence, every write marked as the agent's. A retry with the same clientRequestId continues the same launch; one a restart cut off is finished by later passes, or archived there with threads.settle. The launcher gets a thread chip note. Refs #1160 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Refs #1160 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…puter Refs #1160 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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 can start a thread only on this computer. The only work it can start on another of the user's computers is a subagent. The agent threads design (#1161, §4.4) also lets an agent start a top-level thread on another computer, in that computer's copy of the same repository.
Change
thread_createtakescomputer(a name fromlist_computers), and optionallyprojectId, a project of that computer, to choose among several checkouts. Withoutcomputernothing changes.instanceIdandmodeltogether, or neither for that computer's default.projects.matchmust find exactly one strong match: a shared root commit and a shared remote. No strong match, or several, refuses with the candidates' ids and names, andprojectIdpicks one of them. Nothing is cloned (Starting a thread on another computer drops the project when that computer doesn't have it #484).computer_outdatedand gets no call that changes a thread.thread_create:<caller>:<key>, kindremote_thread_create, with the computer) and aremote_launchesrow are written in one transaction before any call.RemoteThreadLaunchesthen runsthreads.create→threads.setModel→composer.options→threads.setPermissionMode→orchestrator.send:remoteThreadStart.tsnow runs these steps for remote subagents and launched threads alike. Remote subagents keep their create and send keys; their model and mode writes now get keys too.remote_launches(run database 21) is this computer's record that a thread here launched a thread there:starting,created,launchedandabandoned;none,pending,sent,failedoruncertain;{ threadId: "<node>:<id>", link, computer, title, permissionMode, model, runId?, firstMessage: "sent" | "failed" | "uncertain", firstMessageReason?, replayed }:clientRequestIdcontinues the same launch and never makes a second thread or sends twice;uncertain, never done or failed. A create that is not confirmed answersstatus: "uncertain".abandoned, and a thread already made for it there is archived withthreads.settle.computer_offline,computer_not_shared,computer_outdated,computer_not_allowed(here, or that computer's agent reachnone),no_matching_project,several_matching_projects, plusprivate_thread,remote_from_remote,creation_limitandagent_hops_exceeded.docs/run-engine/SPEC.md§15.1 and the threat model ("Threads agents start on another computer").How to review
Read the commits in order:
refactor(subagents):remoteThreadStart.tsandRemoteSubagents.advanceStartnow calling it. The only behaviour change for subagents is idempotency keys onsetModelandsetPermissionMode.feat(bridge):projects.matchreturnscandidateswhen it has no single answer (possibleProjectsinprojectMatch.ts), and the port'sprojectCandidates.feat(threads): the core.createOnComputerinappTools/thread.ts: argument checks and the per-run cap.createRemoteThreadAsAgent,remoteProjectFor,remoteThreadResultandnoteRemoteLaunchinOrchestratorService.ts: the local checks, the project, the receipt and row, the result.RemoteThreadLaunches.ts: the launch state machine and its passes.remoteLaunches.tsand migration 21.The risk is in
RemoteThreadLaunches.advance: which failure ends a launch, which keeps the thread, and which leaves it for the next pass. A failure onorchestrator.sendnever abandons the thread. A transient failure before the thread exists leaves the launchstarting. A refusal for good before setup is done abandons it and archives what was made.test(threads), thendocs.Verification
Tier 5 (daemon protocol, persistence and a migration, permissions across computers). Tested commit:
d26e30c810a3cec2783ef3137d6be3a8ae271ad8(tests ran on0959c7a65, the same tree before its commit emails were rewritten for the push), onorigin/masteraeb4b30e1.npx vitest run tests/net/bridge/routed/threadCreateRemote.test.ts: two real daemons over Bridge, with only the owner's turn stood in for. The agent callsthread_createthrough the app-tool registry over the caller orchestrator's real host. It checks:startedFrom.agent, has nocreatedByThreadId, and is held to the launcher's Auto narrowed to the device limit (Auto-accept edits);mcp,sentByAgent, the sender inagent.fromand the narrowed mode;agent_daily_budget) returns the thread withfirstMessage: "failed", and a retry makes no second thread;threads.create(composer.optionsfails offline) returns the thread withfirstMessage: "uncertain". A newRemoteThreadLaunches, reading only the run database as after a restart, finishes it on the same thread and sends the message once. The agent's retry then readssent;none);threads.createadvertised one version below the mark, givingcomputer_outdated;projectIdchoosing one;notifywithcomputer.tests/net/bridge/routed/remoteSubagents.test.ts,tests/run/remoteSubagents.test.tsandtests/run/remoteSubagentEngine.test.ts: remote subagents through the shared sequence, unchanged.tests/net/bridge/hub/matchProject.test.ts: two clones that cannot be told apart now come back as weak candidates instead of an empty answer. This test asserted the old empty answer and is updated for the new one.agentMark,threadCreateTools,threadCreateDaemon,contractVersions(run database 21),mergedLists,ids,table,agentAccessSettings,projectAgentInstructions,renderer/agentLaunchedThread. All 15 files together: 184 tests passed.threadCreateDaemon.test.tsalone: 29 passed. In an earlier run beside a typecheck, four of its cases failed with errors I did not keep; they did not come back alone or in the full run. They share the fixture's fixed 10-second wait, so a timeout under load is the likely cause.npm run typecheck: clean.Notes
projects.matchnow listscandidateswhen it has no single answer, so a refusal can name the checkouts. An older computer names none and the refusal says so without them.thread_createwith bothcomputerandnotifyis refused until the settle notice (feat(threads): an agent that asks with notify is told when the other thread settles #1232) can follow a thread on another computer.remote_launches).Refs #1160
🤖 Generated with Claude Code