Repository navigation
Allow Codex voice requests to use the transcription budget - #5020
Merged
Merged
Conversation
Both Connect HTTP paths (worker-held relay and TunnelDO proxy) gave every request a fixed 30-second response-head deadline, armed before upload. Core answers the voice route only after transcription finishes, so any remote transcription over ~30 s returned a gateway 504 even though core allows 70 s. Use 90 s for core's POST /api/v1/system/voice-transcription (70 s core budget plus upload headroom); all other requests keep 30 s. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
🚨 SLOP COP 🚨 ·
new-issue-autopilotHuman comments
What was wrong
Two deadlines below core's 70-second voice budget cut off long transcriptions:
Codex request timed out after 10000ms.apps/connect/src/relay.ts, and the TunnelDO proxy,apps/connect/src/tunnel-do.ts) give every request a fixed 30-second response-header deadline, armed before the request body uploads. Core sends the voice route's response headers only after transcription finishes, so any remote transcription taking more than about 30 s, including upload, returned504 bb connect: timed out waiting for the tunnel client. That happened even with core and the provider allowing longer. Raising the Codex budget alone would still leave remote users capped at 30 s.Reproduction and root-cause report for the Codex deadline: https://get-bb.github.io/reports/issues/5016.html
What changed
TRANSCRIBE_TIMEOUT_MS)+ HOST_CALL_GRACE_MS)AI_TASK_TIMEOUT_MS.voice, per service)POST /api/v1/system/voice-transcriptionThe 90-second Connect budget is core's 70 s plus 20 s for uploading the recording. The timer still starts before upload (#4832), and core accepts up to 25 MB. Each deadline sits above the one it wraps: 65 < 66 < 70 < 90. The new
apps/connect/src/response-head-timeout.tsis shared by both Connect paths, so they can't drift apart.No change to the server/daemon or tunnel wire protocol, schemas, stored data, credentials, or headers. Only the gateway's own timer changes.
How you verified
Unit regressions, failing before and passing after. In
relay.test.ts(worker relay) andworker.test.ts(TunnelDO proxy): a voice response head at 85 s now relays a 200 transcript, and no head by 90 s still returns 504 and closes the relay. On the previous head, all 4 failed because the gateway settled with a 504 at 30 s. Controls: a GET of the voice path, a port share at the voice path, and another upload keep the 30 s deadline. The Codex regression (endpoint answering at 64 s through the real service and host client) failed withCodex request timed out after 10000msbefore the fix.End to end through a local Connect gateway.
wrangler dev --localran the real Connect worker and TunnelDO with a throwaway local D1 and synthetic credentials. The real@bb/tunnel-clientTunnelSessiondialed it, an origin stood in for the voice route, and visitors authenticated with a machine credential. All 5 cases ran concurrently:pnpm exec turbo run test typecheck lint --filter=@bb/connect --filter=bb-plugin-provider-codexpasses: Connect 8 files and 200+ tests, provider-codex 33 files.Limits. This does not fix #5016's separate report that a 19-minute recording comes back truncated after about 10 minutes of text with no error. That is transcription completeness, not a deadline. Nothing ran against a live provider or the production gateway. In local workerd, a visitor that disconnects before the response head does not cancel the origin request in either version; before, the gateway's 30 s timer ended it, and now core's own 70 s per-service budget bounds it. In automatic mode with several ready voice services, core's budget applies to each service in turn, so a fallback chain can still exceed 90 s through Connect.
Fixes #5016