Skip to content

fix(desktop): sign release builds without exhausting file descriptors - #7

Merged
JUNERDD merged 1 commit into
mainfrom
fix/release-signing-emfile
Sep 28, 2026
Merged

JUNERDD merged 1 commit into
mainfrom
fix/release-signing-emfile

Conversation

@JUNERDD

@JUNERDD JUNERDD commented Sep 28, 2026

Copy link
Copy Markdown
Owner

Why

The first manual Release run (36374409286) failed in the arm64 installer job while signing:

⨯ EMFILE: too many open files, open '.../AI.app/Contents/Resources/agent-service/node_modules/...'

@electron/osx-sign (1.3.3, pinned by electron-builder 26.15.3; still unchanged in 2.7.0) walks Contents/ with an unbounded Promise.all, opening every file at once to detect binaries. The app now holds ~60.7k files (mostly the bundled service's node_modules); locally the walk needs a descriptor limit between 24,576 and 49,152, which the macOS runner doesn't allow. CI's smoke pack never signs, so this only surfaced at release time. Any signing run (ad-hoc or Developer ID) hits it.

Change

  • patches/@[email protected]: the walk visits entries one at a time. The signing list is identical (1,007 paths, same order); the walk takes ~16s instead of ~4s.
  • prepare-service-pack.mjs: the service pack's partial pnpm deploy does not install osx-sign, so that one deploy allows unused workspace patches (pnpm_config_allow_unused_patches; pnpm 12 ignores the npm_config_ spelling). The workspace-wide unused-patch check is unchanged.

Verification

  • ulimit -n 256 (hard) + pnpm --filter @ai/desktop package:installer -c.mac.identity=- -c.mac.hardenedRuntime=false on arm64: dmg, zip, blockmaps and latest-mac.yml produced; codesign --verify --deep --strict passes.
  • pnpm install --frozen-lockfile, oxfmt and oxlint on the changed files.
  • Not verified: the x64 runner and a Developer ID (notarized) signing run.

After merge, re-run the Release workflow on main to publish v0.1.0.

@electron/osx-sign walks the app bundle with an unbounded Promise.all and
opens every file at once to find binaries. The bundled agent service ships
60k+ files, so signing on the macOS release runner failed with EMFILE.
Patch the walk to visit entries one at a time; it returns the same signing
list and passes under a 256-descriptor hard limit.

The service pack's partial `pnpm deploy` does not install osx-sign, so it
allows unused workspace patches for that one deploy.
@JUNERDD
JUNERDD merged commit d865aaa into main Sep 28, 2026
2 checks passed
@JUNERDD
JUNERDD deleted the fix/release-signing-emfile branch September 28, 2026 04:41
Jirentian pushed a commit to Jirentian/Atd that referenced this pull request Nov 8, 2026
All twenty clips are re-rendered from atd-films ccd1f85 (PR JUNERDD#7), each in a single browser tab.
Frames shared among parallel tabs drew glass and scaled layers half a pixel apart, so the selection
toolbar's "Polish writing" label and the Mini Panel at the screen edge flickered every two or three
frames. The clips' content is otherwise unchanged.
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