Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
fix: teach pr-reviewer Stage 3 the sandbox-protected .claude/ apply fallback (#5963)
Adam Eivye72270ab4a28
diff --git a/server/lib/providerVendors.js b/server/lib/providerVendors.jsindex 89348942cf..913324f18f 100644--- a/server/lib/providerVendors.js+++ b/server/lib/providerVendors.js@@ -500,6 +500,18 @@ const CLAUDE_PUBLIC_REVIEW_NO_TOOL_ARGS = [// tree and the empty domain allowlist denies every network request — in// `--print` mode a denied request is simply not executed, there is nobody to// approve it. The web tools are denied outright for the same reason.+//+// `sandbox.filesystem.allowWrite` (a real, current setting) does NOT reach a+// PR that edits `.claude/skills`, `.claude/agents`, `.claude/commands`,+// `.claude/hooks`, `.claude/workflows`, or `.mcp.json` — Claude Code's docs+// state plainly that these are "protected paths" and "there is no way to+// exempt one of them: an allowWrite entry ... doesn't lift the protection."+// (docs.claude.com/en/docs/claude-code/sandboxing, "Protected paths"). The+// only way to lift it is `sandbox.filesystem.disabled`, which turns off+// filesystem isolation for every path — defeating the point of sandboxing an+// untrusted PR's patch. So the Stage 3 review prompt (`pr-reviewer-review` in+// taskPromptDefaults/prompts.js) is taught the `git apply --cached` ++// index-verification fallback instead (#5963).const CLAUDE_SANDBOX_SETTINGS = JSON.stringify({sandbox: { enabled: true, autoAllowBashIfSandboxed: true, network: { allowedDomains: [] } },});diff --git a/server/services/taskPromptDefaults.test.js b/server/services/taskPromptDefaults.test.jsindex 477cd4b41f..a1f91daa6a 100644--- a/server/services/taskPromptDefaults.test.js+++ b/server/services/taskPromptDefaults.test.js@@ -992,4 +992,25 @@ describe('taskPromptDefaults integrity snapshot', () => {expect(PROMPT_VERSIONS[stageKey]).toBeUndefined();expect(PREVIOUS_DEFAULT_PROMPTS[stageKey]).toBeUndefined();});++ // #5963: Claude Code's sandbox permanently denies working-tree writes under+ // `.claude/skills`, `.claude/agents`, `.claude/commands`, `.claude/hooks`,+ // `.claude/workflows`, and `.mcp.json` — no `sandbox.filesystem.allowWrite`+ // setting can lift it (see the comment on CLAUDE_SANDBOX_SETTINGS in+ // providerVendors.js). A patch touching only those paths (e.g. a docs-only+ // skill edit) fails `git apply` in the working tree even though the review+ // is otherwise clean, so Stage 3 must know the `git apply --cached` ++ // index-verification fallback instead of guessing between `approve` and+ // `defer`.+ it('pr-reviewer-review teaches the git apply --cached fallback for sandbox-protected .claude/ paths', () => {+ const current = DEFAULT_TASK_PROMPTS['pr-reviewer-review'];+ expect(current).toContain('.claude/skills');+ expect(current).toContain('.claude/agents');+ expect(current).toContain('.claude/commands');+ expect(current).toContain('.claude/hooks');+ expect(current).toContain('git apply --cached -- <patch>');+ expect(current).toContain('git show :<path>');+ expect(current).toContain('never by reading the\n working-tree file');+ expect(current).toContain('never `defer` for this reason alone');+ });});diff --git a/server/services/taskPromptDefaults/integrity.snapshot.json b/server/services/taskPromptDefaults/integrity.snapshot.jsonindex 729cc5999d..f3609e41f6 100644--- a/server/services/taskPromptDefaults/integrity.snapshot.json+++ b/server/services/taskPromptDefaults/integrity.snapshot.json@@ -29,7 +29,7 @@"plan-task": "b85fe92999aa4ee4a8910320457c4242","pr-reviewer": "679680b3b382aeb6786df01c4d1a90c6","pr-reviewer-eligibility": "ba358b2bb9380e2b7d9117969607231f",- "pr-reviewer-review": "4b0621340de017adebf06229259ff22d",+ "pr-reviewer-review": "78e75a273c62e6530f1a98a8dad4821e","pr-reviewer-security": "d1e99626b12939ee39ab38eaa7d23f59","pr-watcher": "53ead8e26d396849bfa78f28550bd691","react-lifecycle": "14b3816d1bcc10f0d7d6357e55cc5e69",diff --git a/server/services/taskPromptDefaults/prompts.js b/server/services/taskPromptDefaults/prompts.jsindex 26243bd584..22e8bde71e 100644--- a/server/services/taskPromptDefaults/prompts.js+++ b/server/services/taskPromptDefaults/prompts.js@@ -2394,6 +2394,21 @@ PR state and exact content fingerprint.number to its patch. For each PR, run \`git apply --check -- <patch>\` and,if it applies, \`git apply -- <patch>\` in the disposable worktree. Neveruse \`--unsafe-paths\`, \`--3way\`, a remote ref, or a replacement patch.+ The sandbox permanently denies working-tree writes under a small set of+ Claude Code-owned paths even inside this disposable worktree — for example+ \`.claude/skills\`, \`.claude/agents\`, \`.claude/commands\`, \`.claude/hooks\`,+ \`.claude/workflows\`, and \`.mcp.json\` — and no setting can lift that+ protection from inside the sandbox. When \`git apply --check\` fails ONLY on+ those protected paths (every other file in the patch applies cleanly),+ apply the same patch to the index instead of the working tree with+ \`git apply --cached -- <patch>\`, then verify each protected file's exact+ content from the index with \`git show :<path>\` (never by reading the+ working-tree file, which the sandbox refused to write) and confirm it+ matches the patch hunk-for-hunk. That is a fully verified change, not+ partial evidence — use \`approve\` when the indexed content is correct and+ the rest of the review supports it, never \`defer\` for this reason alone.+ If \`--check\` fails for any other reason, treat the PR as unapplied under+ step 3 below.3. Inspect the resulting code and run the narrowest relevant existing tests,followed by broader tests when practical. Tests may take several minutes;completeness and trustworthy evidence matter more than throughput. If a