Repository navigation
test(claude): 忙时追加 e2e 改用不冲突的两条指令,断言两条都被处理 - #2343
Merged
Merged
Conversation
原用例让第一条「跑 Bash 后回 FIRST_PONG」、Bash 期间排队的第二条「只回 QUEUED_PONG」。 Claude Code 2.1.310 在工具调用期间收到的消息不会另开回合,而是在工具返回时并进当前回合 (queue-operation remove,reason=absorbed_mid_turn),以 system-reminder 交给模型, 回不回、怎么回由模型决定。两条「Reply with exactly X」互相冲突时,模型只会执行其中一条, 末段断言因此随模型而定:有的模型稳定超时,有的稳定通过。 改为两条兼容的指令:第一条让模型记住一个随机数并跑 Bash,第二条(仍是带中文与反斜杠的 多行内容)要求回复 RECALLED_<那个数>。断言: - 第二条恰好以原文入队一次(#1688 的多行投递契约,不变) - Bash 实际执行并输出 BUSY_BEGIN(第一条被处理) - 模型回复里出现 RECALLED_<随机数>(第二条被处理,且用到了第一条的内容) Refs #1712 Co-Authored-By: Claude Opus 5.5 <[email protected]>
deepcoldy
requested review from
47seek,
LucasIcarus,
xiaoxueSunn and
xiongz-c
as code owners
October 25, 2026 12:19
Owner
Author
|
已合并 → 0025f7c(squash)。双审都在 c47dbab 上给出可合,CI 全绿。改动只涉及默认 skip 的 opt-in e2e,对老用户没有影响;落地的树与审过的树一致。#1712 已留结论评论并关闭。 follow-up(记录,不阻断):以 root 身份在本地跑这个用例时,环境里需要有 未做:发版、部署。 |
|
🚀 Released in v3.52.0 |
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.
改了什么
只改了 opt-in 的
test/claude-herdr-submit.e2e.ts(#1688 引入的真实 Claude + Herdr 多行提交 e2e),没有改产品代码。原用例的两条指令互相冲突:第一条要求「跑 Bash,然后回 FIRST_PONG」,Bash 运行期间排队的第二条要求「Reply with exactly: QUEUED_PONG」。现在改成两条兼容的指令:
BUSY_BEGIN后 sleep 12 秒)<user_message>,在 Bash 运行期间投递;最后一行改为「Reply with RECALLED_ followed by the number I asked you to remember」断言:
BUSY_BEGIN:第一条被处理RECALLED_<随机数>:第二条被处理,而且用到了只有第一条里才有的数字用例另外在日志 JSON 里记一笔
absorbedMidTurn,标明这次第二条是走 absorbed_mid_turn 被吸收,还是在下一轮被 dequeue。这一项不参与断言。为什么(#1712 的复现结论)
消息没有丢。Claude Code 2.1.310 在工具调用期间收到的消息不会另开回合:工具返回的那一刻,它把这条消息并进当前回合(transcript 依次记
queue-operation enqueue→remove reason=absorbed_mid_turn→attachment queued_command),在同一回合的下一次请求里以 system-reminder("The user sent a new message while you were working …")交给模型。模型看得到这条消息,回不回、怎么回由模型决定。正常追问(例如「跑命令」之后再问「17×23 等于几」):在 send / 零注入两种投递模式、两种模型、工具忙 / 文本忙几种组合下,4/4 两条都得到回复。
两条指令互相冲突(本用例的旧写法):模型只执行其中一条,而且不同模型选的不一样。同一写法下,模型 A 5/5 只回 FIRST_PONG(第二条没人回),claude-haiku-5-5 5/5 只回 QUEUED_PONG(第一条的要求被丢掉)。所以旧用例末段「等 QUEUED_PONG」会随模型稳定超时或稳定通过。
(模型 A 指经 Anthropic 兼容网关接入的一个非 Claude 模型,是这台机器上多数 bot 的默认模型。)
只读扫描一台长期运行 botmux 的机器上 09-13 到 10-25 的 Claude transcript:人类消息在回合中途被吸收 576 次,吸收之后模型没有再被调用的 0 次(其中 2.1.289 上 20 次、2.1.310 上 56 次)。
回不回这条消息属于模型行为。维护者已定:botmux 不在内容层面判定「被吸收的消息有没有被回答」。所以本 PR 只修正这条 e2e,让它的前提和 Claude 的实际语义一致。
影响面
BOTMUX_CLAUDE_HERDR_E2E=1),CI 不跑。验证
本地只跑这个用例,单 worker,外层加 timeout。临时 HOME(Claude 的配置、信任记录和 transcript 都落在临时目录),herdr 会话注册在用例私有的
XDG_CONFIG_HOME下。该用例走 herdr 后端,不经 tmux;TMUX_TMPDIR仍指向私有目录,并清掉了TMUX。运行命令:timeout: queued model response(transcript:absorbed_mid_turn 之后只回了 FIRST_PONG)RECALLED_<n>)timeout: queued message answered with the remembered numberbun run build通过vitest run --project unit test/test-hygiene.test.ts:26 passedRefs #1712
🤖 Generated with Claude Code