Skip to content

refactor (TUI):全面切换 Gateway 主链路,移除旧运行路径并新增 Checkpoint 指令+UI优化#567

Merged
phantom5099 merged 13 commits into1024XEngineer:mainfrom
creatang:main
May 7, 2026
Merged

refactor (TUI):全面切换 Gateway 主链路,移除旧运行路径并新增 Checkpoint 指令+UI优化#567
phantom5099 merged 13 commits into1024XEngineer:mainfrom
creatang:main

Conversation

@creatang
Copy link
Copy Markdown
Collaborator

@creatang creatang commented May 6, 2026

背景

这组改动主要围绕 TUI 与 Gateway 链路统一、checkpoint 能力接入、运行日志可读性提升,以及 Provider Add 交互体验优化。目标是减少历史路径分叉,强化 runtime/gateway 协议一致性,并提升终端侧可观测与可恢复能力。

改动概览

1) 冻结 TUI-Gateway 基线契约并统一版本来源

  • 增加/更新 TUI-Gateway 契约矩阵文档,明确当前支持范围与约束。
  • 统一 payload 版本来源,减少链路中版本歧义。

对应 commit: a89b2ee8

2) 移除 legacy run 路径,收敛 runtime 适配层

  • 删除历史 run 分支路径,简化远端 runtime 适配器。
  • 调整 runtime contract 与 service 组装逻辑,降低双路径维护成本。
  • 补充 adapter/service 相关测试。

对应 commit: 70a254d6

3) 严格化 gateway 事件 envelope 解码

  • 强化 stream 事件 envelope 校验,异常包不再“宽松吞掉”。
  • 提升事件解析一致性与错误可诊断性。
  • 补充 gateway stream client 的补充测试与回归测试。

对应 commit: 9d4f8579

4) Gateway 启动握手与 unsupported-action 映射收敛

  • 增加 startup bind handshake 过程的映射与兜底。
  • 收紧 unsupported action 到 TUI 错误提示的映射策略。
  • 更新 app 层与 adapter 层测试覆盖。

对应 commit: 4da43df5

5) 打通 Gateway 与 TUI 主链路

  • 完成 workspace/session 相关链路在 gateway 与 tui 之间的贯通。
  • 统一 runtime contract 中关键结构与事件消费路径。
  • 增补 gateway handlers / runtime / stream 侧联动测试。

对应 commit: 6d6daa45

6) 新增 checkpoint 相关 slash 指令

  • 引入 checkpoint 操作命令入口(列表/恢复等交互路径)。
  • 将 checkpoint 指令接入现有 commands/update 流程。
  • 补充 checkpoint 命令测试。

对应 commit: ed666073

7) 输出区日志折叠能力

  • 增加运行过程输出折叠,降低长流程噪声干扰。
  • 优化状态切换与折叠交互的 app/update 行为。
  • 补充对应测试。

对应 commit: b08706d3

8) inline 日志持久化

  • 将 inline 过程信息纳入会话持久化链路,支持重进后恢复展示。
  • 补充 hydrate/update 相关测试,确保回放稳定。

对应 commit: 504da1db

9) Todo 展示优化

  • 重构 todo 面板渲染,提升信息对齐与可读性。
  • 补充 todo 渲染/交互测试。

对应 commit: 64d6f2eb

10) /provider add 界面优化 + 提示能力增强

  • 优化 provider add 表单排版与焦点显示。
  • 引入“当前焦点字段 Hint”模式,避免说明文本打散布局。
  • 同步更新视图测试。
  • 同时补齐 internal/gateway/validate.go 中 checkpoint action 校验映射。

对应 commit: 876516cd

影响与兼容性

  • TUI 侧对 gateway 事件与启动行为更严格,历史非标准 envelope/动作会更早报错。
  • 运行与恢复链路可观测性增强(折叠 + inline 持久化)。
  • Provider Add 交互改变为“底部焦点提示”,减少中部布局噪声。

测试

  • 已补充并更新相关单元测试(stream client / runtime adapter / app update / todo / view 等模块)。
  • 覆盖点包括:协议校验、checkpoint 指令、日志折叠与持久化回放、provider add 交互渲染。

@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.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 6, 2026

@fennoai
Copy link
Copy Markdown

fennoai Bot commented May 6, 2026

Review API returned repeated 422 errors for batched review submission, so posting the findings here.

  1. internal/tui/core/app/commands.go:268
    Medium: refreshModelPicker now sources the picker from the gateway's session-scoped model catalog and selected_model_id, but the picker confirm path still uses runModelSelection(a.providerSvc, item.id), which only updates local config. In gateway mode the UI therefore shows the remote session model list, but selecting an item never calls gateway.setSessionModel, so the actual session model does not change and the picker can snap back on reopen.

  2. internal/tui/core/app/gateway_error_mapping.go:17
    Medium: removing the JSONRPCCodeMethodNotFound fallback regresses the upgrade path for older gateways. When a server does not implement a new RPC such as checkpoint.list, it often returns plain JSON-RPC method not found without GatewayCodeUnsupportedAction; after this change normalizeCheckpointCommandError no longer recognizes that case and surfaces a raw RPC error instead of the intended upgrade hint.

No additional noteworthy issues were found in the performance, security, or documentation passes.

@creatang creatang changed the title refactor (TUI):全面切换 Gateway 主链路,移除旧运行路径并新增 Checkpoint 指令 refactor (TUI):全面切换 Gateway 主链路,移除旧运行路径并新增 Checkpoint 指令+UI优化 May 7, 2026
@phantom5099 phantom5099 merged commit 13e5bb5 into 1024XEngineer:main May 7, 2026
2 of 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