Repository navigation
test(worker): 修复 dispatch-user-route 夹具缺失沙盒叶子刷新标识符导致的 master 红 - #3590
Merged
Merged
Conversation
#3569 在 markPromptReady 中新增 refreshSandboxedCliLeafAttestation?.(), dispatch-user-route 的 screenReady 用裸 with(scope) 跑该函数源码,scope 里没有这个标识符;可选链只挡 nullish 值、挡不住未声明标识符,5 个用例 报 ReferenceError。在 scope 中补 undefined 桩,与相邻的 currentCodexObservedPid 桩一致;真实沙盒叶子路径由 find-launched-cli-pid 套件覆盖。 Co-Authored-By: Claude Fable 5 <[email protected]>
deepcoldy
requested review from
47seek,
LucasIcarus,
xiaoxueSunn and
xiongz-c
as code owners
November 19, 2026 04:33
deepcoldy
commented
Nov 19, 2026
deepcoldy
left a comment
Owner
Author
There was a problem hiding this comment.
结论:可合,无阻断项。
核对 head 962499bc6:仅 test/dispatch-user-route.test.ts 增加 4 行注释/桩,未改生产代码。根因成立:screenReady 在普通对象上执行裸 with(scope),而 markPromptReady 会解析 refreshSandboxedCliLeafAttestation;?. 只能处理已解析标识符的 nullish 值,不能避免未声明标识符的 ReferenceError。补 undefined 与生产中非沙盒状态一致,不影响其它 CLI 或真实叶子证明路径。
本机验证:
- 相关 4 文件:187/187 passed。
bun run typecheck:通过。- 变异复验:移除该桩后稳定复现 5 failed / 61 passed,失败均为
ReferenceError: refreshSandboxedCliLeafAttestation is not defined;还原后dispatch-user-route66/66 passed,工作树恢复 PR 原样。 - 其它
markPromptReady源码切片调用方走worker-function-harness的 Proxy scope,缺失名字回退为 undefined,不需要同样补桩。
非阻断的后续建议:裸 with(scope) 夹具长期仍会随新增可选 worker 全局而变脆,可另起改动统一成 Proxy scope;不必在这次 master 红修复中扩大范围。
当前 CI 尚未全绿,合入仍以首跑全绿为准。
🤖 Generated with Claude Code
deepcoldy
pushed a commit
to KwokBy/botmux
that referenced
this pull request
Nov 19, 2026
This was referenced Nov 19, 2026
|
🚀 Released in v3.59.22 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
现象
master
678251d3e(#3569 合入)的 bun-test (1/4) 中,test/dispatch-user-route.test.ts有 5 个用例失败:CI run:https://github.com/deepcoldy/botmux/actions/runs/44454508741
根因
#3569 在
markPromptReady中新增了refreshSandboxedCliLeafAttestation?.()。该测试的screenReady夹具把markPromptReady的源码切片放进裸with (scope)(普通对象)里执行,scope 没有提供这个标识符。可选链
?.只能拦截值为 nullish 的取值,挡不住标识符解析本身——with在普通对象上找不到该名字时直接抛 ReferenceError,所以 5 个走 screenReady 的用例全部失败。同样切片 worker 源码的
worker-function-harness不受影响:它的 scope 是声明了全部标识符的 Proxy,未提供的名字回退为 undefined 而非抛错(#3569 自己的 find-launched-cli-pid 套件也已在 scope 中显式提供该桩)。#3569 的最后 head 是 fork 提交、CI 需批准未运行即被合入,所以这个夹具缺口没有被拦住。
改动
仅测试,一行桩:在
screenReady的 scope 中补refreshSandboxedCliLeafAttestation: undefined,与相邻的currentCodexObservedPid桩(markPromptReady 中两者调用点相邻)同形态。真实沙盒叶子证明路径仍由find-launched-cli-pid套件覆盖,本夹具只测生命周期/派发边界。验证
dispatch-user-route.test.ts5 failed / 61 passed,错误与 CI 逐字一致;修复后 66/66 passed。dispatch-user-route+find-launched-cli-pid+worker-codex-execution-root+worker-busy-ready-recovery,4 文件 187 passed。bun run typecheck通过。🤖 Generated with Claude Code