Repository navigation
fix(runtime): disable Wasm tier-up for Node TS runners on Linux x86_64 - #9212
loopx-agent wants to merge 2 commits into
Conversation
Add node_typescript_flags() in loopx.control_plane.runtime.node_probe and wire it into all Node --experimental-strip-types launch paths. On Linux x86_64/amd64, disabling TurboFan Wasm tier-up and dynamic tiering (--liftoff-only --no-wasm-tier-up --no-wasm-dynamic-tiering) prevents fatal V8 ThreadIsolation JIT range crashes during Amaro TypeScript stripping under Node 24. Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
loopx-agent
left a comment
There was a problem hiding this comment.
Request changes conclusion (author-owned PR; GitHub blocks formal self-review)
Reviewer: model_agent · Gemini · Google DeepMind · self_reported
English verdict: REQUEST_CHANGES
动机 / Motivation
针对 9212@4783afaf6be3ffb52f7e07e5101efd279b3fa083(exact head 4783afaf6be3ffb52f7e07e5101efd279b3fa083):运行在 Linux x86_64/amd64(特别是 QEMU/TCG 或开启 Linux PKU)上的操作者与自动化 Goal/Turn 调度器在执行 loopx CLI、Effect runtime、调度器随访或 ZCode Goal 宿主机时会触发该问题。修改前所有 Node 24 直接执行 TypeScript 的子进程都会开启 TurboFan Wasm 分层编译从而在 V8 ThreadIsolation 阶段崩溃并中断任务;修改后 10 个已接入的 Python 启动点在 Linux x86_64 上自动附加 --liftoff-only --no-wasm-tier-up --no-wasm-dynamic-tiering(非 Linux 平台保持空元组),但通过安装态 POSIX CLI 入口(scripts/loopx:74)触发的原生调度器随访仍漏传这些标志。
本 PR 在效果上集中封装了 node_typescript_flags() 并保护了 9 个 Python 模块中的 10 处启动点且保持 macOS/Windows/arm64 零变化,但未覆盖绕过 Python 的主 POSIX 启动器 scripts/loopx:74 以及 zcode_goal_mode、semantics/production.py 与 control_plane/testing/ 入口。本 PR 不修改 Node 版本探测、Windows PowerShell 启动器 scripts/loopx.ps1、Worker.execArgv(已实测 Node 会拒绝在 Worker execArgv 中传递进程级 Wasm 标志)或纯文档示例。
改动思路 / Approach
本 PR 在 loopx/control_plane/runtime/node_probe.py 引入 node_typescript_flags(*, system=None, machine=None),仅在 linux + x86_64|amd64 条件下返回 --liftoff-only --no-wasm-tier-up --no-wasm-dynamic-tiering,其余平台返回 (),从而在不污染全局 NODE_OPTIONS 的前提下为子进程定向注入 V8 稳态参数。
node_probe.node_typescript_flags() 作为单一平台判定边界归属合理,非 Linux 平台返回空元组零开销,且 effect_runtime_compile_cache.ts 的 Worker 会安全继承主进程 V8 初始化配置而不能在 Worker execArgv 中传入进程级 Wasm 标志。我们在本地 Node v24.21.0 中实测证实,给 new Worker(..., { execArgv }) 显式传入这 3 个标志会同步抛出 Initiated Worker with invalid execArgv flags,因此保留 effect_runtime_compile_cache.ts:86 不改是正确的。
关于当前边界:已建立清晰的核心判定函数与 10 处 Python 启动点,但作为全路径修复仍遗漏 POSIX 启动器 scripts/loopx:74、zcode_goal_mode、semantics/production.py 与 control_plane/testing/ 入口,需补齐上述调用链与跨平台验证后再合入。
具体改动 / Changes
本次共涉及 12 个文件(+138/-7),我们在独立只读 worktree 对提交头 4783afaf6be3ffb52f7e07e5101efd279b3fa083 完成全量审查:
- 已接入路径(10 个生产启动点 + 2 个测试文件):
node_probe.py新增node_typescript_flags();- 将
*node_typescript_flags()接入effect_runtime.py(TCP daemon 与 stdio runtime)、entrypoint.py(_native_scheduler_followup_argv)、quota/scheduler_ack.py、state_recovery_io.py、host_process_transport.py、delegation_preview_transport.py、remote_authority_gateway.py、extensions/turn_host.py与usage_ping.py。
- Blocking Finding 1(P1)— 主 POSIX CLI 启动器
scripts/loopx:74绕过 Python 入口且漏传参数:scripts/install-local.sh安装后的 POSIXloopxCLI 直接软链至scripts/loopx。其第 74 行在 Python 启动前拦截带收据绑定的quota scheduler-ack-current与scheduler-fail-current并直接exec node --no-warnings --experimental-strip-types heartbeat_followup_cli.ts。使用模拟uname -s=Linux/uname -m=x86_64实跑复现,返回argv_head=['--no-warnings', '--experimental-strip-types', '.../heartbeat_followup_cli.ts'],全部 3 个 V8 标志缺失;test_scheduler_native_launcher.py也仍断言旧的 3 参数前缀。- 最小修复:在
scripts/loopx第 74 行前判断Linux+x86_64|amd64并注入该 3 个标志,并更新test_scheduler_native_launcher.py。
- Blocking Finding 2(P1)— 多处活动运行时、语义门禁与 E2E 启动点漏接:
loopx/zcode_goal_mode/bridge.py:277与cli.ts:155, 274(TSspawn(process.execPath, ...)新建子进程不会继承这些 V8 标志)、loopx/semantics/production.py:295, 340(settlement_binding_witness.mts、quota_run_decision_witness.mts)以及loopx/control_plane/testing/{canary_harness.py:305, authority_e2e_ladder.py:210,349,459, authority_e2e_fixtures.py:543}均未加标志;同时建议顺手抽出共享node_typescript_argv辅助函数替代 10 处手写拼装。
对主干的风险 / Risks
在 macOS arm64 环境对 exact head 4783afaf6be3ffb52f7e07e5101efd279b3fa083 完成独立验证(wait_for_ci: false,未查/等待远端 CI):
tests/control_plane/test_effect_runtime_node_probe.py、test_source_cli_entrypoint.py与test_scheduler_native_launcher.py(-k "not launch_and_binds_or_slow"):89 passed, 13 skipped(13 个 skip 均为 macOS 无 PowerShell 所致);- 专项筛查(
node_typescript or scheduler or strip_types or probe):56 passed, 13 skipped;test_usage_ping.py+test_cli_entrypoint.py:80 passed;test_control_plane_import_boundaries.py+ probe:37 passed; ruff check与仓库配置uv run --extra test python -m mypy通过(Success: no issues found in 17 source files);loopx check --scan-path全数 12 个改动文件errors=0;Node v24.21.0 实测同时携带--experimental-sqlite --use-env-proxy --experimental-strip-types --liftoff-only --no-wasm-tier-up --no-wasm-dynamic-tiering启动输出node-flags-ok。- 主干剩余风险:若在未补齐
scripts/loopx:74、ZCode、语义见证与 E2E 启动点前合入,Linuxx86_64已安装 CLI 的原生调度随访、zcode-goal与 premerge 语义检查仍暴露在 V8 ThreadIsolation 崩溃风险下,且除effect_runtime.py外其余 8 个已改 Python 文件仍缺乏linux/x86_64模拟单测覆盖。
我的整体评价 / Verdict
node_typescript_flags() 机制本身边界清晰、非 Linux 平台零回归且 Worker.execArgv 语义处理得当;但因其核心前提“覆盖全部 --experimental-strip-types 启动路径”在安装态 POSIX 启动器 scripts/loopx:74 与 zcode_goal_mode / semantics/production.py / testing/ 上尚有明显断点并已在本地复现缺失,本次给出 REQUEST_CHANGES。
- Visual Review:CLI/runtime Node process argv flag injection only; no rendered UI surface changed. Unverified Scope:Real Linux x86_64 QEMU/TCG crash reproduction is outside this macOS arm64 verification host; verified flag assembly, Node v24.21.0 CLI acceptance, Worker execArgv constraints, and scripts/loopx Linux x86_64 omission locally.
- 后续建议:补齐
scripts/loopx:74、ZCode/semantics/testing 启动点并补充模拟linux/x86_64回归测试后,即可重新提交复核。
…de, semantics, and testing callers Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
Summary
node_typescript_flags()inloopx/control_plane/runtime/node_probe.pyreturning("--liftoff-only", "--no-wasm-tier-up", "--no-wasm-dynamic-tiering")on Linuxx86_64/amd64(empty tuple on other platforms/architectures).*node_typescript_flags()into Node--experimental-strip-typesinvocation sites acrossloopx/control_plane/(TCP + stdio effect runtime, host process transport, delegation preview, remote authority probe, scheduler ack, state recovery),loopx/entrypoint.py,loopx/extensions/turn_host.py, andloopx/usage_ping.py.x86_64Node v24.21.0 running Amaro's Wasm-based--experimental-strip-typescompiler, V8 Wasm dynamic tiering crashes insideThreadIsolation::StartOfJitAllocationAt(Runtime_WasmTriggerTierUp->StackFrameIterator::Advance->GcSafeFindCodeForInnerPointer). Disabling Wasm tier-up + dynamic tiering (--liftoff-only --no-wasm-tier-up --no-wasm-dynamic-tiering) eliminates the crash without modifying the pinnednodebinary.tests/control_plane/test_effect_runtime_node_probe.pyand align CLI argv expectations intests/control_plane/test_source_cli_entrypoint.py.Verification
origin/mainworktree):pytest -q tests/control_plane/test_effect_runtime_node_probe.py tests/control_plane/test_effect_runtime_compile_cache.py tests/control_plane/test_effect_runtime_listener_startup.py tests/control_plane/test_source_cli_entrypoint.py:88 passedpytest -q benchmark/tests/test_proxy_order.py benchmark/tests/test_shared_codex_runtime.py benchmark/tests/test_task_entry.py:184 passed, 126 skippedpytest -q tests/capabilities/test_provider_gateway_proxy.py tests/control_plane/test_benchmark_planning_batch.py:9 passed(test_original_task_entry.pyfailed pre-existing10/10identically on unmodifiedorigin/maind28ec76f42)ruff checkon all 12 changed files:All checks passed!mypy --follow-imports=silenton 9 typed files:Success: no issues found in 9 source files(excludingdelegation_preview_transport.py, which has 13 preexisting untyped lines outside the diff)loopx check --scan-path ...on all 12 changed files:ok=true,errors=0,public_boundary_scan.ok=trueloopx canary premerge --from-git-diff --git-diff-base origin/main:gate.status=passed(direct_checks 4/4,python_compile 1/1,catalog_canaries 10/10,risk_profile_smokes 8/8)x86_64VM (node v24.21.0, untouched binary):loopx todo planoverstdio:10/10passed (vs2/3bare,5/8--wasm-jitless)test_benchmark_planning_batch.py(file/sqlitexfresh/lost-response):4 passed