From cabcba7146e3d45536c42fef65c2b2192b39b135 Mon Sep 17 00:00:00 2001 From: matanbaruch Date: Mon, 6 Apr 2026 11:14:43 +0300 Subject: [PATCH] fix: dereference symlinks when snapshotting sensitive paths to .claude-pr/ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `cpSync` defaults to `dereference: false`, which means it tries to recreate symlinks at the destination rather than copying file contents. When a sensitive path (e.g. CLAUDE.md) is a symlink, this fails with `ENOENT: no such file or directory, symlink` because `cpSync` attempts to call `symlink()` without ensuring the parent `.claude-pr/` directory exists first. Adding `dereference: true` fixes this by following symlinks and copying the actual file contents, which is also the correct semantic behavior — review agents need to inspect the real content, not a symlink that may not resolve correctly from `.claude-pr/`. Fixes the action crash when repositories use symlinked CLAUDE.md (e.g. CLAUDE.md -> AGENTS.md). --- src/github/operations/restore-config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/github/operations/restore-config.ts b/src/github/operations/restore-config.ts index f4fffe671..fa8bb4a9e 100644 --- a/src/github/operations/restore-config.ts +++ b/src/github/operations/restore-config.ts @@ -54,7 +54,7 @@ export function restoreConfigFromBase(baseBranch: string): void { rmSync(".claude-pr", { recursive: true, force: true }); for (const p of SENSITIVE_PATHS) { if (existsSync(p)) { - cpSync(p, `.claude-pr/${p}`, { recursive: true }); + cpSync(p, `.claude-pr/${p}`, { recursive: true, dereference: true }); } } if (existsSync(".claude-pr")) {