Skip to content

Show cached Account Pooler usage while status loads - #3440

Merged
SawyerHood merged 1 commit into
mainfrom
bb/it-always-takes-the-account-pooler-a-while-to-sh-thr_xrwdxb2gcd
Sep 10, 2026
Merged

SawyerHood merged 1 commit into
mainfrom
bb/it-always-takes-the-account-pooler-a-while-to-sh-thr_xrwdxb2gcd

Conversation

@SawyerHood

Copy link
Copy Markdown
Collaborator

Human comments

What was wrong

Opening Account Pooler settings sat on "Loading…" for a long time. The status.get RPC assembled routedThreadsWithoutLocalLogin, which calls system.providerStates over host RPC for every machine that routed a thread in the last window. A sleeping or offline machine stalls that call up to the host RPC deadline, and the UI rendered nothing until the whole status returned. Every action afterward (toggle, refresh usage, reorder) re-ran the same slow status call.

What changed

  • plugins/account-pool/src/operations.ts, rpc.ts, contracts.ts: status.get no longer waits on host RPCs. The routed-thread inspection is its own status.routedThreads RPC. statusSchema drops routedThreadsWithoutLocalLogin; a new statusReportSchema / PoolStatusReport keeps the combined shape.
  • plugins/account-pool/src/cli.ts: bb pool status calls both operations and prints the same text and --json output as before.
  • plugins/account-pool/app.tsx: the settings view caches the last PoolStatus in localStorage (validated with statusSchema on read) and renders it immediately. While the live status is in flight the hub line shows "refreshing…", rows show "refreshing usage…", and quota values are dimmed. A row also shows the refreshing state while its manual "Refresh usage" RPC is pending. The empty-state card only renders from live status so a stale cache never flashes "No accounts in the pool".

No wire changes to the host daemon protocol; this is plugin-internal RPC.

How you verified

  • New tests in plugins/account-pool/app.test.tsx: cached accounts render with the refreshing indicator before status.get resolves and the cache is rewritten afterward; a malformed cache entry falls back to the loading state; a row shows "refreshing usage…" while account.refreshUsage is pending. The first and third fail on main (no cache, no indicator).
  • plugins/account-pool/src/server.test.ts updated to read routed threads from status.routedThreads and parse CLI JSON with statusReportSchema.
  • pnpm exec turbo run test typecheck --filter=bb-plugin-account-pool passes (10 files, 274 tests).
  • Bundled the plugin app once through buildPluginApp to confirm the runtime statusSchema import bundles cleanly.

🤖 Generated with Claude Code

AGENT GENERATED

The settings RPC asked every recently routed machine for its provider
state over host RPC, so one sleeping laptop held the whole settings
page on "Loading…". Move that lookup to its own status.routedThreads
RPC, keep the CLI report shape by merging both calls, and cache the
last status in localStorage so rows render immediately with a
refreshing indicator until live values arrive. Rows also show a
refreshing state while a manual usage refresh is in flight.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@SawyerHood
SawyerHood merged commit 2efc051 into main Sep 10, 2026
16 checks passed
@SawyerHood
SawyerHood deleted the bb/it-always-takes-the-account-pooler-a-while-to-sh-thr_xrwdxb2gcd branch September 10, 2026 21:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant