Skip to content

fix(cli): init no longer crashes copying into a folder at a Windows drive root - #7220

Merged
miguel-heygen merged 2 commits into
mainfrom
fix/cli-init-drive-root
Nov 5, 2026
Merged

miguel-heygen merged 2 commits into
mainfrom
fix/cli-init-drive-root

Conversation

@miguel-heygen

Copy link
Copy Markdown
Collaborator

What

hyperframes init into a folder directly under a Windows drive root (init D:\my-video) no longer crashes. It used to end with exit code -1073740791 (0xC0000409) and write no project files. The same command with the target one folder deeper, or on a subst drive, worked.

Why

Users on Windows reported it, with the workaround "init on C: then move". Init makes the project folder first and then copies the template into it. Node's fs.cpSync kills the process when its destination is a folder that already exists directly under a drive root, with or without a filter. That holds on C:, D: and an attached virtual disk alike, and with NTFS, ReFS, exFAT and FAT32. A destination that does not exist yet, or one a level deeper, copies fine.

Related work

None open. copyDirSync passed a filter to keep Node off its native copy, which wrote nothing under a non-ASCII path on Windows (init.nonAsciiPath.test.ts). A filtered cpSync still runs into the same crash.

How

copyDirSync, the CLI's one directory copy (init's template and the skills mirror), copies with readdirSync, mkdirSync and copyFileSync, merging into what is there and keeping symlinks as symlinks. It no longer calls fs.cpSync. Its options parameter had no caller and is gone.

compare.ts and the media-use recipe store still call cpSync, into temp folders and the user's ~/.hyperframes, never a drive root. They are left alone.

Test plan

  • Unit tests added/updated: copyDir.test.ts copies a tree with non-ASCII names into a folder that already holds files. On Windows only, it also copies into an existing folder directly under the temp folder's drive root. That case fails without the fix: on windows-latest, with the old copyDirSync, the Vitest worker dies ("Worker exited unexpectedly").
  • Manual testing performed: on windows-latest with Node 22, the published 0.9.13 init C:\hfroot-… and init D:\hfroot-… into existing root folders exit 0xC0000409 with no files. This branch's CLI exits 0 with the six project files in each. copyDir, init, init.nonAsciiPath and skillsMirror tests pass on windows-latest. oxfmt and oxlint pass on the changed files.
  • Documentation updated (if applicable): no user-facing flag or behaviour changes beyond the fix.
  • Comments follow CONTRIBUTING.md "Comments": copyDirSync's comment says why it does not use fs.cpSync and which destination crashes it.

Not exercised: Node 24 directly. The same crash was reported from an app that runs the CLI on Node 24.

Size

About 60 lines: one helper and its test. A lone fix for a crash no open PR touches, so nothing can carry it.

@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Edit accuracy: accurate 267 (base branch 267), smooth 128 of those

The gate passes.
Smoothness is reported in the artifact, not gated. A case fails only if it fails 2 of 3 runs.

Quarantined, measured but not gated (8)

@heygengenesis heygengenesis Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving at 7e22db77. I found no blocker.

What I checked

  • Fails-without-the-fix line: the Test plan bullet carries it. It names the test (copyDir.test.ts, "copies into an existing folder directly under a drive root") and the failure on windows-latest with the old copyDirSync ("Worker exited unexpectedly"). I can't run Windows from here, so I'm relying on the body's windows-latest evidence for that half.
  • CI at this head is all green. The Windows engine-cli job ran both new tests and both passed ✓, including copies into an existing folder directly under a drive root.
  • Linux local run passes: copyDir, skillsMirror and all init* tests (114 passed, 2 skipped as Windows-only).
  • Callers: init makes destDir and then merges the template into it. copyFileSync overwrites the same way cpSync's default force did, and existing user files are kept; the new test covers that. skillsMirror.linkOrCopy runs rmSync on the target first, so the copy always lands in an empty folder.
  • Symlinks: there are none under the templates or the skills, so the change in symlink handling doesn't affect today's inputs.

Non-blocking

  • If the destination already has an entry with the same name, symlinkSync throws EEXIST, where cpSync used to replace it. No caller hits this today.
  • A relative symlink is now copied exactly as written. cpSync (with verbatimSymlinks: false) rewrote it to an absolute path, so a relative link that points outside the copied tree would now break.
  • Both are worth a line in the doc comment if a symlinked template ever shows up.

@miguel-heygen
miguel-heygen added this pull request to the merge queue Nov 5, 2026
Merged via the queue into main with commit d810bdb Nov 5, 2026
83 checks passed
@miguel-heygen
miguel-heygen deleted the fix/cli-init-drive-root branch November 5, 2026 07:18
SanHsien added a commit to SanHsien/hyperframes that referenced this pull request Nov 6, 2026
…eview

Adopts or partially adopts 8 groups: capture-failure diagnostics and
frame-capture retry in engine, ffprobe fixes, renderOrchestrator
updates, studio-server render/files/source-mutation routes, CLI
screenshot retry and init/snapshot/timeline fixes, and the motion-blur
land-then-undo path (fork seek recovery kept). Left out with ledger
reasons: heygen-com#7211 render diagnostic CLI, heygen-com#7089 reverse start; heygen-com#7220
deferred. Core packed budget grows by the measured 1065 bytes since
upstream heygen-com#7191 changed no budget. Watermark advances to 659ef56.

Co-authored-by: Miguel Ángel <miguel.sierra@heygen.com>
Co-authored-by: WaterrrForever <miao.yang@heygen.com>
Co-authored-by: Vance Ingalls <vance@heygen.com>
Co-authored-by: James Russo <james.russo@heygen.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

1 participant