Skip to content

Claude: compact multi-account menu (active card + headroom-sorted rows + collapsed tail) - #2542

Merged
steipete merged 1 commit into
mainfrom
claude/smart-multi-account-view-8b33ad
Aug 1, 2026
Merged

Claude: compact multi-account menu (active card + headroom-sorted rows + collapsed tail)#2542
steipete merged 1 commit into
mainfrom
claude/smart-multi-account-view-8b33ad

Conversation

@steipete

@steipete steipete commented Aug 1, 2026

Copy link
Copy Markdown
Owner

Summary

With many claude-swap accounts the Claude tab stacked one full three-bar card per account — six accounts meant ~18 progress bars and a popover taller than the screen, where five of the six cards carried no information ("100% left" everywhere).

This adds a compact multi-account layout that engages at 4+ accounts (below that, nothing changes):

  • The active account keeps its full card, pinned first.
  • Inactive accounts collapse to one-line rows sorted by remaining headroom (most constrained first). Headroom is the minimum % left across session/weekly/scoped windows; rows tint red ≤ 10% and amber ≤ 50%, with a short constraint summary ("Fable 0% · Weekly 43%").
  • The healthiest activatable account gets a ★ as the suggested next switch target.
  • The remaining healthy rows fold behind a single "N more accounts ready" summary row.
  • Click a compact row to expand it into the full card (with the usual "Switch Account…" action); click the summary row to reveal the hidden accounts. Expansion state resets when the menu closes.

Accounts with errors (expired token, etc.) show a warning glyph and sort with the constrained rows instead of hiding in the healthy tail. codexbar cards CLI output is unchanged.

Before / after

Before (6 accounts) After
Stacked cards before Compact layout after

Screenshots are rendered from synthetic fixture data by a new env-gated dev tool (MenuLayoutScreenshotRenderTests, skipped unless CODEXBAR_SCREENSHOT_DIR is set).

Implementation

  • AccountMenuLayoutPlanner (CodexBarCore): pure projection from [ProviderAccountUsageSnapshot] + expansion state to an ordered row plan — fully unit-tested, no UI dependencies.
  • MenuCardCompactAccountRowView / MenuCardCollapsedAccountsRowView: SwiftUI rows matching the existing card design language (MenuHighlightStyle, UsageMenuCardLayout), with height-cache fingerprints.
  • StatusItemController+ClaudeSwapMenu: plan-driven rendering path; the <4-account stacked path is preserved verbatim. Expansion toggles reuse advanceMenuInteraction + invalidateMenus(refreshOpenMenus:).
  • Personal info redaction applies to compact row labels; accessibility labels cover headroom, constraints, and error states.

Commands run

  • make check (SwiftFormat + SwiftLint clean)
  • make test (full sharded suite)
  • Focused: swift test --filter "AccountMenuLayoutPlannerTests|StatusMenuClaudeSwapCompactTests|MenuCardClaudeSwapAccountTests|ClaudeSwapMenuPrecedenceTests|ClaudeSwapAccountProjectionTests|CLICardsClaudeSwapTests"

🤖 Generated with Claude Code

@clawsweeper clawsweeper Bot added proof: sufficient Contributor real behavior proof is sufficient. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. P2 Normal priority bug or improvement with limited blast radius. merge-risk: 🚨 auth-provider 🚨 Merging this PR could break OAuth, tokens, provider routing, model choice, or credentials. labels Aug 1, 2026
@clawsweeper

clawsweeper Bot commented Aug 1, 2026

Copy link
Copy Markdown

Codex review: needs changes before merge. Reviewed August 1, 2026, 2:00 AM ET / 06:00 UTC.

ClawSweeper review

What this changes

The PR adds a compact Claude multi-account menu for four or more accounts, retaining the active account’s full usage card while rendering inactive accounts as headroom-ranked rows with a collapsible healthy tail.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

This PR is still necessary as a compact Claude multi-account menu improvement, but the amended patch still omits transient failed-switch errors from unexpanded compact rows. That can make an inactive account with a failed switch look healthy or leave it folded into the healthy tail; the narrow error-propagation repair should land before merge.

Priority: P2
Reviewed head: 6a57977983e2a4d2b1ee5bd6dc60960deba9fccc

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The proposed layout is well demonstrated and has substantial focused coverage, but a concrete error-state regression blocks merge readiness.
Proof confidence 🦞 diamond lobster (5/6) Not applicable: The author is the repository owner, so external-contributor proof gating does not apply; prepared before/after screenshots were nevertheless inspected and directly demonstrate the intended menu layout.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The author is the repository owner, so external-contributor proof gating does not apply; prepared before/after screenshots were nevertheless inspected and directly demonstrate the intended menu layout.
Evidence reviewed 4 items Compact rows omit effective switch errors: The compact-row branch passes the planner's snapshot-derived hasError, but the full-card branch separately computes the effective display error from the account error, adapter error, and the scoped transient switch error. An inactive failed switch therefore has no compact-row error signal.
Current behavior already scopes failed switches to an account: Current main derives full-card errors using lastErrorAccountID and lastError; the runtime test confirms failed activation remains scoped to the requested account. The new compact path must preserve that existing presentation contract.
Feature-history provenance: The Claude account-switching menu behavior dates to the merged Claude-swap feature, and later account-projection history includes relogin-status work; the compact rendering must not bypass that established error-display path.
Findings 1 actionable finding [P2] Preserve switch errors in compact account rows
Security None None.

How this fits together

CodexBar converts Claude account usage snapshots and account-switch state into its macOS menu-bar popover. The new layout planner selects full cards, compact rows, and a collapsed summary, while the menu controller supplies the display state and account-switch actions.

flowchart TD
  A[Claude account snapshots] --> B[Account layout planner]
  C[Account switch state] --> D[Menu controller]
  B --> D
  D --> E[Full account cards]
  D --> F[Compact account rows]
  E --> G[Claude menu popover]
  F --> G
  G --> H[Switch account action]
Loading

Before merge

  • Preserve switch errors in compact account rows (P2) - The full-card branch derives displayError from lastErrorAccountID and lastError, but this compact row receives only compactRow.hasError, which is based on the snapshot. An inactive account whose switch fails can therefore render healthy or be folded into the healthy tail until expanded. Thread the effective error into compact-row planning/rendering and add the four-account regression case.
  • Resolve merge risk (P1) - Merging the compact layout as written can suppress a Claude account-switch failure for inactive accounts whenever four or more accounts trigger compact mode, delaying a user-visible authentication or token recovery signal until expansion.
  • Complete next step (P2) - This is a narrow, source-proven regression in the PR’s new compact rendering path with a clear controller/planner repair and focused test boundary.

Findings

  • [P2] Preserve switch errors in compact account rows — Sources/CodexBar/StatusItemController+ClaudeSwapMenu.swift:50-58
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Patch scope 12 files affected; 1,083 additions and 19 deletions The feature spans a new planner, native menu views, controller wiring, tests, documentation, screenshots, and a release-note entry.
Compact-mode threshold 4+ accounts The regression is confined to the newly added path that replaces stacked cards at this threshold.

Merge-risk options

Maintainer options:

  1. Preserve failed-switch visibility (recommended)
    Pass the scoped effective switch error through compact-row planning and rendering, then add a four-or-more-account regression test for a failed inactive-account switch.
  2. Pause compact rendering
    Hold this new rendering path until inactive account-switch failures remain visible without requiring a user to expand a row.
Copy recommended automerge instruction
@clawsweeper automerge

Special instructions:
Preserve the existing full-card effective error semantics in compact rows, prevent errored rows from entering the healthy collapsed tail, and add a focused failed-inactive-switch regression test.

Technical review

Best possible solution:

Feed the existing effective per-account display error into compact-row classification and rendering, ensure errored rows cannot be treated as healthy-tail candidates, and cover the failed inactive-switch state with focused menu-model tests.

Do we have a high-confidence way to reproduce the issue?

Yes, by source inspection: populate at least four Claude account snapshots, set lastErrorAccountID and lastError for an inactive account, and render the compact menu. The compact row only receives the snapshot-derived error flag, while the existing full-card path incorporates that transient failure.

Is this the best way to solve the issue?

No. The compact path should reuse the existing effective error projection before it decides row severity and healthy-tail eligibility; that is narrower and preserves the established full-card behavior.

Full review comments:

  • [P2] Preserve switch errors in compact account rows — Sources/CodexBar/StatusItemController+ClaudeSwapMenu.swift:50-58
    The full-card branch derives displayError from lastErrorAccountID and lastError, but this compact row receives only compactRow.hasError, which is based on the snapshot. An inactive account whose switch fails can therefore render healthy or be folded into the healthy tail until expanded. Thread the effective error into compact-row planning/rendering and add the four-account regression case.
    Confidence: 0.98

Overall correctness: patch is incorrect
Overall confidence: 0.98

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 8ef86077e70a.

Labels

Label justifications:

  • P2: The new compact path can hide an account-switch failure, but the issue is limited to Claude menus with four or more configured accounts.
  • merge-risk: 🚨 auth-provider: The modified presentation path can suppress a user-visible Claude account-switch authentication or token error.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦞 diamond lobster and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: The author is the repository owner, so external-contributor proof gating does not apply; prepared before/after screenshots were nevertheless inspected and directly demonstrate the intended menu layout.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. The author is the repository owner, so external-contributor proof gating does not apply; prepared before/after screenshots were nevertheless inspected and directly demonstrate the intended menu layout.

Evidence

Acceptance criteria:

  • [P1] swift test --filter "AccountMenuLayoutPlannerTests|StatusMenuClaudeSwapCompactTests|ClaudeProviderRuntimeTests".
  • [P1] make check.
  • [P1] make test.

What I checked:

Likely related people:

  • steipete: Introduced the original Claude-swap account-switching menu behavior and authored the current compact-layout implementation. (role: feature owner and recent area contributor; confidence: high; commits: ab4717831d6d, 6a57977983e2; files: Sources/CodexBar/StatusItemController+ClaudeSwapMenu.swift, Sources/CodexBarCore/Providers/Claude/ClaudeSwap/ClaudeSwapAccountProjection.swift)
  • kiranmagic7: Recent Claude-swap relogin-status work touches the account-projection error surface whose established display semantics this new rendering path needs to preserve. (role: adjacent error-state contributor; confidence: medium; commits: 8736eaee1e84; files: Sources/CodexBarCore/Providers/Claude/ClaudeSwap/ClaudeSwapAccountProjection.swift)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Propagate the existing effective account-switch error into compact rows.
  • Add a focused four-or-more-account test for a failed inactive account switch.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (1 earlier review cycle)
  • reviewed 2026-08-01T05:44:45.789Z sha b89bfb8 :: found issues before merge. :: [P2] Preserve switch errors in compact account rows

With four or more claude-swap accounts the Claude menu now pins the active
account's full card, renders inactive accounts as one-line rows sorted by
remaining headroom (red/amber below 10%/50% left, star on the healthiest
activatable account), and folds the healthy tail behind a summary row.
Clicking a compact row expands that account's full card; expansion state
resets when the menu closes. Fewer than four accounts keep the stacked cards.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@steipete
steipete force-pushed the claude/smart-multi-account-view-8b33ad branch from a21b65a to 6a57977 Compare August 1, 2026 05:55
@clawsweeper clawsweeper Bot removed the proof: sufficient Contributor real behavior proof is sufficient. label Aug 1, 2026
@steipete
steipete merged commit 74568ff into main Aug 1, 2026
9 checks passed
@steipete
steipete deleted the claude/smart-multi-account-view-8b33ad branch August 1, 2026 06:36
LeoLin990405 pushed a commit to LeoLin990405/CodexBar that referenced this pull request Aug 7, 2026
…ount-view-8b33ad

Claude: compact multi-account menu (active card + headroom-sorted rows + collapsed tail)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 auth-provider 🚨 Merging this PR could break OAuth, tokens, provider routing, model choice, or credentials. P2 Normal priority bug or improvement with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant