Repository navigation
Keep secret requests alive through bb connect and in place in the timeline - #4321
Merged
SawyerHood merged 1 commit intoSep 25, 2026
Merged
Conversation
…eline The plugin CLI route returned nothing until the command finished, so a `bb secret request` from a thread whose CLI reaches the server through bb connect hit the gate's 30s response-head timeout and failed with HTTP 504 while its form stayed open. Commands still running after 10s now get their headers immediately and a newline keepalive every 10s before the JSON result, which older CLIs still parse. Plugin forms are thread-scoped interaction events, so the timeline sorted them after the whole running turn, where an active group of form rows is labelled "Working". Thread-scoped interaction lifecycles now join the turn that was running when they were requested. Co-Authored-By: Claude Opus 5.5 <[email protected]>
SawyerHood
deleted the
bb/fix-api-key-request-loop-in-bb-thr_ukpvnn9rqt
branch
September 25, 2026 03:29
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
Two bugs, both hit by
bb secret requestfrom a Codex thread whose CLI reaches the server through bb connect.POST /api/v1/plugins/:id/clisent nothing until the plugin command returned.bb secret requestwaits onbb.ui.requestInputuntil the user submits, so the connect gate's 30s response-head timeout (RESP_HEAD_TIMEOUT_MSinapps/connect/src/tunnel-do.ts) returned a 504. The gate does not cancel the upstream request, so the form stayed open after the command had already failed, and the agent requested the key again. Keep interactive plugin tools past the Connect timeout #1084 fixed the same problem for the daemon's plugin tool-call route but not for the CLI route.turnId: nullon purpose, so they never block sends. Theirsystem/interaction/lifecycleevents are therefore thread-scoped, andgroupEventProjectionTurnssorted them as standalone entries after the whole running turn. The resolved form rows stayed at the bottom of the timeline. While the thread is active, the last row group counts as active, and a group of only form rows has no summary phrase, so the timeline showed a "Working" row that never went away.What changed
apps/server/src/routes/plugins.ts:pluginCliResponsereturns the plain JSON result when a command finishes within 10s, the same as before. Otherwise it sends headers immediately, then a\nkeepalive every 10s, then the JSON result. The response is markedno-store, no-transform, so neither compression middleware buffers it. JSON allows leading whitespace, so existing CLIs parse the result unchanged. A client disconnect still abortsctx.signal. The daemon wire is unchanged, so there is noHOST_DAEMON_PROTOCOL_VERSIONbump.packages/thread-view/src/group-event-projection-turns.ts: thread-scoped permission-grant, user-question, and plugin-form lifecycle messages now join the turn that was running at their first sequence. Messages requested between turns stay standalone. The fix applies to stored events, so existing threads render correctly.Not changed: the connect gate still does not tell the tunnel client when it gives up on a request after 30s. That needs a
bb-connectdeploy.How you verified
packages/thread-view/test/build-thread-timeline.test.tscovers in-turn placement (fails before the fix, passes after) and standalone placement between turns.apps/server/test/routes/plugin-cli-response.test.tscovers the fast JSON path, keepalive before a slow result, a rejected command reported as exit 1 after streaming began, and client cancel.pnpm exec turbo run typecheck test --filter=@bb/thread-view(415/415) andpnpm exec turbo run typecheck --filter=@bb/server, plus the servertest/routes,test/services/plugins,test/threads, andtest/publicsuites..env.e2ewritten with mode 600, and the form row directly under its command inside the turn, including after a reload.🤖 Generated with Claude Code