Skip to content

fix(claude): clarify account switching and await reconciliation - #3740

Merged
steipete merged 19 commits into
mainfrom
codex/fix-claude-switch-progress-3736
Sep 18, 2026
Merged

steipete merged 19 commits into
mainfrom
codex/fix-claude-switch-progress-3736

Conversation

@steipete

@steipete steipete commented Sep 18, 2026

Copy link
Copy Markdown
Owner

Selecting an inactive claude-swap chip changes Claude Code's account, but the menu showed Loading… during both the switch and the following refresh, and could keep stale controls after completion. Show Switching account…, then Refreshing account status…, and update the attached menu while it remains open.

The Switch Claude Code account heading and privacy-safe tooltips/accessibility labels clarify the chip action while retaining readable Account N identities. Active and unavailable chips remain inspection controls, including an active account with foreign credentials; its separate Re-authenticate action remains available.

Keep the target and transaction guard until ambient usage and the independently scheduled adapter list finish. Follow replacement list reads only while the original configuration remains current. Configuration changes discard stale progress and errors without cancelling the external credential transaction. Known switch errors retain precedence, and only the adapter's refreshed list determines the active account.

Related to #3736. Keep that issue open: the cause of the reported minute-long refresh remains unresolved. The broader account-menu redesign in #3550 remains separate.

The test config helper also uses one private config root per process, retaining same-suite reuse and explicit URL behavior. This prevents parallel worktrees from rewriting the same default test config; it does not establish the cause of any historical intermittent failure.

Validation

  • Focused reconciliation regressions passed using synthetic --switch-to, --version, and --list subprocesses: ambient-first completion, replacement reads, configuration invalidation, blocked activation, and error precedence.
  • make check: passed with zero violations after integrating the landed menu dependency. Independent P0–P2 review of the final 17-file scope found no actionable findings. All 16 non-changelog files are unchanged from the validated feature candidate.
  • make test: all 1,200 selections across 111 groups passed on 22f32150a3461d28e9cea58d74123680b830d894, with no retries or timeouts (1,081 seconds). This includes the Codex menu dependency and provider changes through 0ead0d6.
  • Combined integration with fix(menu): align multiword titles in stacked provider switchers #3738, fix(antigravity): complete per-source failure diagnostics #3683, and the landed fixes: all 1,203 selections across 111 groups passed on prospective final tree f537a864384661a1ca3467f05b65bb288323a376, without retries or timeouts (1,241 seconds). The combined lint and independent P0–P2 review are clean.
  • Current-head CI: all checks passed for 37e97a7b26da0dbc94d2ad71174a1669d509e762. The merge preview onto current main exactly matches the fully tested combined tree f537a864384661a1ca3467f05b65bb288323a376.

Signed synthetic native proof on macOS 27.0 (26A428) clicked the actual attached Account 2 button while the same menu tracked. The control at fc2020a236d9c displayed Loading… in both held stages. The candidate at fde9a0f8946d passed strict checks for both progress labels, the heading, and completion showing Account 2 as Active with enabled chips. Account 2's 17% usage stayed visible; Account 1 remained active until synthetic reconciliation published Account 2. A disabled third-chip click produced no extra switch: exactly one switch command and one refresh, with no unexpected requests. The transaction and widget task drained before fixture cleanup.

The native fixture proves visible phase transitions; the separate subprocess regressions prove the independent adapter-list lifecycle. All proof accounts and data are synthetic.

Native proof and source/binary provenance. Published images return HTTP 200 and match the inspected local files byte-for-byte.

Before activation After activation
Loading during activation Switching account
Refreshing account status Reconciliation complete
Refreshing account status Account 2 active with enabled controls

sandeep780049 and others added 19 commits September 18, 2026 00:53
Switching Codex accounts in the segmented layout cleared the published
usage and left the open menu card blank: the account-scoped refresh's
phase callbacks called the generic open-menu refresh, which defers
parent rebuilds while tracking and re-defers on its retry pass, so the
fetched usage was only rendered after closing and reopening the menu.

Route the phase callbacks through the switcher rebuild path instead.
It coalesces the rapid phase notifications into one in-place rebuild,
closes hosted subviews first like the selection rebuild, and clears
the tracking deferral, so the open card adopts the new account's
usage as soon as it arrives.

Adds a regression test asserting a post-fetch rebuild while the menu
stays open, and updates the provider gatekeeper allowlist for the
rerouted call.

Fixes #3709.
Address review feedback on the first attempt: routing the refresh
phase callbacks through the switcher path would dismiss an open hosted
chart submenu when a delayed phase landed. Add a dedicated helper that
bumps the content version as a data-only invalidation and schedules an
in-place rebuild: coalesced, deferred during native highlight, skipped
while a hosted submenu is open, and reconciled when it closes.

Also seed the changelog entry and cover the helper's submenu
preservation contract with a focused regression test.
The account-scoped refresh can publish unrelated data-only
invalidations after the final rebuild (widget snapshots, readiness
resyncs), so asserting a fully-settled state at the end over-constrains
the regression. The defect's crisp signal is a rebuild happening after
the fetch resolves while the menu stays open.
Follow the repo's native-proof convention (AboutUpdateCommandProofTests,
ClaudeWeeklyLabelsNativeProofTests): when CODEXBAR_ACCOUNT_SWITCH_PROOF_DIR
is set with keychain prompt suppression, the test runs the real account-
switch scheduling path with card rendering enabled and captures before/
after PNGs of the usage card plus a transcript, asserting the fetched
usage is published and the open hosted submenu survives.

A dispatch-only workflow runs the proof on a macOS runner and uploads
the artifacts as merge evidence.
Keep account switching serialized through ambient usage and the independent account-list refresh. Show distinct progress, make chip activation explicit, and reject stale configuration or menu callbacks without cancelling credential transactions. Add isolated lifecycle regressions and opt-in native menu proof. Related to #3736.
@clawsweeper

clawsweeper Bot commented Sep 18, 2026

Copy link
Copy Markdown

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added P2 Normal priority bug or improvement with limited blast radius. proof: sufficient Contributor real behavior proof is sufficient. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 18, 2026
@clawsweeper

clawsweeper Bot commented Sep 18, 2026

Copy link
Copy Markdown

Codex review: needs maintainer review before merge. Reviewed September 18, 2026, 9:58 AM ET / 13:58 UTC (Revision 2).

ClawSweeper review

What this changes

Clarifies Claude account-chip actions, displays switching and reconciliation progress in open menus, waits for account-list reconciliation, and isolates test configuration files between processes.

Merge readiness

Ready for maintainer review

This remains useful work absent from current main and v0.60.5. No actionable introduced defects were found, and the inspected native proof supports the visible improvement. The unresolved slow-refresh report remains separate.

Priority: P2
Reviewed head: 37e97a7b26da0dbc94d2ad71174a1669d509e762

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused production repair with convincing native UI evidence and substantial lifecycle coverage; no blocking findings.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (screenshot): Inspected native screenshots and source-linked macOS evidence exercise the attached production menu through activation, held reconciliation, and completion with enabled controls. The demonstrated feature code matches this head; separate subprocess regressions cover independent adapter reads. Evidence establishes UI recovery, not resolution of real-account refresh latency.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (screenshot): Inspected native screenshots and source-linked macOS evidence exercise the attached production menu through activation, held reconciliation, and completion with enabled controls. The demonstrated feature code matches this head; separate subprocess regressions cover independent adapter reads. Evidence establishes UI recovery, not resolution of real-account refresh latency.
Evidence reviewed 12 items Applicable repository policy: Read the complete root AGENTS.md. No nested AGENTS.md or maintainer-notes directory was present. Applied credential isolation, provider separation, concurrency, and native-menu validation guidance.
Introduced scope: The verified merge-base-to-head delta contains four production files, eleven test files, one documentation file, and the changelog. Production changes total +102/-17 lines; tests total +1652/-14 lines.
Reconciliation lifecycle: The switch retains its transaction guard through ambient refresh and the independently scheduled adapter task, follows replacement reads, and rejects stale progress using configuration generations.
Findings None None.
Security None None.

How this fits together

CodexBar’s Claude account menu displays usage reported by the optional claude-swap executable. Explicit account activation starts an external credential transaction, then refreshes usage and account status before restoring menu controls.

flowchart TD
  A[Account chip or card click] --> B{Inspect or activate}
  B -->|Inspect| C[Account details]
  B -->|Activate| D[Serialized external switch]
  D --> E[Refresh usage and account list]
  E --> F{Configuration still current}
  F -->|Yes| G[Update open menu and controls]
  F -->|No| H[Discard stale progress]
Loading

Before merge

None.

Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Production and test growth Production +102/-17 lines; tests +1652/-14 lines Most growth supplies lifecycle regressions and native proof; production growth implements phase tracking and guarded menu updates.

Technical review

Best possible solution:

Preserve explicit activation and source-owned account identity while keeping progress truthful and controls synchronized through reconciliation.

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

Yes, source inspection establishes the missing adapter-task join and progress-driven menu rebuilds, supported by synthetic native before/after evidence. This review did not execute current main or reproduce the reported minute-long delay.

Is this the best way to solve the issue?

Yes. The patch extends the existing switch lifecycle and menu scheduler while preserving explicit repair, account ownership, and saved settings.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against b6d885cab3ee.

Labels

Label justifications:

  • P2: Repairs misleading progress and stale controls in the optional Claude multi-account workflow.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (screenshot): Inspected native screenshots and source-linked macOS evidence exercise the attached production menu through activation, held reconciliation, and completion with enabled controls. The demonstrated feature code matches this head; separate subprocess regressions cover independent adapter reads. Evidence establishes UI recovery, not resolution of real-account refresh latency.
  • proof: sufficient: Contributor real behavior proof is sufficient. Inspected native screenshots and source-linked macOS evidence exercise the attached production menu through activation, held reconciliation, and completion with enabled controls. The demonstrated feature code matches this head; separate subprocess regressions cover independent adapter reads. Evidence establishes UI recovery, not resolution of real-account refresh latency.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. Inspected native screenshots and source-linked macOS evidence exercise the attached production menu through activation, held reconciliation, and completion with enabled controls. The demonstrated feature code matches this head; separate subprocess regressions cover independent adapter reads. Evidence establishes UI recovery, not resolution of real-account refresh latency.

Evidence

What I checked:

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)
  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)

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-09-18T13:45:20.291Z sha 37e97a7 :: needs maintainer review before merge. :: none

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal priority bug or improvement with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants