Skip to content

fix(claude): bound usage reset tracking, prevent statusline freeze/false resets, and scope account-switch ask toasts - #51603

Merged
nwparker merged 1 commit into
mainfrom
fix/release-scan-267delta-slice-c
Nov 28, 2026
Merged

nwparker merged 1 commit into
mainfrom
fix/release-scan-267delta-slice-c

Conversation

@nwparker

@nwparker nwparker commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes three 1.4.267 delta release-scan issues in Claude usage tracking, statusline ingestion, and account-switch restart toasts:

  • STA-16710: Bound ClaudeLiveUsageSessionReports reset-adoption (adoptedBy) sets to the 64-session LRU cap, remove evicted session IDs from adoptedBy, cap resetByWindow, and prune expired reset windows once resetsAt <= now.
  • STA-16732:
    • Replace !hasChanged(...) with isUnchanged(...) in RateLimitServiceFetchPolicy.ingestLiveClaudeRateLimits so unseen/new sessions and session_id-less statusline posts are not frozen for the remainder of a same-window reset while idle pre-reset sessions repeating their snapshot remain blocked.
    • Extract paneKey in readClaudeStatusLineRateLimits and key session reports by (paneKey, sessionId) so a single resumed conversation open in two panes cannot interleave into a fabricated quota reset.
  • STA-16722:
    • Attach an opaque askId and the exact ptyIds set to each host account-switch Ask (ClaudeHostRunningSessionsMove.askId, AskedClaudeMove), verify answersAskId in answeredClaudeMove, and restrict restart execution to the Ask's captured ptyIds.
    • Track per-owner Ask generations in claude-account-switch-sessions.ts and dismiss/replace prior Ask toasts by stable toast ID so an older restart toast cannot stop a different switch's sessions.

Performance

  • Memory bound (STA-16710): Eliminates unbounded growth of resetByWindow[*].adoptedBy and stale expired entries in resetByWindow across long-lived sessions (capped at 64 sessions / 64 reset windows, pruned on expiry and LRU eviction).
  • Runtime overhead: Negligible; O(1) map/set lookups with <=64-entry bounds on already-throttled (~15s) statusline posts and infrequent account switches.

Verification

  • pnpm check:changed: 42/42 checks passed (format, oxlint, typecheck, changed-code quality, unit tests including new invariant tests in claude-live-usage-session-reports.test.ts and claude-host-account-switch.test.ts, RPC params catalog, localization, and all ratchets).
Files Added Deleted Net
Test 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​179 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​179
Prod 10 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​294 $\color{#cf222e}{\Huge{\mathbf{−}}}$​104 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​190

…lse resets, and scope account-switch ask toasts (STA-16710, STA-16722, STA-16732)
@nwparker
nwparker merged commit d37173f into main Nov 28, 2026
58 of 59 checks passed
@nwparker
nwparker deleted the fix/release-scan-267delta-slice-c branch November 28, 2026 07:54
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