fix(claudecode): pin CLAUDE_CONFIG_DIR to the per-run config dir, not empty #213
No reviewers
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Cloonar/coding-lab!213
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/claude-config-dir-empty-pin"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
Since #209 landed, chat messages "never reach" a running instance: the interface spawns claude, but every reply is answered with "Not logged in · Please run /login" — the instance is unauthenticated, so from the operator's side messages silently vanish.
Root cause
The injector pinned
CLAUDE_CONFIG_DIR=(empty), relying on the compat §3a fact "an empty value behaves as unset" — which was live-probed on CLI 2.1.214 only. On the deployed 2.1.198 the resolution splits:.claude.json→ falls back to HOME (so the config-write probe passed)./.credentials.json(straced:openat(AT_FDCWD, ".credentials.json") = ENOENT)The valid OAuth copy at
<home>/.claude/.credentials.jsonwas never read. Clean differential on 2.1.198: empty pin → "Not logged in"; var unset, same HOME → authenticated.Fix
Pin
CLAUDE_CONFIG_DIR=<home>/.claudeexplicitly. Set-outranks-HOME resolves identically on every probed CLI version, and it is the directory every adapter reader already resolves under (projects/,sessions/,commands/,.credentials.json). The one moved path: the trust/onboarding/oauthAccount seed now writes<home>/.claude/.claude.json(globalConfigUnder), andseedGlobalConfigcreates the parent dir since SeedWorkspace runs before InjectCredentials in the launch order.Verification
CANARY-OK) → chat view renders the round-trip; transcript and deep-link session registry both under the pinned dir.Side finding (not fixed here, worth an issue):
labexits at startup when<state-dir>/agent.sockexceeds the ~108-char unix socket path limit (bind: invalid argument) — long state dirs break the #208 default agent socket.🤖 Generated with Claude Code