fix(daemon): report Windows SIGTERM daemon exits as forced
Merged
GA
3d ago+69+69+01234567890123456789-14-14-01234567890123456789
Summary
On Windows, process.kill(pid, 'SIGTERM') calls TerminateProcess immediately without running Node signal handlers or writing daemon-shutdown.json, yet stopDaemonProcess reported 'graceful'.
packages/daemon-contracts/src/daemon-process.ts:signalExitMode()mapsSIGTERMonwin32to'forced'and preservespreviousExitModeif the daemon exits beforeSIGKILL.src/__tests__/daemon-exit-wait.test.tsandsrc/__tests__/daemon-registration-owner.test.ts: parameterizelinux/win32signal exit modes and match manual stop expectations onwin32(forced/unknowncleanup confidence).src/commands/schema/cli-help.tsandwebsite/docs/docs/commands.md: qualify the 75 sdaemon stopteardown grace as non-Windows and state that Windows force-terminates (mode: "forced",cleanupConfidence: "unknown").
Touched files: 5 (+69 / -14). Rebased onto origin/main (d1ace8139 at c47c1af00); earlier prototype archived at archive/pr-4659-rpc-shutdown (d409073d1). Context: https://github.com/e2e-inc/e2e/issues/1723 (client release in https://github.com/e2e-inc/e2e/pull/1900; Windows graceful shutdown tracked in https://github.com/callstack/agent-device/issues/4822).
Before / after
Windows 11 session list --json -> daemon stop --json:
- Base (
bfc09800b):"mode": "graceful","cleanupConfidence": "unknown","The graceful shutdown report is unavailable..." - Head (
c47c1af00):"mode": "forced","cleanupConfidence": "unknown","The daemon was force-killed before provider lease state could be finalized..."
Validation
Tested at c47c1af00 on Windows 11 (globalSetup skipped due to ps not found in PATH):
daemon-exit-wait.test.ts33/33,cli-help-topics.test.ts23/23,cli-help.test.ts29/29,command-doc-coverage.test.ts6/6.check:quick,check:production-exports,check:bundle-owner-files,check:daemon-wire-compat,layering,di-seams,check-doc-prose,command-docs --check,pnpm build,smoke-daemon-clean.test.ts3/3.- CI/risks:
daemon-exit-wait.test.tsmocksprocess.platform; livewin32exit verified by CLI andsmoke-daemon-clean.test.ts.