fix(worker): 避免 TraeX 首条消息被启动页吞掉#274
Merged
Merged
Conversation
6f41218 to
170bafd
Compare
Collaborator
Author
|
为了避免扩大影响面写死了traex,目前只看到traex有可能启动较慢,如果需要做成通用的可以放开这个限制 |
170bafd to
3162672
Compare
…-prompt-timeout # Conflicts: # src/worker.ts
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.
背景 / 动机
TraeX 新会话 fresh start 时可能先停在 trust/advisory 启动页,真实输入框的 readyPattern 晚于 worker 的 15s first-prompt timeout。旧逻辑会在 timeout 后直接 flush 队列里的首条消息,导致首条用户指令可能写入非输入框状态并被吞掉。
改动
deferFirstPromptTimeoutUntilReady能力位,TraeX 打开该能力,worker 不再硬编码cliId === 'traex'。awaitingFirstPrompt=false+markNewTurn()解锁启动期,再执行 busy probe,避免扩大行为变化。测试覆盖
shouldReleaseFirstPromptTimeout行为测试,覆盖普通 CLI 15s 释放、TraeX 软超时继续等待、90s 硬超时释放、无 readyPattern 不延迟。验证
pnpm vitest run test/input-gate.test.ts test/worker-pipe-initial-screen-order.test.tspnpm buildgit diff --check影响范围
影响范围收窄在 opt-in adapter 能力位。当前只有 TraeX 打开该能力;其他 CLI 的 15s timeout fallback 行为保持不变。TraeX 最多等待 90s,之后会强制释放首条消息并留下 warn 日志。