Skip to content

fix: preserve symlinks in .config/ during restore to prevent ENOENT on dangling links#1327

Open
anishesg wants to merge 1 commit into
anthropics:mainfrom
proudhare:fix/ph-issue-1321
Open

fix: preserve symlinks in .config/ during restore to prevent ENOENT on dangling links#1327
anishesg wants to merge 1 commit into
anthropics:mainfrom
proudhare:fix/ph-issue-1321

Conversation

@anishesg
Copy link
Copy Markdown

The restoreConfigFromBase function crashes with ENOENT when .config/ contains symlinks pointing to files that don't exist yet (e.g., symlinks into dependency directories before installation).

The root cause is on line 89 of src/github/operations/restore-config.ts, where cpSync is called with dereference: true. This option forces Node.js to follow symlinks and stat their targets, causing the copy operation to fail when the target doesn't exist.

The fix changes dereference: true to dereference: false, which preserves symlinks as-is without attempting to resolve them. This allows dangling symlinks in .config/ to be copied to .config-pr/ and later restored from the base branch without crashing. The symlinks can resolve naturally after dependency installation later in the workflow.

A regression test was added to verify that dangling symlinks in .config/skills/ no longer cause the restore step to crash.

Fixes #1321

…n dangling links

The `restoreConfigFromBase` function crashes with ENOENT when `.config/` contains symlinks pointing to files that don't exist yet (e.g., symlinks into dependency directories before installation).

Signed-off-by: anish <anishesg@users.noreply.github.com>
@anishesg anishesg marked this pull request as ready for review May 20, 2026 02:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

restoreConfigFromBase crashes on dangling symlinks in .claude/ directory

1 participant