You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
RPC mode: resuming an existing session on Windows crashes with libuv assertion (0xC0000409) during shutdown #9507
On Windows, pi in RPC mode exits with 3221226505 (0xC0000409) instead of 0, ~20–40 ms after agent_settled, even though the turn completed and the session JSONL was fully written. stderr:
Assertion failed: !(handle->flags & UV_HANDLE_CLOSING), file src\win\async.c, line 94
Reproduced 4/5 resume runs using an ordinary auto-exit extension. This looks like the known Node.js bug nodejs/node#56645, fixed by nodejs/node#61999 ("Ignore PostDelayedTask after Stop"): the fix is not in Node v24.19.0 but is in v24.20.0+ (v24.20.0 changelog lists PR #61999). pi's RPC host shutdown calls process.exit(exitCode) right after runtimeHost.dispose(); on Node v24.19.0 that can hit the assertion. Same class as the #5805 workaround for pi update --self (return from main() and let Node drain instead of immediate process.exit(0)).
Environment: Windows 11 Pro, version 10.0.26200 (build 26200); Node v24.19.0 (libuv 1.52.1); pi 0.85.1 (npm global install); Git Bash, headless spawn.
Steps to reproduce
Save autoexit.ts (all it does is shut the RPC process down after the turn):
Run pi --mode rpc --model <model> --session <existing-session.jsonl> -e autoexit.ts.
Send {"id":"1","type":"prompt","message":"say hi"} on stdin and wait for agent_settled; the process exits on its own.
Expected behavior: exit code 0.
Actual: exit code 3221226505; assertion above on stderr, ~20–40 ms after agent_settled; the session file already contains the final assistant message at crash time.
Evidence
One raw run: agent_settled at t+2574 ms → assertion at t+2598 ms → exit 3221226505.
Node v24.19.0: 4/5 resume runs crashed with the minimal extension. Node v24.21.0: 0/8 crashes with the identical repro.
v24.21.0's src/node_platform.cc contains the #61999 guard (if (has_shut_down_) return; in PostDelayedTask); v24.19.0 does not.
Not extension-caused beyond triggering pi's own shutdown: the repro extension contains no third-party code, and both RPC exit paths reach the same shutdown() → process.exit() (the ctx.shutdown() flag is consumed on agent_settled; stdin end calls the same shutdown).
Without any extension I could not trigger it in 16 EOF runs today, but earlier runs on this machine (same pi/Node) crashed on EOF too; the timing window is narrow and an auto-exit hook hits it consistently.
Version: pi 0.85.1
Impact: on Node v24.19 (LTS at the time) a Windows RPC session that shuts down via auto-exit/EOF can be reported to orchestrators as a crashed child despite a completed turn; resume is the common path for sub-agent-style usage.
This issue was auto-closed. All issues from new contributors are auto-closed by default.
Maintainers review auto-closed issues daily and reopen worthwhile ones. Issues that do not meet the quality bar in CONTRIBUTING.md will not be reopened or receive a reply.
If a maintainer replies lgtmi on one of your issues, your future issues will stay open. If a maintainer replies lgtm, your future issues and PRs will stay open. The command must be at the start of the reply (optionally after one or more @username mentions) or at the end.
Activity
github-actions commentedon Sep 11, 2026
This issue was auto-closed. All issues from new contributors are auto-closed by default.
Maintainers review auto-closed issues daily and reopen worthwhile ones. Issues that do not meet the quality bar in CONTRIBUTING.md will not be reopened or receive a reply.
If a maintainer replies
lgtmion one of your issues, your future issues will stay open. If a maintainer replieslgtm, your future issues and PRs will stay open. The command must be at the start of the reply (optionally after one or more@usernamementions) or at the end.See CONTRIBUTING.md.