feat: 实现 runtime 验收闭环与 verifier 双门控#439
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! |
|
/simplify |
完成情况已按要求先读取评论日志并处理未解决 review 项,然后调用 本次落地:
验证
提交与推送
未执行项:未跑全量 |
- deny shell metacharacter command chaining in verifier executor - enforce workdir boundary checks for file/content verifiers - add regression tests for traversal and command bypass Generated with [codeagent](https://github.com/qbox/codeagent) Co-authored-by: Cai-Tang-www <106404101+Cai-Tang-www@users.noreply.github.com>
|
@xgopilot 批判性review整个PR,分析所有潜在风险点,找出所有漏洞,确保每个地方的修改不是退步的,方案上的设计 |
Critical Findings
High Findings
Medium Findings
Scope本轮仅做批判性审查,未实施代码修改或测试执行。 |
fix(verify): harden verifier security checks
|
@Cai-Tang-www is attempting to deploy a commit to the pionxe's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
/simplify |
结果汇总已按要求完成:先检查历史评论中的未解决 review 点,评估后修复值得修复的问题,并调用 本次修复内容:
验证:
提交与推送:
未执行项:
|
|
/code 提高测试率到95 |
完成结果已按“提高测试率到95”要求补充并提交一轮高优先级测试覆盖增强,重点针对当前 PR 低覆盖新增模块。 本次新增/扩展测试:
验证结果:
提交与推送:
说明:
|
Generated with [codeagent](https://github.com/qbox/codeagent) Co-authored-by: Cai-Tang-www <106404101+Cai-Tang-www@users.noreply.github.com>
test: improve verification and acceptance coverage
|
@xgopilot 测试率还是不够,继续提高测试率,覆盖率到100 |
Critical Findings
High Findings
Medium Findings
Scope本轮仅做批判性审查,未做代码修改。 |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
/code 测试率还是不够,继续提高测试率,覆盖率到100 |
覆盖率提升结果已按你的要求继续补测试并推送到当前 PR 分支( 本次新增/增强测试涉及:
验证结果:
当前状态:
已推送提交:
|
|
/code 测试率还是不够,继续提高测试率,覆盖率到100,推送到我的分支 |
更新结果已继续补测试并推送到你的分支,核心覆盖增强已落地:
本地验证
提交与推送
说明本地补测后仍有一部分新增语句覆盖缺口集中在 |
Generated with [codeagent](https://github.com/qbox/codeagent) Co-authored-by: Cai-Tang-www <106404101+Cai-Tang-www@users.noreply.github.com>
test: improve coverage for verification and acceptance
背景
当前 runtime 仍存在“模型发出 final 即可结束”的路径,缺少统一的验收与完成判定闭环。
本 PR 将主链路升级为
completion gate + verification gate双门控,并收敛为单一终态裁决输出。目标
beforeAcceptFinal。accepted / continue / incomplete / failed。变更范围
1) Runtime Finalization / Hook
internal/runtime/final_acceptance.go,引入beforeAcceptFinal。internal/runtime/run.go改造 final 分支:先验证再决定终态,不再直接 completed。continue分支注入 reminder,失败/未完成分支统一收口并落盘。2) Acceptance 层(唯一收口表达)
internal/runtime/acceptance/*:types.go:AcceptanceStatus/Decision/Input。engine.go:聚合规则(fail > hard_block > soft_block > pass)。policy.go:task type 到 verifier 映射。decider.go:acceptance -> terminal status 映射。stop_reason.go/error_class.go:复用统一枚举。3) Verifier 引擎
internal/runtime/verify/*:orchestrator.go、types.go、verifier.go。todo_convergence。file_exists/content_match/command_success/git_diff/build/test/lint/typecheck。execution_policy.go:非交互执行、白名单/拒绝名单、只读 git 子命令限制。4) Controlplane 收敛
internal/runtime/controlplane/stop_reason.go:扩展并统一 stop reason 集合。internal/runtime/controlplane/decider.go:固定优先级并支持 pre-decided 输入。internal/runtime/controlplane/phase.go:verify phase 升级为流水线节点(支持plan -> verify)。5) 配置与兼容
internal/config/verification.go。internal/config/runtime.go接入 verification 配置。runtime.verification.enabled/final_intercept改为可区分“未配置 vs 显式 false”(避免默认值覆盖显式关闭)。compatibility_fallback并在事件/摘要中显式标注。6) Todo 迁移兼容
internal/session/todo.go增加required、blocked_reason,并确保旧会话默认值兼容。internal/tools/todo/*对齐 schema 与 patch 映射。7) TUI / 协议适配
internal/runtime/events.go新增:verification_startedverification_stage_finishedverification_finishedverification_completedverification_failedacceptance_decidedinternal/tui/services/runtime_contract.go、gateway_stream_client.go、internal/tui/core/app/update.go同步枚举与 payload,兼容旧 reason 形式。8) 文档
新增 7 篇设计与迁移文档:
docs/task-acceptance-design.mddocs/verifier-engine-design.mddocs/runtime-finalization-flow.mddocs/verifier-configuration-and-policy.mddocs/todo-schema-migration.mddocs/stop-reason-and-decision-priority.mddocs/compatibility-fallback-lifecycle.md关键行为变化
测试
新增/更新重点测试:
internal/runtime/final_acceptance_test.gointernal/runtime/acceptance/engine_test.gointernal/runtime/verify/todo_convergence_test.gointernal/runtime/verify/execution_policy_test.gointernal/session/todo_compatibility_test.gointernal/config/runtime_test.go(含显式 false 配置回归)本地回归(关键包)通过:
go test ./internal/runtime/... -count=1go test ./internal/session ./internal/tools/todo ./internal/tui/services ./internal/tui/core/app -run "ModelScope|StopReason|OpenResource" -count=1go test ./internal/config -run "TestRuntimeConfigVerificationDefaultsApplied|TestRuntimeConfigVerificationExplicitFalsePreserved" -count=1说明:Windows 环境存在仓库既有并发临时目录/clipboard/backpressure 相关偶发测试不稳定,已独立复核本 PR 关联关键用例通过。
风险与回滚
compatibility_fallback,并通过统一 stop reason + 事件可观测。runtime.verification.enabled=false快速切回兼容路径(同时保留结构化事件标记)。