Skip to content

Add re-authenticate actions for Codex/Kiro, and a background-repair toggle for Claude#2340

Open
Vit129 wants to merge 3 commits into
steipete:mainfrom
Vit129:pr-reauth-buttons
Open

Add re-authenticate actions for Codex/Kiro, and a background-repair toggle for Claude#2340
Vit129 wants to merge 3 commits into
steipete:mainfrom
Vit129:pr-reauth-buttons

Conversation

@Vit129

@Vit129 Vit129 commented Jul 19, 2026

Copy link
Copy Markdown

Summary

  • Claude: adds a Settings > Advanced > Privacy toggle ("Auto-repair expired Claude token") that lets the existing delegated-refresh mechanism re-prompt the Keychain in the background, instead of requiring a manual Refresh click every time claudeOAuthKeychainPromptMode is onlyOnUserAction (the default) and the token expires.
  • Codex: adds a "Re-authenticate" button in Settings > Codex > Connection, wired to the existing runLoginFlow -> CodexLoginRunner -> codex login path already used elsewhere (e.g. Switch Account). Previously the only recovery from an expired Codex OAuth token was running codex login manually in a terminal.
  • Kiro: adds the equivalent "Re-authenticate" button, backed by a new KiroLoginRunner that spawns kiro-cli login (mirrors CodexLoginRunner's subprocess-lifecycle handling) and a new BinaryLocator.resolveKiroCLIBinary (mirrors resolveAntigravityBinary). Antigravity already has an equivalent flow ("Login with Google"); this brings Codex and Kiro to parity with it.

Test plan

  • swift build --product CodexBar -c debug succeeds
  • Manual: Settings > Advanced toggle flips claudeOAuthKeychainPromptMode between onlyOnUserAction and always
  • Manual: Codex/Kiro "Re-authenticate" buttons launch their respective CLI login flows and refresh usage on success

Vit129 and others added 3 commits July 19, 2026 22:20
Previously the only way to change claudeOAuthKeychainPromptMode away
from onlyOnUserAction was a defaults write — users hitting "background
repair is suppressed... Click Refresh" had no in-app way to opt into
always-on background repair. Adds a Privacy-section toggle in Advanced
settings wrapping the existing mode as a simple on/off (always vs
onlyOnUserAction), leaving the never/prompt-free path untouched.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HzWPve8BJ9KqMcSBiGXzPN
Codex had no settings action to recover from an expired OAuth token
short of running \`codex login\` manually in a terminal. Adds a
settingsActions entry (same pattern already used by Antigravity's
"Login with Google" button) that calls the existing runLoginFlow ->
CodexLoginRunner -> \`codex login\` subprocess path.

Antigravity already exposes an equivalent button ("Login with Google" /
"Add Google Account" in Settings > Antigravity > Connection) wired to a
real browser OAuth flow via AntigravityLoginRunner — no change needed
there. Kiro has no CLI login/auth surface in its \`kiro\` binary
(confirmed via \`kiro --help\`: file/diff/chat/tunnel commands only, no
login or auth subcommand), so no button was added for it.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HzWPve8BJ9KqMcSBiGXzPN
Earlier claim that Kiro has no CLI login was wrong — it was tested
against \`kiro\` (the editor launcher), not \`kiro-cli\` (a separate
binary at ~/.local/bin/kiro-cli). \`kiro-cli login\` opens a real
browser OAuth flow and blocks until it completes, same shape as
\`codex login\`.

Adds BinaryLocator.resolveKiroCLIBinary (mirrors resolveAntigravityBinary)
and KiroLoginRunner (mirrors CodexLoginRunner's subprocess-lifecycle
handling) to wire a settingsActions "Re-authenticate" button through
the existing runLoginFlow -> StatusItemController path already used by
Codex and Antigravity.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HzWPve8BJ9KqMcSBiGXzPN

@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: 883624f090

ℹ️ 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".

stdoutCapture.start()
stderrCapture.start()

let timedOut = await self.wait(timeout: timeout, termination: termination)

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 Surface Kiro device-flow output before waiting

When kiro-cli login uses device flow (the documented fallback for remote/browser-doesn't-open cases, where it prints a device code/URL and then polls), this waits for the subprocess to exit or hit the 120s timeout before combinedOutput is ever shown to the user. In that scenario the user never sees the code while the CLI is still polling, so the new Re-authenticate action times out and kills the login instead of letting them complete it; stream/detect the URL as it appears or run the login in a terminal/PTY.

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. P2 Normal priority bug or improvement with limited blast radius. labels Jul 19, 2026
@clawsweeper

clawsweeper Bot commented Jul 19, 2026

Copy link
Copy Markdown

Codex review: needs real behavior proof before merge. Reviewed July 19, 2026, 12:48 PM ET / 16:48 UTC.

Summary
The branch adds a Claude background OAuth-repair toggle and Settings re-authentication actions for Codex and Kiro, including a new Kiro CLI login runner and binary resolver.

Reproducibility: yes. source-reproducible: invoke the Kiro Settings action where kiro-cli login uses device flow; the runner pipes output and waits for completion, so its URL/code is unavailable while the user must act.

Review metrics: 1 noteworthy metric.

  • Changed surface: 9 files affected; 350 added, 0 removed. The patch introduces a new subprocess lifecycle plus settings UI across three providers, so runtime proof matters beyond the successful build.

Merge readiness
Overall: 🧂 unranked krab
Proof: 🧂 unranked krab
Patch quality: 🦐 gold shrimp
Result: blocked until real behavior proof from a real setup is added.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • Replace the piped Kiro interaction with a PTY, terminal, or streaming UI that exposes device-flow output before completion.
  • [P2] Add focused runner coverage for success, missing binary, timeout, and device-flow output handling.
  • [P1] Post redacted after-fix proof for the Claude setting plus successful Codex and Kiro re-authentication; updating the PR body should trigger a fresh review, or ask a maintainer to comment @clawsweeper re-review.

Proof guidance:

  • [P1] Needs real behavior proof before merge: The PR supplies a successful debug build only; its manual checks for the Advanced setting and both CLI re-authentication flows are unchecked, so after-fix runtime proof is still required. Please provide redacted screenshots, terminal output, or a recording; redact private URLs, account data, and tokens. 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.

Risk before merge

  • [P2] The Kiro button can launch a device-flow login that the user cannot complete because its URL/code stays hidden until completion or timeout.
  • [P1] The branch exposes a new opt-in background Keychain-prompt behavior, so maintainer approval and live proof should confirm the wording and recovery expectations are appropriate.

Maintainer options:

  1. Decide the mitigation before merge
    Run interactive Kiro login through a PTY or visible Terminal-style flow that exposes device instructions while polling, then add focused runner tests and redacted runtime proof for Kiro, Codex, and the Claude toggle.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Next step before merge

  • [P1] A narrow code repair is apparent, but maintainers must first choose the supported product surface for Kiro’s interactive device-flow login.

Maintainer decision needed

  • Question: Should Kiro re-authentication be supported in-app only with a PTY/visible device-flow experience, or should the Kiro Settings action be omitted until that interaction can be presented safely?
  • Rationale: The current pipe-based subprocess cannot reliably present the CLI’s interactive device-flow instructions, and choosing the product surface for that authentication interaction needs maintainer intent.
  • Likely owner: steipete — This choice affects the app’s provider-recovery UX and background Keychain behavior across the product.
  • Options:
    • Use a PTY or visible login flow (recommended): Keep the Kiro action, but make device URLs/codes visible while the CLI waits and validate both browser and device-flow completion.
    • Defer the Kiro action: Land only the Claude and Codex portions, then add Kiro re-authentication once its interactive CLI flow has an appropriate UI surface.

Security
Cleared: The diff launches locally resolved provider CLIs and does not add dependencies, workflow changes, broadened permissions, or secret-handling changes.

Review findings

  • [P2] Present Kiro device-flow instructions before waiting — Sources/CodexBar/Providers/Kiro/KiroLoginRunner.swift:54
Review details

Best possible solution:

Run interactive Kiro login through a PTY or visible Terminal-style flow that exposes device instructions while polling, then add focused runner tests and redacted runtime proof for Kiro, Codex, and the Claude toggle.

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

Yes, source-reproducible: invoke the Kiro Settings action where kiro-cli login uses device flow; the runner pipes output and waits for completion, so its URL/code is unavailable while the user must act.

Is this the best way to solve the issue?

No. Reusing the existing subprocess shape is not sufficient for Kiro’s interactive device flow; a PTY or visible streaming/terminal presentation is the narrower reliable solution.

Full review comments:

  • [P2] Present Kiro device-flow instructions before waiting — Sources/CodexBar/Providers/Kiro/KiroLoginRunner.swift:54
    kiro-cli login can fall back to device flow and print the URL/code while it polls. Because this runner captures both streams and only presents result.output after exit or timeout, users cannot complete that flow and the action kills it after 120 seconds. Run the command in a PTY/visible terminal or stream the device instructions into the UI while it remains active.
    Confidence: 0.96

Overall correctness: patch is incorrect
Overall confidence: 0.96

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 3b4d9a85cbec.

Label changes

Label changes:

  • add P2: The PR adds an unreliable user-facing recovery path for a supported provider, with a bounded but concrete impact on re-authentication.
  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦐 gold shrimp.
  • add status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR supplies a successful debug build only; its manual checks for the Advanced setting and both CLI re-authentication flows are unchecked, so after-fix runtime proof is still required. Please provide redacted screenshots, terminal output, or a recording; redact private URLs, account data, and tokens. 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.

Label justifications:

  • P2: The PR adds an unreliable user-facing recovery path for a supported provider, with a bounded but concrete impact on re-authentication.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦐 gold shrimp.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR supplies a successful debug build only; its manual checks for the Advanced setting and both CLI re-authentication flows are unchecked, so after-fix runtime proof is still required. Please provide redacted screenshots, terminal output, or a recording; redact private URLs, account data, and tokens. 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

What I checked:

  • Repository guidance applied: The repository policy requires focused coverage for new provider/parser logic and screenshots or GIFs for UI changes; it also directs reviewers to use focused non-Keychain validation rather than live account probes. (AGENTS.md:4, 3b4d9a85cbec)
  • Kiro login is non-interactive: The new runner attaches stdout and stderr to pipes and waits for the subprocess result, so a device-flow URL/code produced while kiro-cli login is still polling is not surfaced to the user. (Sources/CodexBar/Providers/Kiro/KiroLoginRunner.swift:54, 883624f09032)
  • Existing review identifies the concrete failure mode: The prior review notes that device-flow output is withheld until process exit or the 120-second timeout, preventing completion of remote or browser-fallback Kiro login. (Sources/CodexBar/Providers/Kiro/KiroLoginRunner.swift:54, 883624f09032)
  • No after-fix proof supplied: The PR body reports only a debug build; each manual verification item for the Advanced toggle and Codex/Kiro login actions remains unchecked. (883624f09032)
  • Current-main comparison: The supplied current-main SHA is later than the PR base SHA, while the proposed Kiro runner and Settings actions remain branch changes rather than an implementation already present on current main. (3b4d9a85cbec)

Likely related people:

  • steipete: The change adds provider-facing recovery UI and a setting that controls background Keychain prompting; repository ownership and the cross-provider scope make project-level product review the appropriate routing point. (role: likely product-direction owner; confidence: medium; files: Sources/CodexBar/Providers/Kiro/KiroProviderImplementation.swift, Sources/CodexBar/PreferencesAdvancedPane.swift, Sources/CodexBar/SettingsStore+Defaults.swift)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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.

How this review workflow works
  • 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.

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

1 participant