fix(dev): seed project MCP approval for lab AFK runs #70

Merged
dominik.polakovics merged 1 commit from fix/lab-afk-mcp-trust into main 2026-06-01 19:31:54 +02:00

Problem

A lab AFK run (e.g. for issue #63) launched but never started work: it sat idle on claude's startup prompt

New MCP server found in this project: nixos
  1. Use this MCP server   2. Use this and all future ...   3. Continue without

6 minutes alive, ~2s CPU — frozen with no human to clear the prompt.

Root cause

.mcp.json (which declares the nixos server) is tracked, so every git worktree add for an AFK run inherits it. But the human's approval of that server lives in .claude/settings.local.json (enableAllProjectMcpServers: true), which is gitignored and therefore absent from the fresh worktree. SeedTrust pre-accepted the folder-trust dialog but never the MCP-server prompt, so the run stalled.

Fix

Extend SeedTrust to also set enableAllProjectMcpServers: true on the worktree's project entry in ~/.claude.json — the same grant as clicking "Use this and all future MCP servers in this project", and strictly narrower than the folder-trust dialog already seeded there. Both manual and AFK spawns route through SeedTrust, so this covers any project shipping a committed .mcp.json.

Testing

  • go build ./..., go vet ./..., go test ./... all pass in hosts/fw/vms/dev/modules/lab.
  • New tests: TestSeedTrust_enablesProjectMcpServers, TestSeedTrust_enablesMcpWhenAlreadyFolderTrusted (the exact shape of the hung worktree). Updated the idempotency test to treat an entry as fully seeded only when both fields are set.
  • pre-commit eval-dry-build of fw: OK.
## Problem A lab AFK run (e.g. for issue #63) launched but never started work: it sat idle on claude's startup prompt ``` New MCP server found in this project: nixos 1. Use this MCP server 2. Use this and all future ... 3. Continue without ``` 6 minutes alive, ~2s CPU — frozen with no human to clear the prompt. ## Root cause `.mcp.json` (which declares the `nixos` server) is **tracked**, so every `git worktree add` for an AFK run inherits it. But the human's approval of that server lives in `.claude/settings.local.json` (`enableAllProjectMcpServers: true`), which is **gitignored** and therefore absent from the fresh worktree. `SeedTrust` pre-accepted the folder-trust dialog but never the MCP-server prompt, so the run stalled. ## Fix Extend `SeedTrust` to also set `enableAllProjectMcpServers: true` on the worktree's project entry in `~/.claude.json` — the same grant as clicking "Use this and all future MCP servers in this project", and strictly narrower than the folder-trust dialog already seeded there. Both manual and AFK spawns route through `SeedTrust`, so this covers any project shipping a committed `.mcp.json`. ## Testing - `go build ./...`, `go vet ./...`, `go test ./...` all pass in `hosts/fw/vms/dev/modules/lab`. - New tests: `TestSeedTrust_enablesProjectMcpServers`, `TestSeedTrust_enablesMcpWhenAlreadyFolderTrusted` (the exact shape of the hung worktree). Updated the idempotency test to treat an entry as fully seeded only when both fields are set. - pre-commit eval-dry-build of `fw`: OK.
A fresh AFK worktree inherits the tracked .mcp.json but not the gitignored .claude/settings.local.json that holds the human's MCP approval, so claude stalls on the "New MCP server found in this project" prompt with no one there to clear it — the run never starts.

Extend SeedTrust to also set enableAllProjectMcpServers on the worktree's project entry (the same grant as accepting that prompt), alongside the existing folder-trust seed. Both manual and AFK spawns go through SeedTrust, so this covers any project shipping a committed .mcp.json.
dominik.polakovics deleted branch fix/lab-afk-mcp-trust 2026-06-01 19:31:54 +02:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Cloonar/nixos!70
No description provided.