Repository navigation
Conversation
ymichael
force-pushed
the
m5/claude-auth-failure-immediate-eviction
branch
from
September 1, 2026 17:02
bb20a84 to
c512d7a
Compare
ymichael
changed the base branch from
main
to
bb/investigate-claude-provider-errors-thr_ejnqeazwcr
September 1, 2026 17:02
ymichael
force-pushed
the
bb/investigate-claude-provider-errors-thr_ejnqeazwcr
branch
from
September 1, 2026 19:57
78a5f91 to
f4bbd57
Compare
ymichael
force-pushed
the
m5/claude-auth-failure-immediate-eviction
branch
2 times, most recently
from
September 1, 2026 20:02
5f0335c to
003d7bc
Compare
ymichael
force-pushed
the
bb/investigate-claude-provider-errors-thr_ejnqeazwcr
branch
from
September 1, 2026 21:55
126b6a7 to
f41aff0
Compare
ymichael
force-pushed
the
m5/claude-auth-failure-immediate-eviction
branch
from
September 1, 2026 21:58
003d7bc to
0c3f684
Compare
ymichael
added a commit
that referenced
this pull request
Sep 1, 2026
## Human comments ## What was wrong The Claude provider represented a bb thread attachment and its resident Claude SDK query as one `ThreadSession`. That forced an idle query and Claude child process to remain alive until core released the entire attachment after 30 minutes; closing the combined object earlier also removed routing state, so the next `turn/start` failed with `No active session`. ## What changed - Split retained thread attachment state from the optional resident `SdkSession` and query. - Add the Claude provider setting `idleQueryReleaseEnabled`, defaulted off for the bake period. Changes apply on the next start, resume, or turn command. - When enabled, release newly started, restored, forked, and post-turn queries after a provider-owned 30-second quiescent grace period while preserving the attachment and provider thread id. - Lazily construct one replacement query on the next normal turn, resume the same Claude conversation, and preserve `session/replaced` → identity → `session.reset` ordering. - Coalesce simultaneous wakes with an attachment-local promise and invalidate stale idle callbacks with a residency generation. - Treat open turns, pending Claude-native background tasks and monitors, pending interactions, and forwarded tool calls as non-quiescent. Monitor tasks remain invisible in the timeline while protecting resident work. - Keep dormant live settings and permission grants available for reconstruction; `thread/stop` still deletes the attachment, allowing core's existing 30-minute cleanup to retire the bridge worker. - Reject invalid `thread/resume` requests before constructing a query. - Document the provider setting in the guide, configuration reference, and shipped bb CLI skill. Enable the bake with: ```sh bb plugin config provider-claude-code set idleQueryReleaseEnabled true ``` This is Claude-provider policy only. The option travels in the existing opaque provider-options bag and old host daemons already forward that bag, so the server/daemon wire contract and `HOST_DAEMON_PROTOCOL_VERSION` are unchanged. Immediate auth-failure eviction and credential-store startup serialization remain separate follow-up PRs (#2804 and #2807). ## How you verified The fake-clock regressions fail before the implementation and cover: - release remaining disabled by default; - a newly started or restored query receiving no turn; - post-turn idle release and lazy context-preserving wake; - disabling release on the next turn cancelling a scheduled eviction; - warm reuse inside the grace period; - provider-native background tasks and hidden monitor work blocking release; - monitor completion starting a fresh grace period; and - simultaneous turns creating exactly one replacement query. Commands run after rebasing onto current `origin/main`: - `CI=1 pnpm exec turbo run test typecheck --filter=bb-plugin-provider-claude-code --force` — 24 files, 349 tests passed; typecheck passed - `CI=1 pnpm exec turbo run test typecheck --filter=@bb/templates --force` — 43 tests passed; typecheck passed - `CI=1 pnpm exec turbo run test --filter=@bb/server --force -- test/skills/builtin-skills-copy.test.ts test/skills/shipped-skills-quality.test.ts` — 14 tests passed - `CI=1 pnpm exec turbo run test --filter=@bb/server --force -- test/threads/thread-runtime-config.test.ts` — 30 tests passed - `git diff --check origin/main...HEAD` Live dev CLI QA confirmed the setting schema reports `default: false`, setting it to `true` is reflected immediately, and unsetting it restores the effective value to `false`. > AGENT GENERATED
Base automatically changed from
bb/investigate-claude-provider-errors-thr_ejnqeazwcr
to
main
September 1, 2026 22:48
ymichael
force-pushed
the
m5/claude-auth-failure-immediate-eviction
branch
from
September 1, 2026 22:59
0c3f684 to
6120737
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.
Human comments
What was wrong
#2098 records
restartBeforeNextTurnReasonwhen Claude emits terminalauthentication_failedoroauth_org_not_allowederrors, but the bridge only consumed that marker from the nextturn/start. Even after the failed result settled, the stale SDK query therefore stayed resident with failed credentials until another user turn arrived.What changed
isThreadSessionQuiescentpath merged in Add opt-in idle Claude query release #2808; no duplicate pending-work counters or task predicates are added.providerThreadId; the next normal turn creates a fresh query, resumes that provider thread, emitssession/replaced, then emits thread identity andsession.resetin the established order.provider/recoverynotification withkind: "authRequired"andretryable: falsebefore closing the stale query.Auth-failure eviction is independent of #2808's
idleQueryReleaseEnabledsetting: terminally failed queries still close when ordinary idle release is left at its default-off value.This remains entirely within the Claude provider plugin. It does not add credential locking and makes no host-daemon wire, public Plugin API, CLI, configuration, or documentation change.
HOST_DAEMON_PROTOCOL_VERSIONis unchanged.How you verified
The focused bridge regression fails before the implementation because the stale query has zero
closecalls after the terminal failure result. It now covers both terminal authentication error codes, verifies failed-turn content and typed recovery are emitted before close, verifies eviction itself emits no replacement/reset, confirms the next turn resumes the same provider thread with replacement before reset, and checks exact-once close. A race test verifies eviction waits for both a pending user interaction and provider-native background task. These auth tests leave idle release disabled, covering the independence described above.After rebasing directly onto current
origin/main:pnpm exec turbo run test --filter=bb-plugin-provider-claude-code --force -- src/bridge/__tests__/bridge.test.ts— 83 tests passedpnpm exec turbo run test typecheck --filter=bb-plugin-provider-claude-code --force— 24 test files and 351 tests passed; typecheck passedgit diff --check origin/main...HEADBuilds on #2808. Related to #2097 and #2098.