Repository navigation
Conversation
The claude-native-bootstrap hook destroyed stdin and then called process.exit(0) in the same tick, which triggers a libuv win async-handle close assertion on Node 24.15.0. Route it through runSessionStartHook so the event loop drains naturally, with the unref'd backstop only as a leak guard. Refs ranxianglei#7093
ranxianglei#2943) Review addition for the Claude hook graceful-exit fix: the zcode lane already carries a spawn-level 'real entry exits 0 promptly and does not hang' test in this file; the claude lane had only the injectable-deps coverage plus manual verification. Add the claude counterpart — spawn the real src/claude-native-bootstrap.ts entry with BILLION_CONTEXT_PROXY set (plan action "exit": earliest safe return, no proxy/config side effects) and assert a prompt clean exit 0. Bounded by an 8s SIGKILL so the suite can never hang.
(ai: vllm-qwen/qwen3.8-27b) 查重: 不重复 — 与 #2943 (issue) / #2946 (PR) 同一机制:那两条已修复 zcode/kimi 车道的同型 标签: bug, claude-code, scope/wiring, p2 — Windows + 早期 Node 24.x 上 hook 可见失败,但 proxy 已附着、压缩功能不受影响,故 p2。 Review in progress — initial findings:
CI: the original head ( |
(ai: vllm-qwen/qwen3.8-27b) Review complete — verdict: mergeable (可合). The fix routes the Claude SessionStart hook through the same 8问:
CI:最终 head Review 顺带补强(已推至 PR 分支):commit 判定:可合——方向正确(修根因非症状)、回归干净、测试双向钉住、CI 绿。 |
Fixes #7093
What & why
On Windows + Node v24.15.0, Claude Code's SessionStart hook aborts after the proxy attaches:
Exit code is
-1073740791(0xC0000409). The proxy attach succeeds, but the hook process aborts during teardown, so Claude marks the whole SessionStart hook as failed.Root cause:
hookMainWithDepsdestroyed stdin and then called the defaultprocess.exit(0)in the samefinally. On Windows + early Node 24.x, that races libuv's win async-handle close path and trips the assertion. This is the same mechanism fixed for zcode/kimi in #2943 / #2946; the Claude hook had been left untouched as lower risk, but Node v24.15.0 reproduces it.Fix
Route the Claude SessionStart hook through the existing
runSessionStartHook():process.exitCode = 0, and let the event loop drain to a natural exit;process.exit()on the normal path;Scope / non-changes
src/claude-native-bootstrap.ts,src/agent/shared.tscomments, and two test files only.Verification
npm run typecheckclean.node --import tsx --test tests/hook-graceful-exit.test.ts: 6/6 pass.proxy attached at http://127.0.0.1:18787, exit code 0, no libuv assertion.claude -p "reply OK" --max-turns 1: outputOK, exit code 0, no SessionStart hook error.Full CI runs on the PR head.