Skip to content

Account Pooler: 30-minute session pin is shorter than the 1-hour prompt cache #5262

Closed

Description

@amrtawfik160

Summary

The Account Pooler forgets which account a session used after 30 idle minutes (AFFINITY_IDLE_TTL_MS = 30 * 60 * 1_000, plugins/account-pool/src/hub.ts:57). Since #5130, pooled Claude Code threads use the 1-hour prompt cache. A prompt cache belongs to one account, so a thread that pauses for 30 to 60 minutes can be routed to another account and must write its whole context again, although its cache on the first account is still alive.

Why it matters

Orchestrating threads often wait 30 to 60 minutes on a child thread, a CI run or a person, and they carry large contexts. On one host with the pooler on (bb 0.45.0, so still before #5130), we measured 619 pauses of 5 to 60 minutes across Claude threads in two days; the median request was about 225,000 prompt tokens. With the 1-hour cache in place, every pause in the 30 to 60 minute range that lands on a different account still costs one full context write.

Expected

A session stays on its account for at least as long as its prompt cache can live (60 minutes for the 1-hour cache, plus a margin), unless that account is exhausted or removed.

Suggested change

Raise AFFINITY_IDLE_TTL_MS above the cache lifetime (for example 65 or 70 minutes), or derive it from the cache lifetime the pooled thread uses.

Notes

Activity

  1. added theissue type on Oct 9, 2026
  2. added
    providersCross-provider bridges, models, login
    confirmed-reproBug reproduced again from a clean trusted checkout; see linked report
    on Oct 9, 2026
  3. bb-slop-cop commented on Oct 9, 2026

    @bb-slop-cop
    Contributor

    🚨 SLOP COP 🚨 · new-issue-autopilot

    • Classification: Bug · Priority: Medium · Effort: Low. Labels: providers, provider-claude-code, confirmed-repro.
    • Report: https://get-bb.github.io/reports/issues/5262.html — REPRODUCED, root-cause confidence high.
    • Root cause: The 30-minute idle affinity TTL expires live and persisted session pins before the enabled one-hour Claude cache interval; a moved pool cursor can then select another account.
    • Verification: Four routing regressions fail on trusted main in two clean checkouts and pass after the fix. All 353 Account Pooler tests, typecheck, lint, formatting, and diff checks pass. Live cache billing was not measured.
    • Ready PR: Keep pooled affinity through the extended cache interval #5265 — raises retention to 65 minutes; 79 changed text lines across two files. Not merged.

    AGENT GENERATED

  4. self-assigned this
    on Oct 14, 2026
  5. removed their assignment
    on Oct 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmed-reproBug reproduced again from a clean trusted checkout; see linked reportprovider-claude-codeBuilt-in plugin: provider-claude-codeprovidersCross-provider bridges, models, login

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions