fix(runtime/tui): gate stale resume checkpoint and complete verification lifecycle event contract#680
Merged
Cai-Tang-www merged 4 commits intoMay 21, 2026
Conversation
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Collaborator
Author
|
/review |
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.
背景
本 PR 针对本轮 review 的两个中等问题做收敛修复:
applyResumeCheckpoint仅按session_id取最新记录,未校验workspace_key/transcript_revision,存在“旧 checkpoint 误导新 run 进入 plan/verify”的风险。verification_started / verification_stage_finished / verification_finished,但 TUI 侧未形成完整强类型消费闭环,部分事件会以原始 map 形态被忽略。变更概览
1) Runtime:恢复 checkpoint 增加一致性闸门
文件:
internal/runtime/checkpoint_resume.goupdateResumeCheckpoint现在会持久化当前 transcript 逻辑版本(按消息数计算)。workdir,缺失时回退运行时生效目录,统一生成workspace_key。applyResumeCheckpoint在应用策略前新增匹配校验:workspace_key必须匹配当前 run;transcript_revision必须匹配当前会话 transcript 版本。2) TUI 契约闭环:verification lifecycle 事件端到端消费
文件:
internal/tui/services/runtime_contract.gointernal/tui/services/gateway_stream_client.gointernal/tui/core/app/update.go增加
VerificationStartedPayload契约类型。gateway_stream_client补充三类 lifecycle 事件的强类型解码:verification_startedverification_stage_finishedverification_finishedupdate侧注册并实现对应 handler,将事件转为可见 activity(不再静默透传)。测试
新增/更新测试覆盖:
internal/runtime/checkpoint_flow_test.gointernal/tui/services/gateway_stream_client_additional_test.gointernal/tui/core/app/update_runtime_events_test.go本地执行:
go test ./internal/runtime -run "Resume|Verification"go test ./internal/tui/services ./internal/tui/core/app改动价值
风险与兼容性