fix(dev): seed lab MCP approval into the worktree, not ~/.claude.json #71
No reviewers
Labels
No labels
bug
enhancement
in-progress
needs-info
needs-triage
p0
ready-for-agent
ready-for-human
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Cloonar/nixos!71
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/lab-afk-mcp-settings-local"
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?
Symptom
A lab AFK run still stalls at startup on
New MCP server found in this project: nixos, even after #70 — reproduced live on the dev VM.Root cause
#70 seeded
enableAllProjectMcpServersinto the worktree's project entry in~/.claude.json. But claude (2.1.156) reads project MCP approval from the project-local.claude/settings.local.json, not the global config. That file is gitignored (via the global~/.config/git/ignore), so a fresh worktree inherits the tracked.mcp.jsonbut never the approval — and claude prompts with no one at the TTY to clear it.The #70 commit message actually named the right file ("the gitignored
.claude/settings.local.jsonthat holds the human's MCP approval"); the code then wrote somewhere else. The~/.claude.jsonflag is dead config for this purpose — present on the stuck worktree yet the prompt still showed.Fix
SeedTrustnow writesenableAllProjectMcpServers: trueto<worktree>/.claude/settings.local.json(the file claude actually consults), creating/merging atomically. The folder-trust seed (hasTrustDialogAccepted) stays in~/.claude.json— that part always worked (the worktree skips the trust dialog and goes straight to the MCP prompt). Being gitignored, the seeded file also stays out of the AFK agent's own commits.Internals: split into
seedFolderTrust+seedProjectMcpApprovalover sharedreadJSONObject/marshalAtomichelpers.Verification
go test ./...green;vet/buildclean; pre-commit:: fw OK..mcp.json, neither with any~/.claude.jsonentry — the one with.claude/settings.local.jsonreached the REPL silently; the one without showed the prompt. This is the check #70 lacked: its unit test passed, but the asserted config was one claude doesn't read.Notes