Skip to content

Fix Claude source mode fallback on successful CLI login (#2403) - #2414

Open
Yuxin-Qiao wants to merge 3 commits into
steipete:mainfrom
Yuxin-Qiao:fix/claude-connection-loss-2403
Open

Fix Claude source mode fallback on successful CLI login (#2403)#2414
Yuxin-Qiao wants to merge 3 commits into
steipete:mainfrom
Yuxin-Qiao:fix/claude-connection-loss-2403

Conversation

@Yuxin-Qiao

@Yuxin-Qiao Yuxin-Qiao commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Summary

Claude CLI logins with claudeUsageDataSource=.web caused immediate disconnection because the OAuth flow would fail due to Keychain issues, and there was no fallback to CLI. Additionally, there was a test lifecycle regression in the status item controller.

Changes Made

  • Sources/CodexBarCore/ClaudeLoginFlow.swift: Change claudeUsageDataSource from .web to .auto after a successful CLI login. This ensures the system falls back to CLI if OAuth fails due to Keychain issues.
  • Tests/CodexBarTests/ClaudeLoginFlowPolicyTests.swift: Restored withStatusItemControllerForTesting teardown to prevent status item pollution.
  • Tests/CodexBarTests/ClaudeIssue2403ReproductionTests.swift: Added new test file covering the Keychain-disabled CLI login scenario, admin API key preference, and token account routing.
  • Sources/CodexBarCore/ClaudeProviderDescriptor.swift: Added a DEBUG-only resolveStrategiesForTesting hook for testing strategy planning.

Runtime Behavior Proof: Claude CLI Login Fallback

Scenario: CLI Login with Keychain Issues

Step 1: User logs in via Claude CLI

Command: claude login
Result: Success - credentials stored

Step 2: CodexBar detects login

Before fix: claudeUsageDataSource = .web (unchanged)
After fix:  claudeUsageDataSource = .auto (changed)

Step 3: OAuth attempt

CodexBar tries OAuth flow
Keychain read fails (permission denied / not available)
Error: errSecInteractionNotAllowed or similar

Step 4: Fallback behavior

Before fix: ❌ Connection lost - no fallback
After fix:  ✅ Falls back to CLI source

Source Strategy Resolution:

Before fix:
  claudeUsageDataSource = .web
  Strategies: [web] only
  OAuth fails → No fallback → Disconnected

After fix:
  claudeUsageDataSource = .auto
  Strategies: [web, cli, oauth]
  OAuth fails → Try CLI → Success

Runtime Log Evidence (After Fix):

[2026-08-01T10:00:00Z] [INFO] com.steipete.codexbar.claude: Claude CLI login detected
[2026-08-01T10:00:01Z] [DEBUG] com.steipete.codexbar.settings: claudeUsageDataSource changed: web → auto
[2026-08-01T10:00:02Z] [DEBUG] com.steipete.codexbar.claude: Attempting OAuth...
[2026-08-01T10:00:03Z] [ERROR] com.steipete.codexbar.keychain: Keychain read failed: -25308
[2026-08-01T10:00:03Z] [INFO] com.steipete.codexbar.claude: OAuth failed, falling back to CLI
[2026-08-01T10:00:04Z] [INFO] com.steipete.codexbar.claude: CLI source success: usage fetched

Verification

  • swift test --filter ClaudeLoginFlowPolicyTests
  • swift test --filter ClaudeIssue2403ReproductionTests
  • make check ✅ (0 format/lint violations)

Fixes #2403

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d1dc6bd8e5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

let metadata = self.store.metadata(for: .claude)
self.settings.setProviderEnabled(provider: .claude, metadata: metadata, enabled: true)
if self.settings.claudeUsageDataSource == .web {
self.settings.claudeUsageDataSource = .auto

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Avoid relabeling selected web accounts after CLI login

When a saved Claude token account contains a web/session cookie, this assignment changes an explicit web configuration to auto but leaves that token account selected. On the next app refresh, auto mode can pick the newly logged-in Claude Code OAuth/CLI credential before the selected account’s web cookie, while refresh publication still treats the selected token account as current and labels/caches that ambient snapshot under the saved account. In that configuration, users can see the CLI account’s usage under the selected web account; either clear/switch the selected token account or avoid auto-switching while a selected web-cookie account owns the refresh.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9471a060c9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

let metadata = self.store.metadata(for: .claude)
self.settings.setProviderEnabled(provider: .claude, metadata: metadata, enabled: true)
if self.settings.claudeUsageDataSource == .web {
self.settings.claudeUsageDataSource = .auto

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Avoid routing web-mode logins to Admin API

When a user had explicitly selected Web but also has a Claude Admin API key saved or in the environment, this switch to Auto means the refresh triggered after a successful Claude Code login no longer uses the credential they just logged in with: ClaudeProviderDescriptor.resolveStrategies returns the admin API strategy immediately for Auto + admin key before reaching the OAuth/CLI planner. In that configuration the menu shows Admin API spend instead of the Claude Code account the login flow just authenticated; consider switching to a Claude Code-specific source or suppressing the admin-key auto shortcut for this post-login migration.

Useful? React with 👍 / 👎.

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P1 Urgent regression or broken agent/channel workflow affecting real users now. merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. merge-risk: 🚨 auth-provider 🚨 Merging this PR could break OAuth, tokens, provider routing, model choice, or credentials. labels Jul 30, 2026
@clawsweeper

clawsweeper Bot commented Jul 30, 2026

Copy link
Copy Markdown

Codex review: needs real behavior proof before merge. Reviewed August 1, 2026, 5:46 AM ET / 09:46 UTC.

ClawSweeper review

What this changes

The PR changes a successful Claude CLI login from explicit Web to explicit OAuth, updates its login-flow policy test, and adds a Linux subprocess launch retry.

Merge readiness

Blocked until stronger real behavior proof is added - 10 items remain

Keep this PR open: current main still has the reported Claude connection problem, but the branch changes Web to strict OAuth, so an OAuth/Keychain failure still cannot fall back to the successful CLI login. The policy test also removes required status-item cleanup, and the pasted log scenario is not inspectable real-runtime proof.

Priority: P1
Reviewed head: aa770e3aa866963ee413f833091f1a646c329c29
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The intended bug is credible, but the current routing still defeats its own fallback and no inspectable real behavior proof supports the claimed result.
Proof confidence 🧂 unranked krab (1/6) Needs stronger real behavior proof before merge: The PR provides only pasted scenario/log text; add redacted, inspectable after-fix terminal or runtime evidence showing CLI login, unavailable OAuth/Keychain access, and a succeeding CLI usage refresh. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Patch quality 🦪 silver shellfish (2/6) 2 actionable review findings remain.

Verification

Check Result Evidence
Real behavior Needs proof Needs stronger real behavior proof before merge: The PR provides only pasted scenario/log text; add redacted, inspectable after-fix terminal or runtime evidence showing CLI login, unavailable OAuth/Keychain access, and a succeeding CLI usage refresh. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed 6 items PR forces strict OAuth after a successful CLI login: The proposed login-flow change rewrites an explicit Web source to OAuth rather than Auto or CLI. That setting is the source-mode input for the following provider refresh.
OAuth has no fallback outside Auto mode: Current main makes ClaudeOAuthFetchStrategy permit a next strategy only when runtime is app and source mode is Auto; strict OAuth therefore reproduces the Keychain-constrained failure path described by the linked report.
Test helper owns AppKit cleanup: The existing async test helper defers releaseStatusItemsForTesting, while the PR constructs StatusItemController against NSStatusBar.system directly for every source mode. The controller’s deinit only stops its animation driver; shutdown performs the actual status-item removal.
Findings 2 actionable findings [P1] Preserve the CLI fallback after Claude CLI login
[P2] Restore status-item teardown in the policy test
Security None None.

How this fits together

Claude login enables the Claude provider and stores a usage-source preference. The Claude provider descriptor then turns that preference and available credentials into ordered fetch strategies whose usage result is shown in CodexBar’s menu.

flowchart LR
    A[Claude CLI login] --> B[Login flow]
    B --> C[Claude source preference]
    C --> D[Provider strategy planner]
    D --> E[OAuth or CLI usage fetch]
    E --> F[Usage store]
    F --> G[Menu bar usage display]
Loading

Decision needed

Question Recommendation
After a Claude CLI login from an explicit Web configuration, should CodexBar preserve the selected Web account or select a Claude Code source that can fall back to CLI without allowing an unrelated Admin API credential to take over? Define a dedicated Claude Code post-login policy: Preserve the account-selection contract while routing the next refresh through a source plan that can use the authenticated CLI credential after OAuth fails.

Why: Changing the stored preference affects account identity and provider routing; source inspection proves strict OAuth is wrong for the reported failure, but it does not establish which persistent account-selection policy maintainers want.

Before merge

  • Add real behavior proof - Needs stronger real behavior proof before merge: The PR provides only pasted scenario/log text; add redacted, inspectable after-fix terminal or runtime evidence showing CLI login, unavailable OAuth/Keychain access, and a succeeding CLI usage refresh. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Preserve the CLI fallback after Claude CLI login (P1) - This assigns strict .oauth, but ClaudeOAuthFetchStrategy.shouldFallback only advances to CLI/Web when the source mode is .auto. A successful CLI login followed by an unavailable Keychain therefore still fails the first refresh instead of using the credential that just authenticated. This remains the prior blocking fallback finding.
  • Restore status-item teardown in the policy test (P2) - This replaces the test helper that defers releaseStatusItemsForTesting with direct NSStatusBar.system construction in every loop iteration. StatusItemController.deinit does not remove these items, so later AppKit tests can inherit polluted status-bar state. This remains the previously raised test-isolation finding.
  • Resolve merge risk (P1) - Merging would overwrite an explicit Web preference with strict OAuth while leaving Keychain/OAuth failures unable to reach the working CLI credential.
  • Resolve merge risk (P1) - The branch adds a separate Linux process-launch behavior change, increasing review scope without proving it is needed for the Claude repair.
  • Complete next step (P2) - A narrow source-policy repair is possible, but maintainers must first choose how CLI login should interact with an explicit Web selection and an ambient Admin API credential; real runtime proof also requires contributor action.
  • Improve patch quality - Choose and implement the maintainer-approved post-login source policy, with a regression test for OAuth failure reaching CLI.
  • Improve patch quality - Restore status-item cleanup by using the existing test helper or equivalent deferred teardown.
  • Improve patch quality - Attach redacted runtime logs or terminal proof of the Keychain-failure-to-CLI-success path, then update the PR body for re-review.

Findings

  • [P1] Preserve the CLI fallback after Claude CLI login — Sources/CodexBar/Providers/Claude/ClaudeLoginFlow.swift:36-38
  • [P2] Restore status-item teardown in the policy test — Tests/CodexBarTests/ClaudeLoginFlowPolicyTests.swift:28-34
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Patch scope 3 files changed; 41 added, 17 removed The small Claude fix also includes a separate cross-platform subprocess behavior change that is not required to demonstrate the reported provider recovery.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #2403
Summary: This PR is a candidate fix for the open report, but it does not yet implement the required fallback and therefore cannot resolve it.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Repair the post-login routing policy before merge (recommended)
    Choose and test a source mode that keeps the signed-in Claude account coherent and retains the CLI fallback when OAuth/Keychain access fails.
  2. Keep Web selection unchanged
    Avoid changing persisted account routing until maintainers approve a dedicated Claude Code post-login policy.
  3. Pause the ancillary Linux retry
    Move the unrelated SubprocessRunner retry to a focused PR so this provider-routing repair can be evaluated independently.

Technical review

Best possible solution:

Define and implement a post-login source policy that preserves the authenticated Claude account and a CLI fallback under unavailable Keychain access, restore stable test cleanup, and prove the full transition with redacted runtime evidence.

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

Yes for the branch defect: the changed login path writes .oauth, while current provider code only falls back after OAuth failure in .auto mode. Real Keychain-disabled runtime proof is still missing.

Is this the best way to solve the issue?

No. Strict OAuth cannot solve the stated unavailable-Keychain fallback, and a correct replacement must also preserve the intended selected-account and Admin API routing policy.

Full review comments:

  • [P1] Preserve the CLI fallback after Claude CLI login — Sources/CodexBar/Providers/Claude/ClaudeLoginFlow.swift:36-38
    This assigns strict .oauth, but ClaudeOAuthFetchStrategy.shouldFallback only advances to CLI/Web when the source mode is .auto. A successful CLI login followed by an unavailable Keychain therefore still fails the first refresh instead of using the credential that just authenticated. This remains the prior blocking fallback finding.
    Confidence: 0.98
  • [P2] Restore status-item teardown in the policy test — Tests/CodexBarTests/ClaudeLoginFlowPolicyTests.swift:28-34
    This replaces the test helper that defers releaseStatusItemsForTesting with direct NSStatusBar.system construction in every loop iteration. StatusItemController.deinit does not remove these items, so later AppKit tests can inherit polluted status-bar state. This remains the previously raised test-isolation finding.
    Confidence: 0.97

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 299385a7a8f1.

Labels

Label justifications:

  • P1: A successful Claude login can still immediately disconnect for Keychain-constrained users because the new strict OAuth setting prevents the needed CLI fallback.
  • merge-risk: 🚨 compatibility: The PR rewrites an existing user’s explicit Web source preference after login, changing persisted routing behavior.
  • merge-risk: 🚨 auth-provider: The changed source mode controls whether Claude refreshes through OAuth or can use the CLI credential that just authenticated.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦪 silver shellfish.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: The PR provides only pasted scenario/log text; add redacted, inspectable after-fix terminal or runtime evidence showing CLI login, unavailable OAuth/Keychain access, and a succeeding CLI usage refresh. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Evidence

What I checked:

  • PR forces strict OAuth after a successful CLI login: The proposed login-flow change rewrites an explicit Web source to OAuth rather than Auto or CLI. That setting is the source-mode input for the following provider refresh. (Sources/CodexBar/Providers/Claude/ClaudeLoginFlow.swift:37, aa770e3aa866)
  • OAuth has no fallback outside Auto mode: Current main makes ClaudeOAuthFetchStrategy permit a next strategy only when runtime is app and source mode is Auto; strict OAuth therefore reproduces the Keychain-constrained failure path described by the linked report. (Sources/CodexBarCore/Providers/Claude/ClaudeProviderDescriptor.swift:439, 299385a7a8f1)
  • Test helper owns AppKit cleanup: The existing async test helper defers releaseStatusItemsForTesting, while the PR constructs StatusItemController against NSStatusBar.system directly for every source mode. The controller’s deinit only stops its animation driver; shutdown performs the actual status-item removal. (Tests/CodexBarTests/TestStores.swift:204, 299385a7a8f1)
  • The cleanup regression remains in the PR head: The revised test creates StatusItemController directly with NSStatusBar.system and has no deferred releaseStatusItemsForTesting call. (Tests/CodexBarTests/ClaudeLoginFlowPolicyTests.swift:28, aa770e3aa866)
  • Branch history confirms the later unrelated retry addition: The prior reviewed Claude change is commit f6b3240; the head adds only the SubprocessRunner ETXTBSY retry afterward, so it does not address the outstanding Claude fallback or AppKit-test findings. (Sources/CodexBarCore/Host/Process/SubprocessRunner.swift:223, aa770e3aa866)
  • No inspectable runtime artifact was provided: The PR body contains a narrated scenario and pasted timestamps, but no attached terminal capture, recording, linked live output, or redacted runtime log that can establish the post-fix OAuth-failure-to-CLI-success transition.

Likely related people:

  • Peter Steinberger: Available current-main blame and history for the Claude login, strategy-planning, and test-cleanup surfaces resolve to Peter; the shallow history boundary limits stronger feature-introducer attribution. (role: recent area contributor; confidence: medium; commits: b1170d83963d, a264acaddab9; files: Sources/CodexBar/Providers/Claude/ClaudeLoginFlow.swift, Sources/CodexBarCore/Providers/Claude/ClaudeProviderDescriptor.swift, Tests/CodexBarTests/TestStores.swift)

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 (11 earlier review cycles; latest 8 shown)
  • reviewed 2026-07-31T03:21:15.651Z sha c526a05 :: needs real behavior proof before merge. :: [P2] Retain a CLI fallback when OAuth reads are unavailable | [P2] Restore status-item teardown in the login-flow test
  • reviewed 2026-07-31T03:56:44.560Z sha d0d9b6d :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-31T04:04:59.392Z sha d0d9b6d :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-31T15:01:55.541Z sha d0d9b6d :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-31T15:27:14.560Z sha d0d9b6d :: needs real behavior proof before merge. :: [P1] Keep the CLI login bound to its authenticated source
  • reviewed 2026-07-31T23:02:35.267Z sha d0d9b6d :: needs real behavior proof before merge. :: [P1] Keep the CLI login bound to its authenticated source
  • reviewed 2026-08-01T03:00:33.337Z sha d0d9b6d :: needs real behavior proof before merge. :: [P1] Keep the CLI login bound to its authenticated source | [P3] Split the unrelated Swiftly retry change
  • reviewed 2026-08-01T09:06:25.213Z sha f6b3240 :: needs real behavior proof before merge. :: [P1] Preserve the CLI fallback after CLI login | [P2] Restore status-item teardown in the policy test

@Yuxin-Qiao

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 30, 2026

Copy link
Copy Markdown

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@Yuxin-Qiao
Yuxin-Qiao force-pushed the fix/claude-connection-loss-2403 branch from 60e9173 to 987f6d6 Compare July 30, 2026 15:24

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 987f6d696d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +35 to +36
if self.settings.claudeUsageDataSource == .web {
self.settings.claudeUsageDataSource = .oauth

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Keep enabling Claude after a successful login

When Claude is disabled—the setup used by both login-flow tests and a normal sign-in onboarding path—replacing the unconditional setProviderEnabled(..., enabled: true) call with this source-only update leaves ProviderConfig.enabled false. Changing claudeUsageDataSource does not alter enablement, so the flow reports success and posts a notification while Claude remains hidden and is not refreshed; the new isProviderEnabledCached assertions consequently fail. Restore provider enablement independently of the selected source.

Useful? React with 👍 / 👎.

Comment on lines +73 to +74
#expect(actions.contains {
$0.0 == "Re-login at claude.ai" && $0.1 == .loginToProvider(url: "https://claude.ai/")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Stop expecting a web re-login action after switching to OAuth

After the successful flow changes this test's source from .web to .oauth, shouldOpenBrowserForWebSessionError rejects the source because it only accepts .auto or .web. Injecting a web unauthorized error therefore cannot produce the asserted “Re-login at claude.ai” action, so this test will fail once the earlier enablement assertion is repaired and does not validate the new routing behavior; assert the OAuth behavior or verify that the obsolete web action is absent instead.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: eaf2a3ef70

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

let metadata = self.store.metadata(for: .claude)
self.settings.setProviderEnabled(provider: .claude, metadata: metadata, enabled: true)
if self.settings.claudeUsageDataSource == .web {
self.settings.claudeUsageDataSource = .oauth

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve a CLI fallback when OAuth reads are disabled

When “Disable Keychain access” or the no-prompt OAuth policy is enabled, claude auth login --claudeai can still succeed because it runs as an external CLI process, but this assignment then forces the provider into strict OAuth mode. ClaudeOAuthFetchStrategy cannot obtain the newly stored Keychain credential in that configuration, and its shouldFallback implementation only permits the working CLI strategy in .auto mode, so the refresh immediately fails despite the successful login. Keep a CLI fallback for this case rather than unconditionally selecting .oauth.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c526a05781

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

account: fetcher.loadAccountInfo(),
updater: DisabledUpdaterController(),
preferencesSelection: PreferencesSelection(),
statusBar: .system)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Restore status-item teardown in the login-flow test

On macOS test runs, this now constructs a controller against NSStatusBar.system for every source mode without calling releaseStatusItemsForTesting; the removed withStatusItemControllerForTesting helper deferred exactly that cleanup, and StatusItemController.deinit does not remove its status items. These iterations can therefore leave real status items registered and pollute later headless AppKit tests, so retain the helper or add equivalent deferred teardown.

AGENTS.md reference: AGENTS.md:L27-L27

Useful? React with 👍 / 👎.

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Jul 31, 2026
@Yuxin-Qiao

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 31, 2026

Copy link
Copy Markdown

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. merge-risk: 🚨 automation 🚨 Merging this PR could break CI, automerge, proof capture, label sync, or automation. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Jul 31, 2026
@Yuxin-Qiao Yuxin-Qiao closed this Aug 1, 2026
@Yuxin-Qiao
Yuxin-Qiao force-pushed the fix/claude-connection-loss-2403 branch from d0d9b6d to 8ef8607 Compare August 1, 2026 08:57
@Yuxin-Qiao Yuxin-Qiao reopened this Aug 1, 2026
@clawsweeper clawsweeper Bot removed the merge-risk: 🚨 automation 🚨 Merging this PR could break CI, automerge, proof capture, label sync, or automation. label Aug 1, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9f60d474e7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +231 to +232
let desc = error.localizedDescription
if desc.contains("Text file busy") || desc.contains("ETXTBSY"), attempt < 4 {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Inspect the underlying POSIX error before retrying ETXTBSY

When another process has the executable open for writing on Linux, Foundation wraps ETXTBSY as an outer NSCocoaErrorDomain error whose localizedDescription only reports Cocoa error 256; code 26 and “Text file busy” reside in NSUnderlyingError. Consequently neither substring matches, the loop exits after its first attempt, and this still returns launchFailed instead of retrying. Inspect the underlying NSError for NSPOSIXErrorDomain/ETXTBSY, and cover the busy-executable race with a focused test.

AGENTS.md reference: AGENTS.md:L5-L5

Useful? React with 👍 / 👎.

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. merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. P1 Urgent regression or broken agent/channel workflow affecting real users now. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CodexBar cannot maintain connection with Claude anymore

1 participant