Repository navigation
Fix Claude sidebar resume config dir - #4116
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughThis PR threads an explicit ChangesClaude Resume Config Directory Threading
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related issues
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 15 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (15 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 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 |
Greptile SummaryFixes the Claude sidebar resume command to stop emitting
Confidence Score: 5/5Safe to merge — the change is deterministic and narrowly scoped to resume command construction. The fix correctly moves config-dir determination to indexing time, shares the predicate between root filtering and command generation, and handles cache-hit overrides on both code paths. No production data or auth state is mutated; the only observable change is whether CLAUDE_CONFIG_DIR appears in the sidebar-generated resume command. Tests cover the key invariants: unconfigured roots omit the env var, null/empty auth fields are treated as unconfigured, and configured non-default roots still emit it. No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[claudeSessionRoots] --> B{appendRoot called for each root}
B --> C[ClaudeConfigurationRoot.configuredResumeDirectory]
C --> D[preferredPath: standardize dir]
D --> E[isLikelyConfigured: read .claude.json]
E --> F{has oauthAccount / primaryApiKey / apiKey?}
F -- No/null/empty --> G[resumeConfigDirectory = nil]
F -- Yes --> H[resumeConfigDirectory = standardized path]
G --> I[ClaudeSessionCandidate resumeConfigDirectory = nil]
H --> I
I --> J{Cache hit?}
J -- Yes --> K[cached.withClaudeConfigDirectoryForResume candidate.resumeConfigDirectory]
J -- No --> L[Parse transcript, build SessionEntry with configDirectoryForResume from candidate]
K --> M[SessionEntry with correct configDirectoryForResume]
L --> M
M --> N[resumeCommandWithoutWorkingDirectory]
N --> O{configDirectoryForResume == nil?}
O -- Yes --> P[claude --resume id, no env prefix]
O -- No --> Q[env CLAUDE_CONFIG_DIR=dir ... claude --resume id]
Reviews (6): Last reviewed commit: "fix: ignore empty Claude auth state" | Re-trigger Greptile |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 71f5415. Configure here.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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 `@Sources/SessionIndexModels.swift`:
- Around line 225-227: The current check treats mere presence of keys as
"configured"; update the condition that returns whether a session is configured
to verify each value is neither null/NSNull nor empty: for obj["oauthAccount"],
obj["primaryApiKey"], and obj["apiKey"] ensure the stored value is non-nil, not
an explicit null/NSNull, and for string values not an empty/whitespace string
(or for collections not empty) before considering it configured; replace the
simple != nil checks with these stricter validations so null/empty auth fields
are treated as unconfigured.
🪄 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
Run ID: a5bf74bf-56b2-4743-b1bf-d107aa3d1130
📒 Files selected for processing (5)
Sources/SessionIndexModels.swiftSources/SessionIndexStore.swiftcmuxTests/ClaudeConfigDirectoryPathTests.swiftcmuxTests/SessionIndexViewTests.swiftcmuxTests/SessionPersistenceTests.swift
Dismissed as stale: the requested null/empty Claude auth-state handling was addressed in 42ff59e via ClaudeConfigurationRoot.hasConfiguredAuthValue and covered by testConfiguredResumeDirectoryIgnoresNullAndEmptyAuthFields. CodeRabbit's latest check on HEAD is passing.

Summary
CLAUDE_CONFIG_DIRunless the inferred transcript root contains populated Claude operational state.Reproduction
Local deterministic command-construction path for a canonical
~/.claude/projects/...transcript path.Observed before fix:
env CLAUDE_CONFIG_DIR=/Users/<user>/.claude ... claude --resume <id>redirects Claude operational state to~/.claude/.claude.jsonand triggers first-run setup.Expected after fix: canonical unconfigured
~/.claudetranscript roots do not emitCLAUDE_CONFIG_DIR, so Claude falls back to~/.claude.jsonin HOME. Non-default roots still emitCLAUDE_CONFIG_DIRwhen<root>/.claude.jsoncontains auth state.Cloud Mac/video: not used because this is a deterministic model/command-construction bug, not a visual or layout issue.
Fixes #4087
Note
Medium Risk
Changes Claude session indexing and resume command construction to conditionally set
CLAUDE_CONFIG_DIRbased on parsed on-disk auth state, which could affect whether existing sessions resume with the expected Claude account/config root.Overview
Fixes Claude session resume to only export
CLAUDE_CONFIG_DIRwhen the inferred config root appears configured (i.e., has non-empty auth state in.claude.json), preventing sidebar resumes from triggering first-run setup for canonical but unconfigured~/.clauderoots.This threads a per-session
configDirectoryForResumethroughAgentSpecifics.claude, propagates it from Claude session root discovery/candidate generation (including cache hits), removes the old file-URL-derived config-dir inference, and adds/updates tests covering configured vs unconfigured roots and null/empty auth fields.Reviewed by Cursor Bugbot for commit 42ff59e. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by CodeRabbit
Bug Fixes
Tests