Skip to content

fix(desktop): package agent-shutdown.mjs so the app starts - #118

Merged
chaqchase merged 2 commits into
mainfrom
fix/package-agent-shutdown
Oct 16, 2026
Merged

chaqchase merged 2 commits into
mainfrom
fix/package-agent-shutdown

Conversation

@chaqchase

Copy link
Copy Markdown
Member

Summary

v0.0.68 crashes at launch with ERR_MODULE_NOT_FOUND: …/app.asar/scripts/desktop/agent-shutdown.mjs imported from …/server-manager.mjs.

Cause: the agent shutdown sweep (P10) added scripts/desktop/agent-shutdown.mjs, which server-manager.mjs imports. But build.files lists the shipped scripts/desktop files by name, and this one was never added, so app.asar didn't contain it. No automated gate launched the packaged app, so it slipped through.

Fix:

  • Add the file to build.files.
  • Unit test: every file reachable from main through relative imports is covered by build.files.
  • Bundle audit: walk the same import graph inside the built app.asar and fail the packaging run on any missing file. Confirmed it reports agent-shutdown.mjs (imported from scripts/desktop/server-manager.mjs) when the file is absent.

v0.0.68 is marked as a pre-release, and v0.0.66 is "Latest" again, so auto-update no longer offers the broken build. This ships as v0.0.69.

Test plan

  • G0 (367 test files), plus the new package-config and audit-utils tests.
  • Unsigned build:desktop:mac with the bundle audit passing.
  • Every packaged scripts/desktop module imports from app.asar under the app's own Electron binary (ELECTRON_RUN_AS_NODE).
  • The packaged Next server boots under the app's Electron binary on a spare port with throwaway state, and serves / (200).
  • v0.0.69 publish, then launch the installed app.

🤖 Generated with Claude Code

chaqchase and others added 2 commits October 16, 2026 03:00
v0.0.68 crashed at launch with ERR_MODULE_NOT_FOUND: server-manager.mjs
imports scripts/desktop/agent-shutdown.mjs (the agent shutdown sweep), but
build.files lists the shipped scripts/desktop files by name and this one was
never added, so app.asar did not contain it.

- Add it to build.files.
- package-config test: every file reachable from the main entry through
  relative imports is covered by build.files.
- Bundle audit: walk the same import graph inside the built app.asar and
  fail the packaging run on any missing file.

Gate: G0 green; unsigned build:desktop:mac passes the audit, and the packaged
scripts/desktop modules import from app.asar under the app's own Electron
binary (ELECTRON_RUN_AS_NODE).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An OpenCode server that died during startup was reported on "exit", which
can fire before its last stderr chunk is read, so the error sometimes lost
the reason (macOS CI flaked on this test twice). Report once the pipes
close, bounded by 250 ms in case a grandchild holds them open.

Gate: G0 green (367 test files); the OpenCode server suite passed 6 runs in
a row.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chaqchase
chaqchase merged commit 1dc8cc8 into main Oct 16, 2026
8 checks passed
@chaqchase
chaqchase deleted the fix/package-agent-shutdown branch October 16, 2026 03:16
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