Repository navigation
fix(tui): fold compaction summaries and a stopped turn's process - #360
Conversation
|
head_sha: 变更摘要本 PR 主要修复 TUI 会话记录中两处展开过度的问题:压缩摘要总是完整展开,以及被中断或失败的回合在结束后丢失运行时的折叠状态。核心改动包括重写 主要改动
根据当前约束,我不会进行代码审查或报告发现,仅输出上述变更摘要。 |
|
head_sha: 代码审查审查结论
⛔ 需要修改 |
|
|
||
| def on_mouse_move(self, event: MouseMove) -> None: | ||
| if event.screen_offset != self._pressed_cell: | ||
| self._pressed_cell = None |
There was a problem hiding this comment.
head_sha: eedc0ad179b5099d608680b83c1b5e66d12777a6
🟡 Medium Priority
新增的 SameCellClick.on_mouse_move(guide_fold.py:38-40)用于在指针移到别的单元格时清空 _pressed_cell,从而让"拖拽离开后又回到起始单元格"不触发展开/折叠。但 SameCellClick 的唯一宿主路径 GuideHoverMixin 在 guide_fold.py:218-219 也定义了 on_mouse_move,且没有调用 super();MRO 上(ProcessBlock、LiveProcessRow、ToolGroup、ThinkingMessage 等)解析到的是 GuideHoverMixin.on_mouse_move,于是新增的清空逻辑对这些"每一个折行标题"都不会执行。它们仍在用 guide_fold.py:210 / process_block.py:157 / live_process_row.py:154 的 clicked_same_cell,因此拖拽出单元格再拖回起始单元格后松开,仍会被判定为同格点击并触发折叠——正是本次 PR 声称修掉的交互缺陷,只在新增的 ContextFoldWidget(直接继承 SameCellClick)上生效,两条路径行为分叉。触发条件:在工具组/思考/流程标题行上按下左键,拖到行内其他单元格再拖回起点松开。
建议:在 GuideHoverMixin.on_mouse_move 里先调用 super().on_mouse_move(event)(或显式清空 self._pressed_cell)再执行 _update_guide_hover,使拖拽守卫对所有折行统一生效。
|
|
||
| class _FakeChatPanel: | ||
| async def add_error(self, message: str, *, action_label: MessageRef | str | None = None) -> None: | ||
| async def add_error_notice(self, message: str, *, action_label: MessageRef | str | None = None) -> None: |
There was a problem hiding this comment.
head_sha: eedc0ad179b5099d608680b83c1b5e66d12777a6
🟡 Medium Priority
本次 diff 把本文件 6 处 _FakeChatPanel 的协作方法从 add_error 改名为 add_error_notice(456、632、690、1019、1088、1179 行),说明该文件假定的 ChatPanel 契约已是 add_error_notice;但同文件仍未一起改的两处假实现保留了旧名:
- 865-869 行
_FailingChatPanel.add_error(test_live_turn_error_render_failure_releases_input_without_absorb,期望抛出 "render failed")。
触发条件:若 on_error 对 ChatPanel 实际调用的是add_error_notice,这两处假对象没有该属性 →AttributeError(后者的pytest.raises(RuntimeError, match="render failed")也拿不到预期异常);反之若真实入口仍是add_error,则本次改名的 6 处会全部失效。无论哪种,本次单边改名让同文件内的假实现出现两种契约并存,一旦真实 API 只保留一个就会有两种失败模式,属本次改动引入的不一致(此文件是本次 slice 内唯一可读证据,故置信度受限)。
建议:把 813 行与 866 行的 async def add_error( 一并改名为 add_error_notice(,使本文件所有 ChatPanel 错误入口假实现与改名后的 6 处保持同一契约。
| _session_title=fake_session_title(), | ||
| query_one=lambda cls: widgets[cls.__name__], | ||
| _set_agent_running=lambda running: setattr(panel, "agent_running", running), | ||
| ) |
There was a problem hiding this comment.
head_sha: eedc0ad179b5099d608680b83c1b5e66d12777a6
🟠 High Priority
新增参数化用例 test_error_preserves_settled_history_and_ends_a_live_turn(521-598 行)在第 572-577 行构造假 screen,只给了 _state、_session_title、query_one、_set_agent_running,没有 _debug。
而 previous == "running" 这一组走 executor_error 分支(第 579 行),同文件 1008-1064 行的 test_executor_error_... 在同一分支上断言 debug_calls == [("Error", "[executor_error] Executor error")],证明该分支必然调用 screen 的 _debug;workspace_change_failed(非 recovered)分支同理也是所有既有用例都传了 _debug(647-653 行)。
触发条件:第 581 行 await handler.on_error(Error(...)) 执行到写调试日志的位置 → AttributeError: 'types.SimpleNamespace' object has no attribute '_debug',4 个参数组合都会挂,而不是断言失败。
建议:在该假 screen 的 SimpleNamespace 中补上 _debug=lambda *_args: None。
| ) | |
| screen = SimpleNamespace( | |
| _state=state, | |
| _session_title=fake_session_title(), | |
| query_one=lambda cls: widgets[cls.__name__], | |
| _set_agent_running=lambda running: setattr(panel, "agent_running", running), | |
| _debug=lambda *_args: None, | |
| ) |
|
|
||
| state = _blocked_prompt_state() | ||
| widgets = {"ChatPanel": panel, "StatusBar": _StatusBar()} | ||
| screen = SimpleNamespace(_state=state, query_one=lambda cls: widgets[cls.__name__]) |
There was a problem hiding this comment.
head_sha: eedc0ad179b5099d608680b83c1b5e66d12777a6
🟠 High Priority
新增用例 test_a_hook_rejection_leaves_the_crash_recovered_turn_expanded(486-518 行)构造的假 screen 只有 _state 与 query_one:
第 508 行 screen = SimpleNamespace(_state=state, query_one=lambda cls: widgets[cls.__name__])。
但本文件所有投递 on_error 的用例都必须提供 _debug(例如形态几乎相同的 450-478 用例的 473 行 _debug=lambda *_args: None),而同文件 674-729 行的 test_pending_submit_error_display_localizes_chat_but_debug_keeps_protocol_english 在同样的 _blocked_prompt_state() + hook_blocked 路径下断言 debug_calls == [("Error", "[hook_blocked] Prompt blocked by hook.")],证明该分支确实会调用 screen 的 _debug。
触发条件:用例在第 510 行 state.submit.publish_from_current_task() 之后 await handler.on_error(...),渲染闸门被放行、错误立即处理,于是走到写 _debug 的位置 → AttributeError: 'types.SimpleNamespace' object has no attribute '_debug',新增用例必挂(在提供 _debug 的旧用例里不会出现,属本次新增引入)。文件里唯一没有 _debug 的 screen(770-773 行)之所以能过,是因为错误在 render gate 处被 defer 直接返回,没有走到该分支。
建议:在该假 screen 的 SimpleNamespace 中补上 _debug=lambda *_args: None,与同文件其他 on_error 用例保持一致。
| screen = SimpleNamespace(_state=state, query_one=lambda cls: widgets[cls.__name__]) | |
| screen = SimpleNamespace(_state=state, query_one=lambda cls: widgets[cls.__name__], _debug=lambda *_args: None) |
eedc0ad to
e868967
Compare
e868967 to
d135ad6
Compare
|
head_sha:
|
Open compaction summaries from their title or /fold. Keep the activity and replies of stopped and continued turns in order during live updates and background replay. Preserve readable messages when reopening a process and document how to send a continuation note. Retry briefly held session checkpoint reads on Windows and isolate the search tests from ambient Git configuration overrides. Co-authored-by: Jiaqi (0x7c13) Liu <liujiaqi101@huawei.com>
e1a2a80 to
ccf0f28
Compare
|
🤖 This pull request has been merged, and the target branch is up to date. |
Paired: GitHub #360 ↔ GitCode !255
What type of PR is this?
/kind bug
What
/foldto read them. Empty markers have no toggle.The transcript changes affect presentation. Windows session checkpoint reads now retry temporary sharing conflicts, and search tests isolate inherited Git configuration.
Tests
ccf0f284.