Repository navigation
Stop bb cloud titles timing out on a hung model - #5024
Merged
Merged
Conversation
About 5% of prompts long enough to title ended up untitled. Every
failure was latency: the bb cloud gateway gives up after 4s ("the
model did not answer in time"), or a service hits the 5s client
budget. There was one attempt, so a single slow answer left the
thread with its raw-prompt fallback for good.
When the first attempt times out or fails, make one more attempt in
the background with a 15s budget. Managed-worktree provisioning still
waits only for the first attempt. The retry skips threads that already
have a title, and a title set while the retry runs is kept. Both
provisioning paths now share one apply-and-rename step, so a late title
also reaches the provider session.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Mercury 2.5 returned 200 and then never finished the body on 14 of 50 direct OpenRouter calls. With the gateway's exact request, OpenRouter waited about 10.6s on those calls before falling back. The gateway times out at 4s, so 3 of 25 requests failed as "the model did not answer in time". Gemini 2.5 Flash-Lite answered all 50 calls, with p90 690ms and max 1.2s. Mercury becomes the fallback because its titles are the best when it answers. Nemotron is dropped because it made up titles for URL-only prompts. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…g them" This reverts commit 7beed86.
The gateway sent all models to OpenRouter as one request with a fallback list. OpenRouter falls back only on errors, so when the primary model hung, it waited about 10s, well past the gateway's 4s limit. The title then failed even though the fallback answers in under a second. Completions now use the same per-model loop as transcription. Each model is requested alone, with its own 2s limit. Two models take the same 4s as the old single attempt, which stays within the 5s bb waits. A timeout now logs the model that hung instead of null. 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.
Human comments
What was wrong
About 5% of prompts long enough to title never got a generated title. In the last 30 days on one server, 401 runs were titled, 13 failed and 5 timed out. Every failure was bb cloud's gateway timing out. The gateway sent
AI_MODELSto OpenRouter as one request with a fallback list (modelplusmodels). The primary,inception/mercury-2.5, returned 200 and then never finished the body on 14 of 50 direct calls. OpenRouter falls back only on errors, not slowness, so with the gateway's exact request it waited about 10.6s on a hung Mercury call before switching to Gemini. The gateway gives up at 4s, so 3 of 25 requests failed as "the model did not answer in time".Latency probe (25 calls per configuration, gateway request shape, real title prompt; times in ms):
The privacy settings (
zdr/data_collection: deny) andreasoning: nonemade no difference.What changed
The gateway changes require deployment; the outer timeout changes also require the updated bb server and bb cloud plugin. Slow requests can now wait longer during title generation and managed-worktree provisioning.
How you verified
pnpm exec turbo run test --filter=@bb/ai-gateway --filter=bb-plugin-bb-ai: 35 gateway tests and 24 plugin tests passed. Coverage includes a hanging primary model followed by a successful fallback with a fresh signal, billing, timeout logging, and the plugin's 7-second request timeout.pnpm exec turbo run test --filter=@bb/server -- test/ai/ai-tasks.test.ts: 14 tests passed.pnpm exec turbo run lint typecheck --filter=@bb/ai-gateway --filter=bb-plugin-bb-ai --filter=@bb/server: passed all available tasks.git diff --checkpassed.