Repository navigation
fix(scheduler): block unexecuted xdt-node pre-run checks - #6237
shenjiacheng-sudo wants to merge 8 commits into
Conversation
Signed-off-by: shenjiacheng <3329362278@qq.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
[High impact] Changes how pre-run hook commands execute and validate. 合并前应先修复内部预加载代码导致 ESM 工作线程启动失败的问题。 Findings
Fix with agent prompt### Issue 1
apps/desktop/src/main/scheduler-host/pre-run-hook.ts:85-89
当 `xdt-node` 脚本创建 ESM `Worker` 时,新增的 `--import` 会随默认的 `process.execArgv` 再次执行。但主线程已经关闭 fd3,工作线程中的 `writeSync(3, ...)` 会抛出 `EBADF`,导致原本可运行的检查失败并阻止任务。本地 Node 24.21.0 验证中,主线程成功写出回执,随后工作线程在这段预加载代码中失败。
请在首次写出回执后,从 `process.execArgv` 移除这项内部预加载参数,避免后续工作线程继承,并补上回归测试。
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b1a5c8544e
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
…irection Signed-off-by: shenjiacheng <3329362278@qq.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 50bf12c0ae
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
…load forks Signed-off-by: shenjiacheng <3329362278@qq.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 190c8418ca
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
…ission flags Signed-off-by: shenjiacheng <3329362278@qq.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f83c6b09d6
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Signed-off-by: shenjiacheng <3329362278@qq.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e15be9780e
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Signed-off-by: shenjiacheng <3329362278@qq.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cb6eee7ae3
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Signed-off-by: shenjiacheng <3329362278@qq.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b83d8a7bb9
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Signed-off-by: shenjiacheng <3329362278@qq.com>
|
维护者确认门在本 PR 上拦截,需要维护者明确确认后才能进入合并流程。 触发类别(当前 blocker:security):
改动概述:xdt-node 预跑检查改为真实原生 Node + native supervisor + 正文 entered/completed 完成协议,未执行检查一律 block;打包仅保留目标 host Node 并以 allow-jit 专属 entitlement 重签。详细材料见讨论 issue:#6353 请维护者直接在 PR 上 Approve 以放行;需要作者修改则 Request Changes。 |
这次改了什么
摘要
正式包关闭 RunAsNode fuse 后,xdt-node 曾可能只启动 GUI 并以0退出;后续 preload 启动回执也不能证明实际检查正文执行,异步 preload 可提前退出,手工 replay 还会改变 Node 的 cwd/parent 解析。此版本改为真实原生 Node + 一次性 native supervisor + 正文显式 entered/completed 协议。不再注入或重放 CLI/NODE_OPTIONS preload。
宿主仅在正文完成声明、真实 Node 退出、shell退出一致为0或2时 run/skip。缺证明、提前退出、异常、冲突、超时或取消均 block;stdout/quiet、启动握手和单纯exit0不代替正文完成。协议是合作式声明,不能证明恶意同进程代码或业务逻辑正确性。
变更类型
范围
关联 Issue:定时任务前置检查:xdt-node 兜底在正式包不执行脚本且静默放行(另盼自动识别 fnm 等 node 版本管理器) #5573;修复前置检查静默放行。fnm等版本管理器发现未实现,不自动关闭整个Issue。
运行器提交:b83d8a7bb9a550da25188d1b02fe705fe627f40b,替换旧内部preload/receipt机制;处理 r4302532398、r4302532407、r4302532415。
native/pre-run-node/supervisor.c 无第三方native依赖。POSIX使用本轮独占短Unix socket、OS peer PID、nonce/ack和shell进程组;Windows源码使用当前账号ACL named pipe、Unicode argv/env、挂起创建后绑定KILL_ON_JOB_CLOSE Job Object。业务fd3不作为控制通道;supervisor的私有报告fd不继承给shell。
forge prePackage准备目标平台真实Node、helper、client、完整Node LICENSE。Make与scheduler复用现有Node22.23.2 URL/SHA256 pin和下载/校验/解压基础设施。运行期不下载、不安装;准备失败阻止打包或运行,旧完整stage不会被半成品覆盖。
默认unit保留纯合同与一条真实Node/stdin/quiet smoke;完整真实进程矩阵进入已声明manual/exclusive integration tier。保留必要覆盖,不改AGENTS、CI、审批、fuse或插件基座。
更新生成器、安装工具说明、五语错误及支持文档 docs/pre-run-node-runtime.md。现有runner/script-runner仍在模型创建前按decision阻止,owner/cwd/stdin/quiet及显式timeout语义沿用。
存在breaking change:xdt-node旧exit-only脚本会明确block,文件和配置不自动改写。需审阅更新正文:条件加载CINDY_PRE_RUN_GATE_CLIENT,在实际检查开始 await gate.enter(),检查结束 await gate.complete(0或2),然后以一致退出码结束。普通node/python/shell保留原退出契约;没有停用fallback。
最新补提交:4e438032ace73ad4c230a1496faadef6ab5c287c,处理 r4303367789/r4303367793。包内 afterCopyExtraResources 校验完整目标与 pin manifest 后仅保留目标 host,保留源码多架构缓存及其他 tools;两条 macOS 签名路径在通用 tools 签名之后以专属 allow-jit 重签 Node,strict 验签,本机架构再运行签后 JIT smoke。签名/执行失败均阻止产出;跨架构不假定 Rosetta 可用,明确记录未执行。
UI 变化
仅五语失败说明,无布局/视觉变化。引用 docs/design-rules/DESIGN.md §11 Voice & Content:准确说明未收到完成验证或无法准备运行环境,不断言Node从未启动。没有运行App做界面或Light/Dark目检。
怎么验证的
自动验证
macOS arm64、实际Node22.22.3;逐场景guard,own RSS上限256MiB、30秒、新增swap/critical只停自身。以下已完成检查各自窗口swapDelta均为0;不把采样RSS当成完整峰值成本承诺。
最新两条打包 review 的定向验证
macOS arm64,现有 Node22.22.3 二进制的独占副本(不是 pinned22.23.2 archive 或实包);本轮授权 own512MiB、heap128MiB、串行单worker、30秒guard,新增swap/critical只停自身。初次normal启动条件因pressure2返回75未开测;后按本轮swap/critical边界执行,各场景swapDelta=0。旧25项运行矩阵未重跑。
定向ESLint:helper/声明/签名合同/forge-pre-run-node.ts/资源层测试均0 errors;forge.config.ts既有unused import仍1,ci/lib.mjs既有100降98,本轮无新增错误(对HEAD前版本执行同配置比较)。首次CLI选错config路径及根lint找不到配置的启动失败已纠正,不计为测试通过;没有修改lint/CI规则。完整tsc继续交CI。
手工验证
未启动App或修改正式宿主。本地真实native/Node入口验证使用本worktree的当前源码、独占临时目录和真实脚本文件/输出/进程清理证据。
未执行的验证
风险
风险分类
影响与回滚
提交前检查