Avoid repeated CodexBarCache keychain prompts in dev builds#1271
Avoid repeated CodexBarCache keychain prompts in dev builds#1271Yuxin-Qiao wants to merge 4 commits into
Conversation
|
Codex review: needs maintainer review before merge. Reviewed June 3, 2026, 12:02 AM ET / 04:02 UTC. Summary Reproducibility: yes. with a policy caveat: the concrete path is launching the raw SwiftPM debug binary from .build and then reaching CodexBarCache-backed keychain reads. I did not run live Keychain validation because AGENTS.md warns against checks that can display Keychain prompts, but the PR includes current-head runtime logs from that path. Review metrics: 2 noteworthy metrics.
Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: The end state should be that raw ad-hoc dev builds fail closed before real Keychain reads, while Developer ID releases and stable signed local app bundles keep normal Keychain behavior with tests and docs covering the boundary. Do we have a high-confidence way to reproduce the issue? Yes, with a policy caveat: the concrete path is launching the raw SwiftPM debug binary from .build and then reaching CodexBarCache-backed keychain reads. I did not run live Keychain validation because AGENTS.md warns against checks that can display Keychain prompts, but the PR includes current-head runtime logs from that path. Is this the best way to solve the issue? Yes, assuming maintainers accept the dev-workflow tradeoff. The process-level gate is narrower than the earlier env-var bypass idea and current source shows the main cache/browser/OAuth Keychain paths consult KeychainAccessGate, while tests cover release and stable signed dev app boundaries. AGENTS.md: found and applied where relevant. Codex review notes: model gpt-5.5, reasoning high; reviewed against 3387cc8b2d47. Label changesLabel changes:
Label justifications:
Evidence reviewedWhat I checked:
Likely related people:
What the crustacean ranks mean
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
|
3552dc7 to
0b751f8
Compare
|
I redirected this PR after collecting runtime evidence from the repeated CodexBarCache prompt. The original implementation used a Claude-only |
0b751f8 to
86ec4bd
Compare
86ec4bd to
74c009d
Compare
|
Real dev/ad-hoc launch proof captured for the one-shot diagnostic. Setup:
Redacted log proof: |
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
Current-head validation for Checked locally from a fresh PR checkout at Focused test: Raw SwiftPM debug binary signing: Runtime log proof from launching that exact raw debug binary: This verifies the current PR head detects the raw ad-hoc SwiftPM launch mode and disables Keychain access before the process can fall into the repeated |
|
@clawsweeper re-review |
|
🦞👀 Command router queued. I will update this comment with the next step. Re-review progress:
|
Summary
CodexBar Cachekeychain password prompts when contributors launch an ad-hoc / SwiftPM dev build directly from.build/.../debug/CodexBar./Applications/CodexBar.appis not auto-disabled and still uses the normal Keychain path.Impact
This is a contributor-facing local development failure mode. The macOS prompt is modal, asks for the user's login keychain password, and can appear repeatedly even after choosing Allow / Always Allow. That makes local validation feel broken and confusing because the dev build appears to demand sensitive credentials for
CodexBar Cacheover and over.Runtime evidence from the failure mode showed:
The root cause is identity churn: a direct SwiftPM debug executable is ad-hoc signed, has no certificate-backed stable identity, and gets a different code identity after rebuilds. Existing Keychain ACLs written for
/Applications/CodexBar.appor a previous dev binary do not match the current ad-hoc executable, so macOS falls back to the legacy password prompt.Fresh local repro boundary checked on 2026-06-02: the prompt can still be reproduced from an older installed
/Applications/CodexBar.app(0.32.2, build77) because that binary does not contain this patch. That does not invalidate the guard; it confirms the user-facing failure is real and that validation must be done with a rebuilt PR binary. The installed app is Developer ID signed with Team identifierY5PE65HELJ, so production signing is stable; stale or dev-retrustedCodexBar CacheACL entries can still make an older installed build prompt until the cache items are cleared or the patched build is used.Behavior evidence
Before this PR
Direct local launch:
When CodexBar later reads cached cookies/OAuth entries from
com.steipete.codexbar.cache, the app can hit a Keychain ACL mismatch and macOS displays the blocking dialog:Because each ad-hoc rebuild has a new code identity, allowing the prompt does not reliably stop the next prompt.
After this PR
On startup,
KeychainPromptCoordinatorchecks the running executable identity/path. If the process is a SwiftPM debug build or ad-hoc signed, it calls:That process-level guard survives later settings initialization, so cache/cookie/OAuth keychain code sees
KeychainAccessGate.isDisabled == trueand avoids the real Keychain path. In particular:KeychainCacheStore.load/store/clear/keysreturn missing/no-op/empty instead of callingSecItemCopyMatchingforcom.steipete.codexbar.cache.keychainDisabledand skip keychain-backed cookie imports.This turns the risky dev-build path into an explicit no-Keychain local run instead of a recurring macOS password prompt loop.
Scope
CodexBar.appsigned with a stable local dev certificate./Applications/CodexBar.app.Evidence
Focused dev-build prompt guard
Command:
swift test --filter KeychainPromptCoordinatorTestsOutput excerpt:
Covered cases:
/Applications/CodexBar.appdoes not trigger the guard..build/.../debug/CodexBartriggers the warning/guard.Keychain regression suite
Command:
Output excerpt:
Important new coverage:
This verifies the actual fix: once the dev-build guard disables Keychain access for the process, a later
KeychainAccessGate.isDisabled = falsefrom settings initialization cannot re-enable it and reintroduce the prompt loop.Recommended local workflows
/Applications/CodexBar.app../Scripts/compile_and_run.sh, which packages and launchesCodexBar.appwith a stable local signing identity when available..build/.../debug/CodexBarruns are still possible, but they now intentionally run without Keychain access to avoid the repeated macOS prompt.