Repository navigation
fix(agents): cross-machine launches always deliver their first message - #257
Merged
Merged
Conversation
t3_create_and_start_thread sent its opening message through the relaying app's sendMessage, which first read a full shell snapshot of the target environment under a 20s timeout only to copy the thread's model and modes. On a large environment that read timed out after the chat was created, so the message was dropped and every retry hit the same read. sendMessage now dispatches straight away and the server applies the thread's own model and modes. Gateway launches also say they came from an agent over MCP instead of being stamped user/web. t3_thread_launch with a profileId and no caller thread (a linked environment or a client) fell back to the project's default model and failed when there was none, although the agent supplies its own. The agent's model now comes before the project default. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Thread transfer impact✅ Thread transfer remains within every enforced ceiling.
Other scenariosAll 64 scenario measurements match All 64 scenario measurements
Baseline: Scenario and decoded snapshot size10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed. |
jayleaton
marked this pull request as ready for review
November 16, 2026 06:10
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.
An agent on one machine launching a chat on another (
t3_create_and_start_thread) could create the chat and drop its opening message, andt3_thread_launchwith an agentprofileIdfailed on a project with no default model. Seen on Studio-01 on 2026-11-16 at about 05:50Z.Summary
Root causes
launchThreadcommitted in 19 ms (05:50:16Z). The relaying app'ssendMessagethen had to fetch a shell snapshot of all 1,858 chats under a 20sEffect.timeout, and that read never reached Studio before the deadline. The call returnedpartialwith "Operation timed out after '20s'". A retry with the same key ran the same snapshot read and returned the samepartial. With the read removed, the send is a single idempotent dispatch, and a retry replays it with the recorded command id.launchThreadhandler hard-codedcreatedBy:"user", and the gateway port leftcreationSourceunset, so it defaulted toweb. Every gateway-launched child on Studio hasuser/web. The launch input now carries an optionalcreatedBy(user|agent). The parent link was already stored correctly (parentThreadIdplusparentEnvironmentId).t3_thread_readfrom a non-linked caller hides a parent on another machine by design, which is why it showednull.Not changed:
t3_get_pending_questionstiming out against the MacBook comes from the same 20s shell-snapshot read through the relaying app. That tool lists chats, so it needs the snapshot and can't just skip it. Making relayed shell reads faster is separate work.Evidence
Each fix's test fails on
f274490be1and passes on this branch:packages/client-runtime/src/gateway/runtimePort.test.ts"routes V2 reads and message commands…" (extended)AssertionError: expected 3 to be 2:sendMessageread the shell snapshot.createdBy:"agent"andcreationSource:"mcp".apps/server/src/mcp/toolkits/project/handlers.test.ts"a client launches an agent on its own model when the project has no default" (new)OrchestratorMcpFailure: Pass modelSelection: the project has no default model…. This is the error from the report.vp run check:changed: format, lint, knip, typecheck (37 packages) and tests (8 files) all pass.Not tested end to end: a real two-machine relay was not reproduced in dev.
Merge Danger
Door: two-way. The new
createdBylaunch field is optional, and older servers ignore it.Blast Radius: agents. This covers the gateway relay's
sendMessageandcreateThread,startThreadTurn(its mode inputs are now optional, and a bootstrap launch falls back to the thread's), and caller-lesst3_thread_launchwith aprofileId.Opus 5.5 via Claude Code (Ada)
🤖 Generated with Claude Code