Skip to content

fix(web): 优化会话回放、compact 状态与文件回退刷新#612

Merged
phantom5099 merged 9 commits into1024XEngineer:mainfrom
Yumiue:html_progress_clean
May 11, 2026
Merged

fix(web): 优化会话回放、compact 状态与文件回退刷新#612
phantom5099 merged 9 commits into1024XEngineer:mainfrom
Yumiue:html_progress_clean

Conversation

@Yumiue
Copy link
Copy Markdown
Collaborator

@Yumiue Yumiue commented May 10, 2026

背景

本次改动聚焦 Web 聊天体验与 checkpoint 文件级回退链路,修正历史会话回放、compact 状态展示、预算提示、工作区展开状态以及单文件回退后的前端刷新行为。

当前修改

  • 修复历史会话首次加载后消息列表停留在顶部的问题,切换到已有会话时自动定位到底部,同时保留生成中用户手动上滚后的暂停跟随行为。
  • 过滤仅供 runtime/provider 续跑使用的内部历史消息,避免旧的 acceptance/verify/todo 控制内容污染聊天区。
  • 将会话历史重载改为一次性 setMessages 写入,覆盖切换会话、checkpoint 回退和首次自动绑定场景,减少逐条追加带来的中间态。
  • 新增 compact 独立状态:compact 开始后在输入框上方展示持续状态,期间禁止发送消息、切换技能和切换权限模式,compact 成功或失败后正确收尾。
  • 调整输入框预算圆环为正常 / 警告 / 危险三态,并在弹层中展示状态、预算占用和上下文上限占用。
  • 修复工作区列表只应展开当前工作区的问题,避免非当前工作区仍显示展开态。
  • 扩展 CheckpointRestored 事件契约,补充 modepaths 字段;baseline 文件回退会规范化路径并随事件回传。
  • Web 收到 baseline 文件回退事件后只清理对应文件的变更项并结束 restoring 状态,不再刷新整个会话或文件变更列表,避免单文件回退后界面被整页重载。
  • 补充 runtime checkpoint、TUI gateway stream、ChatInput、MessageList、Sidebar、FileChangePanel、chat/session store 和 eventBridge 的回归测试。

验证

  • go test ./internal/runtime ./internal/tui/services:通过。
  • cd web && npm test:47 个测试文件、276 个测试通过。
  • cd web && npm run build:TypeScript 与 Vite 构建通过。

风险与影响

  • 改动保持在 Web UI、前端 store、checkpoint restore 事件契约和 runtime restore 通知范围内,没有改变 TUI / Gateway / Runtime / Provider / Tools 主链路职责边界。
  • 历史消息过滤只作用于 Web 展示映射,不修改后端持久化消息,也不影响 runtime/provider 的续跑数据。
  • baseline 文件回退事件新增字段为可选字段,旧事件消费者仍可按原字段解析。

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

Copy link
Copy Markdown

@fennoai fennoai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found 1 noteworthy issue in the changed code.

Comment thread web/src/stores/useSessionStore.ts Outdated
Comment on lines +161 to +169
function isInternalHistoryMessage(msg: BackendMessage): boolean {
const role = msg.role.trim().toLowerCase()
if (role === 'system') return true

const content = msg.content.trim()
if (!content) return false
return content.startsWith('<acceptance_continue>') ||
content.includes('<completion_blocked_reason>') ||
content.includes('<todo_convergence>')
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isInternalHistoryMessage is broader than the PR description: it drops every system message and any message whose text merely contains these markers. Because mapHistoryMessages() applies this filter before collecting tool_call_id results, a normal tool output or pasted file that contains <completion_blocked_reason> / <todo_convergence> will vanish from the replay, and the related tool card loses its result. Please narrow this to the specific control-message shape/role instead of substring-matching arbitrary history content.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 10, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@Yumiue Yumiue changed the title fix(web): 修复会话切换与预算显示体验 fix(web): 修复会话切换与预算显示体验,还有compact的独立面板 May 11, 2026
@Yumiue Yumiue changed the title fix(web): 修复会话切换与预算显示体验,还有compact的独立面板 fix(web): 优化会话回放、compact 状态与文件回退刷新 May 11, 2026
@phantom5099 phantom5099 merged commit 580a77c into 1024XEngineer:main May 11, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants