Repository navigation
fix(traex): 换模被拒时不再发切换通知,冷启动预检补 generation 围栏 - #3052
Merged
Merged
Conversation
暖会话预检换模被 executeTraexAutoModelSwitch 拒绝、或冷启动 commitSwitch 被拒时,末尾仍无条件发送切换通知,而模型实际未变。现在只对 hold 和已成功的切换通知。 冷启动预检读取负载的 await 之后缺少 spawn generation 检查,重启与长读取 交叠时被取代的 spawn 仍会推进模型索引并发通知。现在与 spawnCli 其余 await 一致,已被取代则抛 CliSpawnSupersededError。 Fixes #2705
deepcoldy
requested review from
47seek,
LucasIcarus,
xiaoxueSunn and
xiongz-c
as code owners
November 7, 2026 11:55
|
🚀 Released in v3.59.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.
Fixes #2705
只处理 issue 的第 1、2 项(冷启动 generation 围栏、换模通知时机);文档措辞与死代码(第 3、4 项)不在本 PR 范围。
现象
executeTraexAutoModelSwitch拒绝(开关态竞争、无 native session id 等)时,仍会发出「已切换到 X」/「已选择负载最低模型」通知,而模型实际未变。冷启动路径commitSwitch被拒时同样会发。根因
notifyTraexPreflightDecision(decision):换模成功时暖路径已由executeTraexAutoModelSwitch自己发通知并提前返回,能走到末尾的 switch 决策必然是被拒的,却仍按 switch 文案通知。spawnCli中其余 await 之后都有spawnGeneration !== cliSpawnGeneration检查并抛CliSpawnSupersededError,唯独 TraeX 冷启动预检的 await 之后没有。修复
commitSwitch被拒时不发切换通知;负载读取返回后、提交决策前按 spawn generation 围栏,已被取代则抛CliSpawnSupersededError(与spawnCli其余 await 的处理一致,调用方静默返回)。验证
test/traex-preflight-worker.test.ts(真实 worker 函数 + 真实TraexAutoModelController)新增:commitSwitch被拒 → 不通知、模型保持 coreCliSpawnSupersededError、不提交不通知tsc --noEmit、npm run build通过;相关 7 个 TraeX 测试文件 vitest 253/253、bun 253/253 通过。