Repository navigation
[PR] test: pi-subagent-registry fake pi keeps per-event handler arrays like real pi (#2234) - #2237
ranxianglei wants to merge 1 commit into
Conversation
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.2306-pr.2237.ea47506This exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr2237.tgz
npm install -g packageInstall instructions are refreshed on each push. |
收到,开始 review:拉取分支核对代码、复现/定向验证、确认 CI 状态,完成后按七问体例给结论。 |
[bot] 🏷 Review 完成,结论:可合并(CI 全绿、base 即最新 master、无需 rebase)。 审查过程(不止跑测试):
回归审查(diff 触碰的既有行为清单,逐项):
测试有效性:修后的测试是真回归测试——未来若有人把 fake 改回单 handler 或删掉 selfRegister handler,:275 断言立即抓住;非恒真断言,非只测 mock。 diff 整洁度:单 commit、单文件,每一行都与 PR 目的相关, 结构化七问:
判定:可合并。合入后连带红的 open PR(如 #2233)rebase 到 master 即恢复。 |
|
(ai: zhipuai-lb/glm-5.3) 陈旧票清理(第三批动作①):目标 issue #2234 已关。为避免重复劳动关闭本 PR;如判断有误请直接 reopen 并留言。 |
Closes #2234
What
Test-only fix for the master-red on
tests/pi-subagent-registry.test.ts(factory wiring test) caused by the #2186 + #2209 semantic merge: each PR was green alone; combined, #2186'swirePiSubagents(pi, agent)(src/agent/pi.ts:939 → src/agent/pi-subagents.ts:90) registers a SECONDsession_starthandler after pi.ts's own (src/agent/pi.ts:891). The test's fake pi stored ONE handler per event (events.set(event, handler)), so the later subagents wiring shadowed the factory's selfRegister handler andregistry().bySessionnever filled → assertion at tests/pi-subagent-registry.test.ts:275.Real pi stores an ARRAY of handlers per event and awaits each in registration order (pi-coding-agent runner.js emit():
for (const handler of handlers)), so production runs both handlers — only the test fake was wrong. Same defect class as #2072 (tests/issue2072-native-caller-stamping.test.ts already uses handler arrays).Fix
makeFakePinow storesMap<string, PiHandler[]>(on()appends), and every call site invokes all registered handlers in order (for (const handler of … ?? []) await handler(…)), mirroring the #2072 fake and real pi semantics. Zero src changes.Verification
node --import tsx --test tests/pi-subagent-registry.test.ts→ 10/10 pass.tsc --noEmit --project tsconfig.jsonclean.