Skip to content

test(codex-bridge-queue): 钉住 hasTerminalTurn 只回答精确 dispatchAttempt(#2648 跟进) - #2653

Merged
deepcoldy merged 1 commit into
masterfrom
test/has-terminal-turn-exact-attempt
Oct 31, 2026
Merged

deepcoldy merged 1 commit into
masterfrom
test/has-terminal-turn-exact-attempt

Conversation

@deepcoldy

Copy link
Copy Markdown
Owner

背景

#2648 给 settleDeferredSubmitConfirmation 引入了 hasTerminalTurn 判定(精确 attempt 已收原生终态、但被 FIFO 压在前序之后时按 structured-transcript 结算)。复审发现:CodexBridgeQueue.hasTerminalTurn 里的 candidate.dispatchAttempt === dispatchAttempt 比较此前没有任何测试钉住——把这个子句整段删掉,队列与 submit-confirmation 全套件仍然全绿。

生产侧是双兜底(settle 精确传 dispatchAttempt;releaseInputDeliveryQuarantine 还有 inputDeliveryQuarantine !== quarantine 身份检查),实际后果止于多一次 no-op onConfirmed,不是行为缺陷;本 PR 只补测试,让 attempt 维度回归时有测试能咬红。

改动

test/codex-bridge-queue.test.ts 新增一条用例,构造同一 turnId 两个 attempt 真并存:attempt 1 经 dropPendingTurn(..., true) 移除,attempt 2 replay 后收到 user + assistant_final;断言 hasTerminalTurn('delivery', 2) === true 且对旧 attempt hasTerminalTurn('delivery', 1) === false。旧 attempt 的 20s 复查定时器不能借 replay 的终态去结算新投递。

放在队列自己的测试文件、紧挨既有同 turnId replay/drop 用例,直接测队列语义。

零生产代码改动,零持久化/接口变化。

验证

  • 正常实现:vitest codex-bridge-queue 113 pass;bun 腿同文件 113 pass
  • 变异(删掉 hasTerminalTurn 的 candidate.dispatchAttempt === dispatchAttempt 子句):
    • vitest:新用例精确 1 红 / 其余 112 绿
    • bun:同一条 1 fail / 112 pass
  • 恢复后 vitest + bun 跑 codex-bridge-queue + submit-confirmation 两文件:各 135 pass / 0 fail

🤖 Generated with Claude Code

#2648 跟进。hasTerminalTurn 的 exact-attempt 比较此前没有任何测试钉住:
去掉 candidate.dispatchAttempt === dispatchAttempt 子句后,整个队列
套件仍全绿。补一条真并存两个 attempt 的用例(attempt 1 dropPendingTurn
移除、同 turnId 的 attempt 2 replay 后收到原生终态),断言终态只满足
attempt 2、对旧 attempt 1 仍为 false——旧 attempt 的 20s 复查定时器
不能借 replay 的终态结算新投递。

变异复验(删 hasTerminalTurn 的 attempt 比较子句):
- vitest test/codex-bridge-queue.test.ts:新用例精确 1 红 / 112 绿
- bun test 同文件:同一条 1 红 / 112 pass
恢复后 vitest+bun 两文件(codex-bridge-queue、submit-confirmation)各 135 pass。

Co-Authored-By: Claude Code <[email protected]>
@deepcoldy
deepcoldy merged commit 3473c59 into master Oct 31, 2026
15 checks passed
@github-actions

github-actions Bot commented Nov 1, 2026

Copy link
Copy Markdown

@deepcoldy 合入 master 后的 Midscene E2E 失败:Feishu live Midscene 失败。

这次运行覆盖 0cbabc8…1a2adea67(5 个提交),同批合入的还有 #2636 #2646 #2651 #2640,失败不一定由本 PR 引起。

用例 跑道 状态 失败信息
Codex prompt submission feishu-core-codex failed Node "feishu.waitForBotResponse" timed out after 300000ms.
Follow-up in the same topic keeps context feishu-core-conversation failed Reply "ACK-e2e-turn1-1793488872963 RECALL ACK-e2e-turn1-1793488872963" appeared 0 time(s) within 240000ms, expected 1 (clicked 直接开启会话 1×; re-opened 1×; repo card buttons 0 visible / 0 total, anchor m…

@github-actions

github-actions Bot commented Nov 1, 2026

Copy link
Copy Markdown

🚀 Released in v3.56.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant