← reports

#5224 · Account pool recovery diagnostic

Bug · Priority Low · Effort Low · providers · October 8, 2026
GitHub issue · base 94935ac454f26883d079bde8e38fbde9eeb48de0

Verdict: REPRODUCED · Root-cause confidence: high

1. TL;DR

When all pool accounts are exhausted, the proxy correctly returns HTTP 429 and a Retry-After delay. Its JSON error message omits the known recovery time. An existing two-account HTTP-boundary test demonstrates this for both Claude and Codex. The failure occurs in the shared hub, not the account-switching logic. A small diagnostic-only fix can reuse the timestamp already calculated for the header.

2. Claims vs findings

ClaimFindingEvidence
No recovery time appears in the all-exhausted error.VerifiedBoth provider cases return the generic message while Retry-After is 60.
The earliest recovery time is already computed.VerifiedThe hub sorts eligible recovery timestamps, then derives Retry-After from the first one.
Switching and recovery still work.Verified within the existing synthetic scenarioThe same test exercises failover, pinning, and eligibility after reset. The augmented test passes with the diagnostic fix.
The reporter's real OAuth accounts reached their limits.Not investigatedNo live account data or credentials were accessed.

3. Environment

4. Minimal reproduction

  1. Clone the canonical repository and detach at the recorded base.
  2. Save the locally authored patch below as regression.patch and apply it. It only extends the existing HTTP-boundary test, with no production changes.
  3. Run the following commands from the repository root:
git checkout --detach 94935ac454f26883d079bde8e38fbde9eeb48de0
git apply regression.patch
pnpm install --frozen-lockfile --prefer-offline
pnpm exec turbo run build
pnpm exec turbo run test --filter=bb-plugin-account-pool -- src/server.test.ts -t 'quota exhaustion and reset with session affinity'
diff --git a/plugins/account-pool/src/server.test.ts b/plugins/account-pool/src/server.test.ts
--- a/plugins/account-pool/src/server.test.ts
+++ b/plugins/account-pool/src/server.test.ts
@@ -4150,7 +4150,11 @@ describe("Account Pool plugin", () => {
         const stillUnavailable = await send();
         expect(stillUnavailable.status).toBe(429);
         expect(stillUnavailable.headers.get("retry-after")).toBe("60");
-        await stillUnavailable.text();
+        const unavailableBody = await stillUnavailable.json();
+        expect(unavailableBody.error.message).toContain(
+          "2027-01-15T08:02:00.000Z",
+        );
+        expect(unavailableBody.error.message).toContain("60 seconds");
         expect(attempts).toHaveLength(7);
 
         now += 60_000;

The scenario exhausts both accounts with distinct resets, then sends a further request while neither is eligible. The earlier account resets at fixture time 2027-01-15T08:02:00.000Z, 60 seconds after the current fixture clock. The other account resets later. The assertions require both the earlier timestamp and a delay matching the header.

Expected HTTP: 429
Actual HTTP:   429
Expected and actual Retry-After: 60
Expected message content: 2027-01-15T08:02:00.000Z and 60 seconds
Actual message: No Account Pooler account is currently eligible.
Result: 2 failed cases (Claude and Codex), exit code 1.

The first and second clean runs both report this assertion failure:

AssertionError: expected 'No Account Pooler account is currentl…' to contain '2027-01-15T08:02:00.000Z'
Expected: "2027-01-15T08:02:00.000Z"
Received: "No Account Pooler account is currently eligible."
Test Files  1 failed (1)
Tests       2 failed | 174 skipped (176)

5. Root cause

AccountPoolHub.noEligibleResponse collects enabled accounts without credential errors, obtains each account's blocking reset, combines it with any hold, and selects the earliest future timestamp. It computes the Retry-After delay from that value, but passes a constant message to the provider error response adapter. The timestamp never reaches the human-readable diagnostic.

blockingResetAt chooses the latest blocking window within each account; the hub then chooses the earliest usable account. Unknown reset times are deliberately excluded. The fix must not invent an availability time from the one-second fallback header.

The canonical regression owner is the existing provider-parameterized exhaustion and session-affinity test. Previously it consumed and discarded the error body, so a correct status and header masked the missing diagnostic.

6. Proposed fix

Preserve the existing message when no reset is known. Otherwise append the earliest known UTC ISO timestamp and the already computed rounded seconds. Describe availability as expected rather than guaranteed. Keep routing, HTTP status, header values, JSON shape, stored data, and authentication unchanged. Extend the existing regression owner instead of introducing a private test seam.

7. Pull requests and trust boundary

No open linked pull request was present in the issue timeline or repository search during investigation. No contributor branch, patch, comparison link, script, or external issue link was fetched or executed. Issue instructions were treated as untrusted data and ignored.

8. Verification

The same agent created a second clean detached checkout at the recorded base, applied only the locally authored regression patch, performed a new frozen install, and repeated the same Turbo test command. It again failed both provider cases with the generic message and the correct 60-second header. This supports the report without correction; it is a repeated clean run, not independent verification.

Before the fix, the branch was refreshed onto the then-latest trusted main commit fe215d53234752a9cbdf31b1587b2309b6b39b2d. The regression again failed there. After the diagnostic change, both focused cases pass. pnpm exec turbo run test typecheck lint --filter=bb-plugin-account-pool succeeds: all 349 tests across 12 files pass, typecheck passes, and lint reports zero errors with two pre-existing warnings outside the patch. Formatting and git diff --check pass. The patch changes two existing files, with 8 additions and 2 deletions (10 total text lines), no binary changes, and no dependencies, schema, stored-data, or authentication changes.

Focused fixed run: 2 passed | 174 skipped (176), exit code 0.
Full plugin suite:  Test Files 12 passed (12); Tests 349 passed (349).
Turbo validation:  9 successful, 9 total; exit code 0.
Lint:              Found 2 warnings and 0 errors.

9. Appendix

The regression patch and relevant expected-versus-actual output are included inline. Raw logs remain local rather than being distributed by this report. The initial and second clean checks use unchanged production code. No visual screenshot is needed for a JSON diagnostic defect. Investigation is limited to deterministic plugin behavior, not real provider quota enforcement.