Repository navigation
Preserve Claude secure storage config dir on restore - #9416
austinywang wants to merge 2 commits into
Conversation
📝 WalkthroughWalkthroughChangesClaude environment restore
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Suggested reviewers: Important Pre-merge checks failedPlease resolve all errors before merging. Addressing warnings is optional. ❌ Failed checks (1 warning, 2 inconclusive)
✅ Passed checks (22 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
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. Comment |
0da30ac to
1c12b1d
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@Packages/macOS/CMUXAgentLaunch/Sources/CMUXAgentLaunch/AgentLaunchEnvironmentPolicy.swift`:
- Around line 168-172: Update the environment-kind handling around the
normalizedKind cleanup so a nil kind cannot preserve Claude-only state. Require
a selected kind before replaying Claude-only environment data, or route nil
through the existing removal loop for claudeOnlyEnvironmentKeys, including
CLAUDE_SECURESTORAGE_CONFIG_DIR, while preserving the current behavior for
recognized Claude and non-Claude kinds.
- Around line 63-67: Update AgentRestorePlanner to use a shared Claude-kind
predicate based on claudeEnvironmentKinds when emitting
CMUX_PRESERVE_CLAUDE_AUTH_SELECTION_ENV in
restoredEnvironment(for:request:kind:). Ensure claudeteams and claude-teams
receive the marker whenever CLAUDE_CONFIG_DIR or CLAUDE_SECURESTORAGE_CONFIG_DIR
is selected, matching selectedRestoreEnvironment(from:kind:).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: be01fb2d-66c3-45a1-9f00-324743e7698e
📒 Files selected for processing (7)
CLI/CMUXCLI+SessionsListForkStartupInput.swiftCLI/cmux.swiftPackages/macOS/CMUXAgentLaunch/Sources/CMUXAgentLaunch/AgentLaunchEnvironmentPolicy.swiftPackages/macOS/CMUXAgentLaunch/Sources/CMUXAgentLaunch/AgentRestorePlanner.swiftPackages/macOS/CMUXAgentLaunch/Tests/CMUXAgentLaunchTests/AgentLaunchEnvironmentPolicyTests.swiftSources/RestorableAgentSession.swiftcmuxTests/CLINotifyProcessIntegrationRegressionTests.swift
ea8d91a to
34666b4
Compare
34666b4 to
2725164
Compare
Bugbot is paused — on-demand spend limit reachedBugbot uses usage-based billing for this team and has hit its on-demand spend limit. A team admin can raise the spend limit in the Cursor dashboard, or wait for the next billing cycle to continue. |
Fixes #9412
Summary
origin/main, which now contains PR Preserve CLAUDE_SECURESTORAGE_CONFIG_DIR across agent restore #9419's minimalCLAUDE_SECURESTORAGE_CONFIG_DIRallowlist change.AgentLaunchEnvironmentPolicyso app restore, CLI resume binding, and session-list startup input mark the same replayed keys inCMUX_PRESERVE_CLAUDE_AUTH_SELECTION_ENV_KEYS.CLAUDE_SECURESTORAGE_CONFIG_DIRrecordCMUX_CLEAR_CLAUDE_AUTH_SELECTION_ENV_KEYS=CLAUDE_SECURESTORAGE_CONFIG_DIR, and restore/wrapper paths clear inherited ambient secure-storage only for that explicit marker.Claude auth-selection marker decision
CLAUDE_SECURESTORAGE_CONFIG_DIRbelongs in the narrower Claude auth-selection marker list because it selects which Claude credential store is read, in the same account-selecting class asCLAUDE_CONFIG_DIR.I did not add it to the wrapper's broad stale-auth scrub list for fresh launches. Fresh
cmux claudeor third-party Claude launches should be allowed to inherit an intentional secure-storage selector. The wrapper now clears it only when cmux captured an explicit absence marker for a restore. Existing records without the marker cannot distinguish “absent at launch” from “dropped by the old allowlist bug,” so this PR avoids inventing that state retroactively.Tests
edb1166406 Add Claude secure storage env regression tests2725164917 Preserve Claude secure storage config dirswift test --package-path Packages/macOS/CMUXAgentLaunch --filter 'AgentLaunchEnvironmentPolicyTests|AgentRestoreLaunchTests/structuredClaude'swift test --package-path Packages/macOS/CMUXAgentLaunchpython3 tests/test_claude_wrapper_hooks.pyxcodebuild -project cmux.xcodeproj -scheme cmux-unit -configuration Debug -destination 'platform=macOS' -derivedDataPath /tmp/cmux-claude-securestorage test -only-testing:cmuxTests/CLINotifyProcessIntegrationRegressionTests/testClaudePromptSubmitResumeBindingPersistsSafeAuthSelectionValues -only-testing:cmuxTests/CLINotifyProcessIntegrationRegressionTests/testClaudePromptSubmitResumeBindingMarksAbsentSecureStorageConfigDirForClearinggit diff --check origin/main...HEAD./scripts/reload.sh --tag claude-securestorageTagged build: http://127.0.0.1:17320/claude-securestorage
Localization audit: no user-facing strings changed.