Skip to content

fix: address review feedback on macOS Keychain fallback (stderr deadlock, cancellation, log message)#15

Merged
JerrettDavis merged 2 commits intofix/macos-keychain-auth-fallbackfrom
copilot/sub-pr-14
Mar 2, 2026
Merged

fix: address review feedback on macOS Keychain fallback (stderr deadlock, cancellation, log message)#15
JerrettDavis merged 2 commits intofix/macos-keychain-auth-fallbackfrom
copilot/sub-pr-14

Conversation

Copy link

Copilot AI commented Mar 2, 2026

Three correctness issues in the DefaultMacOsKeychainReader implementation flagged during review.

Changes

  • RedirectStandardError = false — redirecting stderr without draining it can deadlock if the security CLI writes enough output to fill the pipe buffer
  • NETSTANDARD2_0 cancellationTask.Run(..., ct) only cancels before the delegate starts; replaced with ct.Register(() => process.Kill()) so cancellation reliably terminates the process mid-WaitForExit(), and added ct.ThrowIfCancellationRequested() after exit to surface it to callers
  • Log message"Credentials file not found" was misleading; ReadCredentialsFileAsync returns null for I/O errors and malformed JSON too, not just missing files → "Credentials unavailable from file; trying macOS Keychain service..."

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Dependency update

Checklist

  • My code follows the project's coding standards (.editorconfig)
  • I have added/updated XML doc comments for public APIs
  • I have added tests that cover my changes
  • All new and existing tests pass (dotnet test)
  • The solution builds with zero warnings (dotnet build)
  • I have updated the documentation if needed
  • I have updated CHANGELOG.md (for user-facing changes)

Testing

Existing unit tests pass. The stderr deadlock and cancellation paths are not exercised by the current test suite (they require a live process or a hung process), but the logic follows the standard CancellationToken.Register + Process.Kill pattern.

Screenshots / Logs


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

- Fix log message: 'Credentials file not found' → 'Credentials unavailable from file; trying macOS Keychain...'
- Set RedirectStandardError = false to avoid stderr buffer deadlock
- Wire ct to kill process in NETSTANDARD2_0 branch for reliable cancellation

Co-authored-by: JerrettDavis <2610199+JerrettDavis@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix macOS Keychain fallback for Claude Code authentication fix: address review feedback on macOS Keychain fallback (stderr deadlock, cancellation, log message) Mar 2, 2026
@JerrettDavis JerrettDavis marked this pull request as ready for review March 2, 2026 17:57
@JerrettDavis JerrettDavis merged commit f335a43 into fix/macos-keychain-auth-fallback Mar 2, 2026
2 checks passed
@JerrettDavis JerrettDavis deleted the copilot/sub-pr-14 branch March 2, 2026 17:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants