Skip to content

Bound Claude Keychain waits without terminating security - #8337

Closed
lidge-jun wants to merge 19 commits into
devfrom
codex/fix-8161-keychain-no-kill
Closed

lidge-jun wants to merge 19 commits into
devfrom
codex/fix-8161-keychain-no-kill

Conversation

@lidge-jun

@lidge-jun lidge-jun commented Nov 8, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Bound Claude Code Keychain caller waits without signalling a blocked security child. Credential reads and metadata probes share one process-local admission slot, quarantine late output and back off after failures.
  • Preserve authoritative absence and auth-mode detection, reject unavailable initial observations before token refresh or intent/health changes, and recheck a fresh matching credential and owner before adoption or local login persistence.
  • Use browser OAuth for expired or nearly expired local credentials in fallback mode; import-only requests a new sign-in, without sending the local refresh token.
  • Fence delayed system-environment reconciliation against newer settings, reversion and competing process ownership.
  • Closes [Bug][macOS] Killing a blocked security Keychain read after 5s crashes securityd and causes an endless login-keychain prompt loop #8161.

Verification

  • Earlier Windows/Bun 1.4.4 runs with private synthetic homes and children: focused service/identity/Lab set: 186 passed; account, environment and instance set: 191 passed; layout, file-size, structure and Lab guards: 114 passed; final service suite: 15 passed.
  • Earlier follow-up at 97b063d44: cancellation cases and observation guards: 5 passed; file-size ratchet: 9 passed; typecheck passed. The broader serial provider/Keychain/management/guard run before the final test-only commit reported 188 passed, 0 failed, with early output truncated.
  • Full tests/oauth/oauth-refresh.test.ts on Windows: 60 passed, 7 failed, exit 1. All seven failures occurred in Nous cases when icacls returned EICACLS while hardening temporary files; the two Anthropic tests reported by Ubuntu CI passed locally.
  • Earlier at 53cf97c94: serial OAuth identity, account-plan, instance-registration and local-token suites: 177 passed; layout, ratchet, structure and Lab guards: 114 passed. bun run typecheck, bun run privacy:scan, and bun run structure:check passed.
  • During the 1ec52980b repair: OAuth identity and reauthentication suites: 94 passed before the final test expansion; queued writer cases for both login modes: 2 passed on the final code; layout, ratchet, structure and Lab guards: 114 passed. bun run typecheck, bun run privacy:scan, and bun run structure:check exited 0. Earlier in the same repair, five OAuth suites reported 198 passed before the final synchronous guard and test expansion.
  • During the b7e634dca repair: serial system-environment, management, shell-hook and local-token tests reported 163 passed, 1 existing Windows skip, 0 failures; a later stale-cleanup check ran 4 passed. The serial layout, ratchet, structure and Lab guards ran 114 passed, and typecheck, privacy and structure checks exited 0. Synthetic child processes and private homes were used; launchctl and Keychain were mocked.
  • At local head c732162a6: isolated system-environment suites ran 75 passed, 0 failed; layout, ratchet, structure and Lab guards ran 114 passed, 0 failed. bun run typecheck, bun run privacy:scan and bun run structure:check exited 0. Synthetic child processes exercised competing tracking owners before and after initial commit; no real launchctl or Keychain was used.
  • cd docs-site && bun run build: exited 0; 641 pages and 93,212 internal links checked (long route output truncated).
  • bun run test:changed --parallel=1: timed out at the existing 900-second limit (exit 124); buffered output was truncated and no complete test verdict is available. Full local suite NOT RUN because serial execution shares the host with another lane. Push used --no-verify; full Ubuntu CI is requested with ci:full.
  • Native macOS Keychain/securityd behavior was not reproduced. Synthetic Bun process-lifetime checks ran on Windows; this is not native macOS evidence. The admission bound is process-local and does not prevent survivors from accumulating across parent restarts.

Checklist

  • Scope stays focused and avoids unrelated cleanup.
  • Docs or release notes were updated when needed.
  • Security-sensitive changes were reviewed for secrets, auth, and unsafe defaults. Independent technical and security reviews are pending.

@coderabbitai

coderabbitai Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@github-actions

github-actions Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

✅ Deterministic PR hygiene checks passed.

@lidge-jun lidge-jun added the ci:full Run the four full Ubuntu test shards on this pull request label Nov 8, 2026 — with ChatGPT Codex Connector
@lidge-jun

Copy link
Copy Markdown
Owner Author

Superseded by #8569 (merged as 180ecc7), which finishes #8161 on current dev.

This draft predates #8327, which landed the asynchronous request-path Keychain read with a different reader (src/oauth/claude-keychain-read.ts), so its src/lib/claude-keychain.ts service no longer fit. #8569 carries the remaining scope onto that reader: the metadata probe becomes async and shares the read's single slot and backoff, readSync is removed, presence is resolved once at each async boundary, and credential adoption re-reads the CLI generation inside the serialized writer. The unrelated system-environment reconciliation fencing and the browser-OAuth fallback for expired local credentials in this draft were not carried; they can be proposed separately if still wanted.

@lidge-jun lidge-jun closed this Nov 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working ci:full Run the four full Ubuntu test shards on this pull request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug][macOS] Killing a blocked security Keychain read after 5s crashes securityd and causes an endless login-keychain prompt loop

1 participant