fix(agent): 修复上下文压缩后运行时间不显示【已审核 PR】 - #1734
Merged
ErlichLiu merged 1 commit intoAug 19, 2026
Merged
Conversation
Made-with: Proma
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.
概述
修复 Agent 在自动上下文压缩发生于最终回答与 terminal result 之间时,运行时间徽章偶发不显示的问题。
根因是 session-core 的 turn 分组器在收到
compacting/compact_boundarysystem 消息时关闭了当前 assistant turn,而后续携带_durationMs的 result 没有重新归属任何 turn。运行时间实际已经持久化,但 renderer 无法从最终回答的 turn 中读取它。改动
packages/session-core/src/group.ts— 保留刚被 system 状态关闭的 assistant turn;若随后收到 terminal result,则将 result 回挂到该 turn。收到新的真实用户输入时清除候选引用,避免跨轮误归属。packages/session-core/src/session-core.test.ts— 新增“最终回答 -> 自动压缩 -> terminal result”时序的回归测试,验证_durationMs仍归属最终回答。测试方法
bun test packages/session-core/src/session-core.test.ts— 17/17 通过。bun run typecheck—@proma/shared、@proma/session-core、@proma/core、@proma/cli、@proma/ui、@proma/electron全部通过。git diff --check— 通过。备注
本次修改不涉及 renderer 组件、CSS、滚动容器、动画、IPC 或 GPU/compositor 层,只修复会话消息分组的数据归属。已完成本地 GPU/compositor 审核,未发现新增渲染性能风险。
Made with Proma · GitHub