Files
SuperBizAgent-java/mvp/architecture/harness-quality-gates.md
T

2.2 KiB
Raw Blame History

Harness 与质量门禁

更新日期:2026-07-22 状态:当前可运行架构

1. Harness 定位

Harness 是确定性执行边界,不承担业务推理。它统一管理:

  • RunContext、deadline、first-terminal-wins lifecycle 与客户端取消。
  • 模型调用、Tool 调用、Token、字节数和单 Tool 次数预算。
  • 类型化 retry policy;Diagnosis Agent 和 Tool 调用不自动重试。
  • ToolBoundary、canonical invocation 与 Agent projection。
  • EvidenceGuard、Evidence repair、SemanticGuard 与 Release Policy。
  • metadata-only durable audit。

2. ToolBoundary

framework tool_call_id
  -> exact Run / schema / authorization / read-only / budget
  -> backend execution
  -> raw response -> Redis canonical invocation
  -> projector -> bounded agent_result
  -> ToolInvocation durable metadata audit
  -> Agent observation

Redis canonical invocation 可在 TTL 内保存完整 request/raw_response/agent_result,受独立前缀、容量和 Harness-only 访问保护。Durable audit 只保存 identity、Tool 名、状态、耗时和字节数;audit 写入失败可观测但不改变 canonical Tool 结果。

3. EvidenceGuard

EvidenceGuard 不调用模型。它校验 Draft schema、analysis ID、当前 Run Tool ownership、READY 状态、evidence status 和每条结论的引用闭包,并生成只包含 Agent projection 的 verified snapshot。

4. SemanticGuard

SemanticGuard 使用隔离的单轮模型调用,只接收原始 query、完整 Draft 和 verified snapshot。它无 Tool、无记忆、不访问 Redis、不改写报告;技术失败最多按相同输入重试一次,仍失败则安全降级。

5. Release Policy

  • SUPPORTED:发布 Diagnosis Agent 原始安全 Draft 的 typed report。
  • UNSUPPORTED 或 evidence failure:发布固定 SAFE_FALLBACK。
  • technical failure:发布 stable failure,不泄漏内部异常。
  • cancel/timeout:结束 exact Run,禁止 late content。

6. Audit 安全

AgentStep 不保存 Prompt、消息正文、模型正文、Tool arguments 或 Thought。ToolInvocation 不保存完整 request、SQL/日志 query、raw response 或 Agent projection。应用日志不得打印这些字段。