Skip to content

Stop ewiz-mcp crashing on SIGTERM in release builds - #57

Merged
broisnischal merged 1 commit into
mainfrom
fix-mcp-sigterm-isolation
Oct 8, 2026
Merged

broisnischal merged 1 commit into
mainfrom
fix-mcp-sigterm-isolation

Conversation

@broisnischal

Copy link
Copy Markdown
Collaborator

0.18.5 and 0.18.6 still ship an ewiz-mcp that crashes (EXC_BREAKPOINT in dispatch_assert_queue) whenever an agent session ends. Reproduced against the installed 0.18.6: kill -TERM → exit 133.

Cause: the signal handler closure is written in main.swift top-level code, so under the release SDK (macOS 26.5, macos-26 runner) it inherits the main actor, and the runtime's isolation check traps on the signal source's global queue. #49 changed what the closure captured, not the closure's isolation. Local builds (SDK 27.0) don't infer the isolation, so they never crashed.

Fix: the handler is an explicit @Sendable closure inside a plain function, so it's nonisolated on every toolchain.

Guard: release.yml now SIGTERMs the packaged dist/eWiz.app/Contents/MacOS/ewiz-mcp and fails the release if it doesn't exit 0, so this is checked on the exact toolchain that ships.

Tested locally: SIGTERM/SIGINT/SIGHUP all exit 0; stdin-close path still serves and exits.

The 0.18.5 fix rebound the captured global, but the crash came from the
handler closure itself: written in main.swift's top-level code, it inherits
the main actor under the release SDK (macOS 26.5), and the runtime's
isolation check traps on the signal source's global queue. Newer local SDKs
don't, so local builds never reproduced it.

Mark the handler @sendable inside a plain function so it is nonisolated on
every toolchain, and check the packaged binary exits cleanly on SIGTERM in
the release job.
@broisnischal
broisnischal merged commit 32611bb into main Oct 8, 2026
1 check passed
@broisnischal
broisnischal deleted the fix-mcp-sigterm-isolation branch October 8, 2026 14:00
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