Skip to content

fix(worker): gate standalone init on IPC readiness - #1426

Merged
deepcoldy merged 1 commit into
deepcoldy:masterfrom
xinna2001:fix/standalone-worker-first-turn-ipc
Sep 17, 2026
Merged

deepcoldy merged 1 commit into
deepcoldy:masterfrom
xinna2001:fix/standalone-worker-first-turn-ipc

Conversation

@xinna2001

Copy link
Copy Markdown
Contributor

Summary

  • boot compiled standalone workers through a small entry module that installs the IPC preload before loading the CLI graph
  • add a probe/ready handshake and hold standalone worker messages in FIFO order until the preload is listening
  • start ordinary-IM delivery timers only after the real init is sent, with a bounded 30-second fallback
  • leave the existing Node fork/preload path unchanged

Root cause

The Node worker path injects worker-ipc-preload.js through execArgv, but the compiled standalone path re-execs the binary and necessarily drops execArgv. A large first-turn init payload can therefore hit IPC backpressure while the standalone worker is still loading. The daemon's two 2-second delivery attempts can expire before the full worker registers its message handler, so the first turn reports a delivery failure even though later turns work once the worker is warm.

Verification

  • vitest run --project unit test/worker-ipc-preload.test.ts test/session-lifecycle-start.test.ts --maxWorkers=1: 199 passed
  • npm run build: passed
  • compiled host standalone binary and ran --version: passed
  • compiled-binary stress check with a 3-second stopped child and a 2 MiB init payload: init was released only after IPC readiness; send callback completed in 556 ms and worker receipt arrived in 558 ms

The full parallel unit run was not clean on this host because several long-running integration files timed out or hung under load. Two representative failures were rerun with --maxWorkers=1 against both this branch and untouched origin/master; both reproduced identically on the base branch (the macOS /var vs /private/var worktree assertion and the TraeX native-title 14-second timeout).

@deepcoldy deepcoldy left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

首审 + 复审均 0 阻断。已在最新主干(含 #1362)上本地 rebase 复验:无冲突、PR 净编辑逐字节不变、tsc build exit 0、重叠面 8 文件 644 通过(1 项 darwin-only 跳过)。编译态真机握手实测证实缺陷为真,作者自带测试变异对照 4/4 红。

@deepcoldy
deepcoldy merged commit 88f1603 into deepcoldy:master Sep 17, 2026
9 checks passed
ITcathyh pushed a commit to ITcathyh/botmux that referenced this pull request Sep 17, 2026
并入 deepcoldy#1362 只读长程任务受限续跑、deepcoldy#1426 worker IPC 就绪门、
deepcoldy#1228 traex Backend Variant 边界、deepcoldy#1431 create-group --chat-mode。

冲突两处,均为路由联合双方各加一个成员,取并集:
- src/cli.ts postSessionCliIpc route:本 PR rename + 上游 continuation
- dashboard-ipc-server.ts 窄认证路由正则:同上

build 通过;上游侧 17 文件 1024 passed、PR 侧 23 文件 614 passed。

Co-Authored-By: Claude Code <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

🚀 Released in v3.24.0

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.

2 participants