Skip to content

feat(tui): sort the account list by when a quota window resets - #496

Merged
MagicalTux merged 2 commits into
KarpelesLab:masterfrom
rikbrown:feat/account-sort-by-reset
Oct 3, 2026
Merged

MagicalTux merged 2 commits into
KarpelesLab:masterfrom
rikbrown:feat/account-sort-by-reset

Conversation

@rikbrown

Copy link
Copy Markdown
Contributor

The TUI draws the account list in the arranged order (displayOrder). On a big fleet, the account whose quota expires first can be anywhere in that list. So it is hard to see which quota to spend before it is lost.

This adds a display-only accountSort setting, cycled from the settings screen (g → Sort accounts):

  • arranged (the default): the list is drawn as before.
  • session-reset, weekly-reset, sonnet-reset, fable-reset: inside each provider group, the account whose window (five-hour, weekly, S7, F7) resets soonest is first.

How the sort works:

  • S7 and F7 read the all-models weekly on an account that has no Sonnet or Fable bucket of its own. This is the rule that accountBuckets in quota-summary.js uses for a family's window.
  • An account with no reading for the window, or whose reset has passed, is listed last. The arranged order breaks ties.
  • Provider groups and locally-served accounts keep their places.
  • The reorder screen always shows and edits the arranged order. _arrangeable() asks for the arranged order explicitly, so a move cannot write a sorted order into displayOrder.
  • Routing does not change. (expiryRouting is the routing-side preference for the soonest weekly reset.)
  • teamclaude attach reads the setting from its own config file.

Tests: test/tui-account-sort.test.js adds 14 tests: each sort, the S7/F7 fallback, ties, provider groups, the reorder screen, and the settings row (cycle, save, revert on a failed save). Each expected order is different from both the array order and the weekly order, so a sort that reads the wrong window fails. The full suite passes (2596 tests), lint and typecheck are clean, and the strict-mode count does not change (1703).

🤖 Generated with Claude Code

rikbrown and others added 2 commits September 30, 2026 10:45
A new `accountSort` setting, cycled from the settings screen (g → Sort
accounts): "arranged" (the default), or the soonest reset of one window —
"session-reset" (five-hour), "weekly-reset", "sonnet-reset" (S7) or
"fable-reset" (F7). A reset sort puts the account whose window ends soonest
first inside each provider group, so quota that is about to expire unspent is
at the top of the list. S7 and F7 read the all-models weekly on an account
without that family's own bucket, as quota-summary.js does. Accounts with no
reading for the window, or whose reset has passed, list last; the arranged
order breaks ties.

Display only. The reorder screen still shows and edits the arrangement, and
a move never writes a sorted order into displayOrder.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@MagicalTux
MagicalTux merged commit 3c2a3f5 into KarpelesLab:master Oct 3, 2026
8 of 10 checks passed
@MagicalTux MagicalTux mentioned this pull request Oct 4, 2026
MagicalTux added a commit that referenced this pull request Oct 4, 2026
Fifteen commits since 1.1.22. Two change what an existing install does
without an opt-in (#514, #503); the rest is additive or display.

Behaviour changes
  #514 the TUI quota-bar percentage (`quotaBarPercent`) is off unless set:
       a bar carries its countdown, and its fill is the percentage. The
       switch (g → Bar percentage) is unchanged; a config without the key
       now reads as off
  #503 with Codex accounts in the pool, a request on the intercepted
       chatgpt.com that is not Codex inference (codex-cli 0.156's workspace
       discovery, plugin, MCP and settings calls) is passed through to
       chatgpt.com with the client's own login instead of reaching the
       Anthropic pool and a 404; the Codex Responses WebSocket is refused
       (501) so the CLI falls back to HTTPS, where the pool serves it (#492)
  #502 `login --api` adds a key at priority 100, a last resort behind the
       subscriptions, with `--priority <n>` to place it; existing entries
       are untouched (#497)

Fixes
  #498 artifacts (`/api/frame/*`) are relayed with the client's own
       credential, so publishing and reading them works behind a rotated pool
  #499 the Remote Control bridge (`/v1/environments/*`, `/v1/sessions/*`,
       `/v2/session_ingress/*`, `/v2/ccr-sessions/*`), which Claude Code
       2.1.287 sends through HTTPS_PROXY, is relayed with the client's own
       credential; registration no longer lands in a rotated account's org
  #488 keep-warm works on Windows: the warm-up client is spawned through a
       shell, so npm's `claude.cmd` shim is found
  #489 Node 24.6's undefined HTTP/2 keep-alive buffer no longer crashes the
       MITM tunnel with a NaN timeout
  #490 on a very wide terminal the two provider panes sit together and their
       bars grow to the list's cap instead of padding half the screen

Features
  #496 `accountSort` orders the TUI account list by the soonest reset of a
       window (session, weekly, S7, F7) inside each provider group; cycled
       from the settings screen, display only
  #494 a z.ai GLM Coding Plan backend account shows its 5-hour and weekly
       windows in `teamclaude status`
  #495 a NanoGPT backend account shows its daily and weekly windows and
       NanoGPT's own billing advice (`billing balance`, `balance not allowed`)
  #500 each dashboard account card lists the models the account served in
       the last 15 minutes

Docs
  #505 what a cross-organization switch costs a Sonnet 5.5 conversation:
       the API drops the earlier thinking blocks silently; same-org pools are
       unaffected (#491)

Tests
  #501 #504 two tests that raced the wall clock or a shared port now assert
       the mechanism, and the last private server-spawn harness is gone

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
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.

2 participants