pref(runtime):重构完成验收链路,将正确性验证从 Accept Gate 下沉到 Hook#646
Merged
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. |
Collaborator
Author
|
@xgopilot 替我修复编译错误:--- FAIL: TestBuildGitHeadBlobSpecWindowsBackslash (0.00s) |
结果已修复
|
Generated with [codeagent](https://github.com/qbox/codeagent) Co-authored-by: phantom5099 <245659304+phantom5099@users.noreply.github.com>
fix(repository): normalize backslashes in git HEAD blob spec
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
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.
closes: #634
背景问题
当前完成验收链路里,
Accept Gate同时承担了两类职责:例如是否有可见输出、todo 是否进入合理状态。
例如是否发生 workspace 写入、是否执行过命令、文件是否存在、内容是否匹配等。
这导致了几类问题:
Accept Gate通过查询RuntimeFacts判定“任务是否做对”,但 facts 只能说明“发生过什么”,不能证明“结果是否正确”。Plan.Verify由模型自己生成,系统再按模型生成的条件验收,存在“模型自己出题、自己答题”的闭环偏差。Accepted / Failed两个终态,模型没有机会根据失败原因继续修复。before_completion_decision这类仅观测、不影响 loop 的 hook point 缺少明确价值,容易扩大无效 API 面。RuntimeFacts还承载了部分与验收无关的聚合数据,例如SubAgentSnapshot,导致职责混杂。解决方案
本次改动将完成验收链路调整为:
核心决策:
Hook 先于 Accept Gate
accept_gate支持 block,用户可以通过脚本真正决定“是否放行”。Accept Gate 收缩为系统预检
新增 Continue 路径
删除 Plan.Verify
verify字段由反序列化自然忽略。删除 RuntimeFacts 验收体系
恢复独立的 SubAgentSnapshot
RuntimeFacts。runState独立维护子代理聚合计数,并继续向 Gateway / TUI 暴露。具体修改范围
1. Accept Gate 重构
涉及:
internal/runtime/acceptgate/internal/runtime/acceptgate_runtime.gointernal/runtime/controlplane/stop_reason.go主要改动:
OutcomeContinue与ContinueHint。2. Hook 系统增强
涉及:
internal/runtime/hooks/internal/runtime/user_hooks.gointernal/runtime/repo_hooks.gointernal/config/runtime_hooks.go主要改动:
HookPointAcceptGate。accept_gate支持 block。3. Run Loop 调整
涉及:
internal/runtime/run.gointernal/runtime/acceptance_continue.gointernal/runtime/state.go主要改动:
Hook -> Accept Gate。4. 删除 Plan.Verify
涉及:
internal/session/plan.gointernal/runtime/planning.gointernal/context/source_plan_mode.go主要改动:
AcceptCheck类型体系。PlanSpec.Verify、SummaryView.Verify。5. 删除 RuntimeFacts 验收链路
涉及:
internal/runtime/facts/internal/runtime/toolexec.gointernal/runtime/runtime_snapshot.go主要改动:
facts_updated相关事件与桥接。6. 独立恢复 SubAgentSnapshot
涉及:
internal/runtime/subagent_snapshot.gointernal/runtime/runtime_snapshot.gointernal/runtime/toolexec.gointernal/gateway/contracts.gointernal/cli/gateway_runtime_bridge.gointernal/tui/services/...internal/tui/core/app/update.go主要改动:
runState内独立维护 subagent 聚合计数。spawn_subagent结果回灌后更新 snapshot。subagent_snapshot_updated与RuntimeSnapshot.SubAgents。RuntimeFacts。预期收益
1. 验收职责更清晰
2. 真实验证能力增强
go testgo build3. 模型可自我修复
4. 纯问答体验更自然
5. 架构更干净
Plan.Verify和RuntimeFacts后,完成链路更短、更直接。SubAgentSnapshot从 facts 中解耦,职责边界更清楚。测试覆盖
本次补充和更新了以下场景:
verify字段时仍可正常读取SubAgentSnapshot聚合、事件发射、Gateway / TUI 恢复链路后续建议
before_completion_decisionhook point,避免保留无效 API 面。