Repository navigation
fix(traex): 按完整视口逐行识别 0.209 几何 spinner 状态行,恢复忙碌检测 - #1885
Merged
Merged
Conversation
TraeX 0.209 把 braille spinner 换成 ⋄◇◆✦◈❖✧,并把中断提示放进状态括号中部 (「❖ Working… (1s • esc to interrupt)」),原有 braille 锚定与行首锚定分支均不命中, 0.209 下 busyPattern / idleToBusyPattern 完全失效。新增分支要求同一行内「几何 spinner 字形 + 括号内 esc to interrupt」:◆ 同时是回复/推理的项目符号与 logo 眼睛,单凭字形 不足为证;兼容差量重绘中出现的 interupt 拼写。 Co-Authored-By: Claude Opus 5.5 <[email protected]>
deepcoldy
requested review from
47seek,
LucasIcarus,
xiaoxueSunn and
xiongz-c
as code owners
October 13, 2026 15:27
◆ 同时是回复项目符号,原分支接受括号前任意文字,「◆ Press Escape to cancel (esc to interrupt).」这类已完成回复会被判为忙碌,进而触发 idle→busy 与视口忙碌否决。 改为要求「字形 + 编译期 spinner 标签 + 以耗时开头的括号 + esc to interrupt」,并补 回复文本反例;真机录像逐帧扫描命中帧数与忙碌区间不变。 Co-Authored-By: Claude Opus 5.5 <[email protected]>
未锚定时,空闲输入框里的「❯ Explain "❖ Working… (1s • esc to interrupt)"」会被判为 忙碌:idleToBusyPattern 撤回就绪,inspectPostTerminalComposer 得出 busyAt > composerAt 使终态后输入闸保持关闭。改为与排队分支一致的行首锚定(允许缩进);真机录像中视口命中 帧数(432)与原始 PTY 状态块命中数(6)均不变。 Co-Authored-By: Claude Opus 5.5 <[email protected]>
已完成的回复若单独一行打印状态行示例,行首锚定仍会命中,idleToBusyPattern 撤回就绪、 deferPromptReadyWhileBusy 持续否决屏幕空闲。真实状态行恒位于输入框顶线正上方:原始 PTY 块内联「…interrupt)────」,渲染视口里状态行与 ❯ 之间恰隔一行(顶线行可能为空或残留 差量重绘字符);一轮结束后中间必有「Worked for …」行。据此要求紧邻关系并排除该行。 真机录像:原始 PTY 状态块 6/6 命中;视口忙碌区间与前一版逐帧一致,仅少 3 个输入框尚未 重画的毫秒级中间帧。 Co-Authored-By: Claude Opus 5.5 <[email protected]>
回复中可整段围栏打印页脚示例(状态行、顶线、❯),其下才是真实的 Worked for 行与输入框; 冷恢复时该示例会让 deferPromptReadyWhileBusy 永久否决就绪。新增前瞻:命中后不得再有 提示符行或 Worked for 行。括号内容限长 160 消除无右括号长文本的二次回溯(99k 字符 288ms → 1.4ms)。真机录像命中数不变(视口 429、原始块 6)。 Co-Authored-By: Claude Opus 5.5 <[email protected]>
页脚位置判定依赖行结构,只在渲染视口上成立;原始 PTY 流去掉光标定位后没有可靠的行, 带光标定位重绘的已完成回复里的页脚示例会触发 idle→busy,撤回就绪并误报工作中。拆分为 TRAEX_VIEWPORT_BUSY_PATTERN(busyPattern,含几何分支)与 TRAEX_ACTIVE_BUSY_PATTERN (idleToBusyPattern,与 master 一致)。traex 的 busyPattern 只被读屏路径使用(原始流 扫描 busyPattern 的 argv 首轮证据门仅对 Pi 生效)。真机录像:视口 429 帧命中不变, 原始流 idleToBusy 命中 0(与 master 一致)。 Co-Authored-By: Claude Opus 5.5 <[email protected]>
恢复/接管的会话里,多行草稿可引用整段页脚(状态行、顶线、❯),真实输入框与 Worked for 行都在其上方,「其后无提示符行」的前瞻拦不住。0.209 把历史用户消息渲染为「▍ …」而非 提示符行,故真实状态行恒在唯一输入框之上:在字形之后加后顾断言,命中位置之前不得有行首 提示符。真机录像视口 429 帧命中不变;vitest 与 bun test 均通过。 Co-Authored-By: Claude Opus 5.5 <[email protected]>
此前把几何 spinner 分支塞进 busyPattern 正则,审查连续找到 7 类误判忙碌:回复/输入框/ 草稿中引用状态行或整段页脚、原始流无行结构、busyProbeRegion 只取尾部截掉真实输入框等, 失败方向均为就绪被永久否决。改为: - busyPattern / idleToBusyPattern 恢复为 master 原样; - 新增 traex-footer.ts,traex 的 isSessionBusy 用 worker 传入的完整权威视口逐行判定: 第 0 列唯一的提示符行是输入框首行,其上第二行须为第 0 列「字形 + 英文标签… (耗时 • … esc to interrupt)」状态行。依据真机 0.209.1 实测:用户消息为「▍ …」,回复与草稿 续行缩进两列,引用的 ❯ 不会出现在第 0 列;回复首行即示例时呈现为「◆ ❖ Working…」。 - 任何不确定情况返回 false,即 master 行为,不会卡住输入。 真机录像逐帧:命中 429 帧,忙碌区间与提交/终态对齐,空闲期零误判。 Co-Authored-By: Claude Opus 5.5 <[email protected]>
英文单词规则拒绝了 0.209.1 内置标签中的逗号与撇号,导致该状态下漏判忙碌。改为「字形后 紧跟大写字母开头、以 … 结尾」,「◆ ❖ Working…」(回复首行即示例)仍被排除;测试遍历 TRAEX_SPINNER_LABELS 全部标签。 Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
🚀 Released in v3.43.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.
背景
在 #1883 录制真 TraeX 0.209.1 终端时发现,0.209 的工作中状态行改成了几何字形 spinner,中断提示也移到了括号中部:
一轮结束后变为
Worked for 6s • 5:20 AM。现有busyPattern的各个分支在 0.209 上全部不命中,读屏否决(deferPromptReadyWhileBusy/probeBusyPatternIdle)实际失效。方案:按完整视口逐行判定,不改正则
◆同时是回复的项目符号,回复、输入框、多行草稿都可能原样引用状态行甚至整段页脚,单靠正则无法区分(前几版正则方案经多轮审查,找出 7 类误判忙碌,失败方向都是就绪被永久否决)。示例唯一模仿不了的是列位置。按真机 0.209.1 实测:▍开头;回复首行◆,续行缩进两列;多行草稿的续行也缩进两列。所以引用的❯永远不会出现在第 0 列。◆ ❖ Working… (…),字形后面不是英文标签。规则:第 0 列唯一的提示符行是输入框首行,它上方第二行必须是第 0 列的「字形 + 英文标签… (耗时 • … esc to interrupt)」状态行。中间那一行是输入框顶线,可能是
─横线、清洗后的空行,或带残留文字/标题。实现:
src/adapters/cli/traex-footer.ts(纯函数)。isSessionBusy。worker 在读屏否决和空闲探测里会先调它,并且只在屏幕证据权威时才通过getCurrentScreen传入完整视口,不受busyProbeRegion只取尾部的截断影响。busyPattern/idleToBusyPattern与 master 完全一致,原始流、终态后输入闸(inspectPostTerminalComposer)的行为不变。影响面
getCurrentScreen缺失(ZMX 等非权威后端)时恒为 false。isSessionBusy后,worker 的空闲探测会跳过「可截屏」前置检查。已核对调用点:提交后和排队消息两处对reliableTurnTerminal的 CLI 不调度(traex 属于这类);重连探测只跑一次;其余两处只在已判定忙碌之后调度,不会空转。测试验证
test/traex-footer.test.ts(9 个用例,全部走isSessionBusy和完整屏幕):capture-pane -e带 SGR 码的行首。isSessionBusy:命中 429 帧,忙碌区间从提交后约 0.3s 到task_complete后约 10ms,空闲期零误判。bun x vitest run test/traex-*.test.ts test/cli-adapters.test.ts test/idle-detector.test.ts test/raw-input-followup-atomicity.test.ts test/worker-structured-lifecycle-status.test.ts test/worker-queue-merge.test.ts:16 个文件 887 passed;bun test test/traex-footer.test.ts通过;bun run build通过。🤖 Generated with Claude Code