fix: retry read-only host RPC timeouts - #2369
Merged
Merged
Conversation
ymichael
force-pushed
the
fix/retry-timeout-host-rpcs
branch
from
August 25, 2026 18:45
718e78e to
3c8532b
Compare
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.
Context
Thread provisioning intermittently failed with
thread_provisioning_failedafter waiting the full 30-second host RPC timeout for a retryable inspection command. The daemon connection remained usable, so repeating the inspection was safer and more useful than failing the whole provisioning attempt.This is transport resilience, not an OpenRouter/quota change.
What changed
callHostRetryableOnlineRpc.HOST_DAEMON_PROTOCOL_VERSIONto 167 because the server can now send a secondhost-rpc.requestafter a response timeout.Safety boundary
A timeout is ambiguous: the host may have executed the first request and lost only its response. Retrying can therefore execute the command twice. The retry helper accepts only
HostDaemonRetryableOnlineRpcCommand, derived from command-registry entries explicitly markedretryable: true; commands not explicitly safe to repeat cannot enter this path through the typed API.Each attempt uses a fresh request ID. The first waiter's timeout removes it from the hub, so a late response from the first attempt is treated as stale and cannot resolve the second attempt. Tests also keep the existing reconnect retry and ordinary-call single-attempt behavior covered.
Verification
pnpm exec turbo run test --filter=@bb/server -- test/hosts/online-rpc.test.ts test/system/execution-options.test.ts test/public/public-provider-installations.test.ts— 50/50 passedpnpm exec turbo run test --filter=@bb/host-daemon-contract -- test/contract.test.ts— 37/37 passedpnpm exec turbo run typecheck --filter=@bb/host-daemon-contract --filter=@bb/host-daemon --filter=@bb/server— 6/6 Turbo tasks successfulgit diff --check origin/main...HEAD— passedThe deterministic regression drops the first response while leaving the daemon socket registered. Before this change the call rejected with
504 command_timeout; after the change the second request succeeds inside the original command budget. Fake timers pin the attempt boundary, and the test verifies that the first late response is stale and the two requests have distinct IDs.