Repository navigation
docs(bridge): 补 #1170 的 headless 用例,并写清失败终态为何是唯一泄漏口 - #1186
Merged
Merged
Conversation
deepcoldy
force-pushed
the
fu/phantom-card-followup
branch
from
September 1, 2026 19:22
528519a to
0c5f5da
Compare
两处 #1170 复审时提出、但没赶上合并的收尾。仅注释 + 测试,不动生产逻辑 (`emitReadyTurns` 的可执行代码与 master 逐字节相同,已用「剥注释后 diff」核对)。 1. 注释没写清「为什么终态是唯一泄漏口」,容易让人误以为要按 adoptMode 分情况。 实际两个 mode 都一样:fallback 循环的**第一道**检查 (`terminalOutcome.status !== 'completed' → continue`)与 mode 无关,且排在 `shouldSuppressBridgeEmit` **之前**,所以失败的 local turn 根本到不了那道 gate —— 无论 adopt 与否。也就是说在本门之前,**失败终态是唯一的泄漏口**, 两个 mode 同理,因此这个门刻意不按 adoptMode 分支。 (另注:fallback 即便放行,携带的是 `final_output` 答案文本,不是卡; 「本轮执行失败」卡只来自终态侧。) 顺带把「真实 Lark turn 不受影响」的理由写实:`isLocal` 只由两条合成路径 赋值,`mark()` 从不赋值,journal 恢复的 turn 也走 `mark()`。 2. 补 `local-headless-*` 用例。它与 `local-*` 共用同一个门,复审时判定「逻辑上 已覆盖」——但「走同一分支」是论证,不是测试。补一条真样本:assistant 边界在 没有任何 collecting 上下文时到达(重启切断流、user 事件已被 absorb),队列 合成 headless turn,随后 api-error 让它拿到 failed 终态。 验证: - `bun run build` 通过;两个测试文件 85/85 通过(新增 1 条) - 差分变异:移除 harness 的门 → **2 条**转红(`local-*` 与 `local-headless-*` 各一条),证明新用例有区分力、不是装饰 - 我的注释改动会移动字节下标,而 `09d6388b8` 的位置断言按下标比较,所以专门 重验它仍有判别力:把门**原样移到** `emitTurnTerminal(...)` 之后(真移动, 非新增)→ 恰好 1 条转红(`expected 11924 to be less than 11504`)
deepcoldy
force-pushed
the
fu/phantom-card-followup
branch
from
September 1, 2026 19:36
0c5f5da to
f166ba1
Compare
|
🚀 Released in v3.18.12 |
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.
#1170 复审时提出、但没赶上合并的两处收尾。仅注释 + 测试,不动生产逻辑 ——
emitReadyTurns的可执行代码与 master 逐字节相同(用「剥掉注释与空行后 diff」核对过)。1. 写清「为什么失败终态是唯一泄漏口」
这一点两个 mode 完全一样,不需要按
adoptMode分情况。fallback 循环的第一道检查就与 mode 无关,且排在
shouldSuppressBridgeEmit之前:实测(把这两道检查按原序复刻,两个 mode 各跑一遍):
skipped@5763(mode 无关)skipped@5763(mode 无关)suppressed@5765WOULD EMIT final_output失败的 local turn 在 5763 就被
continue掉,根本到不了 5765 —— adopt 与否都一样。所以在本门之前,失败终态是唯一的泄漏口,两个 mode 同理,因此门刻意不按 adoptMode 分支。
补充一点:fallback 即便放行,携带的是
final_output答案文本,不是卡 ——「本轮执行失败」卡只来自终态侧。
顺带把「真实 Lark turn 不受影响」的理由写实,而不是只下结论:
isLocal只由两条合成路径赋值,
mark()从不赋值,journal 恢复的 turn 也走mark()。2. 补
local-headless-*用例它与
local-*共用同一个门,复审时判定「逻辑上已覆盖」——但**「走同一分支」是论证,不是测试**。补一条真样本:assistant 边界在没有任何
collecting 上下文时到达(重启切断流、user 事件已被 absorb),队列合成 headless
turn,随后 api-error 让它拿到 failed 终态。
验证
bun run build通过;两个测试文件 85/85(新增 1 条)local-*与local-headless-*各一条)。新用例有区分力,不是装饰
09d6388b8的位置断言按下标比较,所以专门重验它仍有判别力:把门原样移到
emitTurnTerminal(...)之后(真移动、非新增)→ 恰好 1 条转红(
expected 11924 to be less than 11504)。没有这一步,我就只能说「测试还是绿的」,而那恰好也是断言失效时的表现
关于 #1170 的合并
那个 PR 在我 rebase 并修订描述期间就已合入(squash
242d386ca),所以这两处只能作为 follow-up。生产代码那侧无需补救:我在真 master 上用线上真实
transcript + 真实 journal 重跑过生产代码,0 张幻影失败卡,并确认把门移除后
测试会转红(门是真在承重的)。
另有一项 follow-up 未包含在本 PR:
clearPending()同样不回收 journal。影响面与 HOL-drop 不同(后面有
markGenerationRetired()disarm、jsonlPath 作用域、24h 门、InflightInputTracker 重投兜底),最坏是重投一段 stale partial 而非幻影
失败卡,所以单独评估,不搭车。
🤖 Generated with Claude Code