Skip to content

修复 Web Plan 模式计划内容展示#676

Open
Yumiue wants to merge 2 commits into
1024XEngineer:mainfrom
Yumiue:codex/web-plan-display-674
Open

修复 Web Plan 模式计划内容展示#676
Yumiue wants to merge 2 commits into
1024XEngineer:mainfrom
Yumiue:codex/web-plan-display-674

Conversation

@Yumiue
Copy link
Copy Markdown
Collaborator

@Yumiue Yumiue commented May 20, 2026

关联问题

背景

#674 要解决的是 Web Plan 模式下计划内容不显示或显示异常:模型输出的结构化计划容易以 JSON/Markdown 普通文本形式泄漏到聊天流,刷新或切换会话后也无法稳定恢复为计划视图。

本 PR 同时包含一个超出 #674 原始范围但位于同一 Web 事件桥链路的修复:#675 记录 agent_done 在没有预先流式 chunk 时不会创建 assistant 消息的问题。

修改内容

Plan 展示链路

  • Runtime 在成功解析 plan_spec + summary_candidate 并更新 CurrentPlan 后发送 plan_updated 事件。
  • Gateway 会话契约增加 current_plan,用于刷新、切会话和 checkpoint 恢复后的计划卡片还原。
  • Web 协议补齐 PlanArtifact / PlanSpec / PlanUpdatedPayload,事件类型增加 plan_updated
  • Web Plan 模式下抑制原始 agent_chunk 计划 JSON,收到 plan_updated 后插入或更新计划卡片。
  • 会话历史恢复时用 current_plan 还原计划卡片,并在已有 rendered plan 文本的位置替换,避免重复展示且保持原消息顺序。

越界但相关的事件桥修复

  • agent_done 携带最终文本但此前没有创建 streaming assistant 消息时,Web 会创建并 finalize 一条普通 assistant 消息。
  • 已收到 plan_updated 的同一 run 在 agent_done 时仍跳过普通消息生成,避免计划卡片和 Markdown 重复。

验证

  • npm test -- src/utils/eventBridge.test.ts src/stores/useSessionStore.test.ts src/components/chat/MessageItem.test.tsx
  • go test ./internal/gateway ./internal/runtime

备注

  • 本 PR 不实现计划审批按钮或新的 approve plan 控制面 API。
  • 本 PR 不调整会话列表刷新时当前会话失效后的自动选择策略。

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

Found 2 noteworthy issues after code quality, performance, security, and documentation passes.

Comment thread web/src/stores/useSessionStore.ts
Comment thread internal/runtime/todo_bootstrap.go
@codecov
Copy link
Copy Markdown

codecov Bot commented May 20, 2026

Codecov Report

❌ Patch coverage is 89.47368% with 10 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
internal/runtime/planning.go 75.60% 5 Missing and 5 partials ⚠️

📢 Thoughts on this report? Let us know!

@Yumiue Yumiue changed the title 修复 Web Plan 模式计划卡片展示 修复 Web Plan 模式计划内容展示 May 20, 2026
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.

【实现】 修复 agent_done 非流式最终消息丢失 Web Plan Mode Display Fix

1 participant