Repository navigation
fix(server): run endings no longer wait on a remote parent's relay - #127
Merged
Merged
Conversation
The orchestrator's run.updated handler asked a connected app how a remote parent card settled (up to 60 s per hop, 16 hops) before moving on. That handler runs serially and also starts every thread's next queued run, so a slow or missing relay stalled queued runs and completions everywhere. RemoteParentSettlement is now a reactor beside the orchestrator: it watches run endings, asks the other environment in its own fiber per sub-run, and sends back thread.sub-run.settle. The orchestrator never awaits a relay. Relay calls the server makes for itself now go through one typed client, McpGatewayBroker.call, whose argument and answer schemas live in packages/contracts. RemoteSettlementCascade, ThreadTaskTransport and remoteThreads use those schemas instead of their own, and remoteThreads no longer runs Effect.runPromise inside an Effect. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Thread transfer impact✅ Thread transfer remains within every enforced ceiling.
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. |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Summary
The orchestrator's
run.updatedhandler runs serially and also starts every thread's next queued run. It used to ask a connected app how a remote parent card settled. That call can take 60 s per hop, up to 16 hops, so a slow or missing relay stalled queued runs and completions on every thread.Relay calls the server makes for itself now go through one typed client,
McpGatewayBroker.call(method, args). The argument and answer schemas live inpackages/contracts(McpGatewayRelayCalls), so an app that answers in another shape fails at the broker instead of in the caller.RemoteSettlementCascade,ThreadTaskTransportandremoteThreadsnow use those schemas instead of their own. The gateway tool catalog's pass-through is renamedforwardand typed bykeyof GatewayRuntimePort.remoteThreadsnow runs relay calls with its own services instead of callingEffect.runPromiseinside an Effect.Evidence
Scenario: a sub-run under a remote card ends while that card's app never answers. Then an unrelated thread finishes its active run with a follow-up queued behind it.
origin/main5c5b58a, same scenario with aRemoteParentSettlementstub that never returns):× PROOF main: a relay that never answers holds up no other thread's run endings — Test timed out in 20000ms. The queued run never starts.✓ a relay that never answers holds up no other thread's run endings. The queued run starts, and the stalled sub-run stays unsettled.vp run check:changed: lint, knip, typecheck (30 packages) and tests (11 files, 143 tests) pass. Format was fixed after that run.Merge Danger
Door: two-way. No migration, and the wire protocol is unchanged (still
{method, args}), so older apps and servers interoperate.Blast Radius: server
Opus 5.5 · Claude Code (T3 Code)
🤖 Generated with Claude Code