feat(agent): add executor evidence v2 contract
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
|---|---|---|---|---|
|
||||
| 2026-07-05 | diagnosis-playbook-skills | Agent Skill/Playbook | read_skill, diagnosis playbook, progressive disclosure, payment timeout, MySQL pool, Redis timeout | openspec/changes/diagnosis-playbook-skills | implemented |
|
||||
| 2026-07-07 | executor-evidence-output-contract | Chat质量门禁/证据归因 | Executor structured output, evidence bindings, Verifier structured claims, LOW_CONFID, hallucination | openspec/changes/archive/2026-07-07-executor-evidence-output-contract | archived |
|
||||
| 2026-07-07 | executor-v2-output-contract | Chat质量门禁/证据归因 | executor_evidence_v2, user_facing_answer removal, diagnosis_summary removal, structured renderer | openspec/changes/archive/2026-07-07-executor-v2-output-contract | archived |
|
||||
| 2026-07-06 | rag-eval-pipeline-closure | RAG/评测/回归闭环 | lookupResult fixture, LookupKnowledgeTool snapshot, evidenceBlocks, contextPack, retrievalTrace, rerankTrace, baseline diff, fallback case | devflow/projects/2026-07-06-rag-eval-pipeline-closure | archived |
|
||||
| 2026-07-06 | modular-rag-pipeline | RAG/Agent工具/证据链 | modular RAG, lookup_knowledge, evidenceBlocks, contextPack, rerank, retrievalTrace, L0 hint, unfiltered retry | openspec/changes/archive/2026-07-06-modular-rag-pipeline | archived |
|
||||
| 2026-07-05 | mvp-demo-interview-runbook | MVP Demo/Interview | Plan C, payment timeout, runbook, trace checklist, demo script | openspec/changes/archive/2026-07-05-mvp-demo-interview-runbook | archived |
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
# Acceptance: executor-v2-output-contract
|
||||
|
||||
## Implementation Result
|
||||
|
||||
Completed stage one of Executor Structured Output V2.
|
||||
|
||||
- Executor prompt now emits `executor_evidence_v2`.
|
||||
- Executor output no longer includes `diagnosis_summary` or `user_facing_answer`.
|
||||
- ChatService PASS path renders V2 structured output into readable Chinese.
|
||||
- VerifierInputHook remains parse-only and accepts V2 output without final-expression fields.
|
||||
|
||||
## Static Verification
|
||||
|
||||
- `cmd /c openspec validate executor-v2-output-contract`
|
||||
- Result: passed.
|
||||
- Coverage: OpenSpec syntax and change validity.
|
||||
|
||||
## Script Verification
|
||||
|
||||
- `mvn "-Dtest=VerifierInputHookTest,ChatServiceSequentialAgentTest" test`
|
||||
- Result: passed.
|
||||
- Coverage: VerifierInputHook V2 parsing; ChatService PASS rendering for V2; existing sequential workflow tests.
|
||||
|
||||
## Browser / Manual Verification
|
||||
|
||||
Not run. This stage changes backend prompt/runtime contract and unit-level behavior only.
|
||||
|
||||
## Unverified
|
||||
|
||||
- Full live application run with a real LLM.
|
||||
- MySQL trace inspection after a real chat session.
|
||||
|
||||
Reason: Stage one is covered by focused unit tests; live verification is more useful after Gatekeeper and Composer phases.
|
||||
|
||||
## Remaining Work
|
||||
|
||||
- Phase two: Gatekeeper in `VerifierInputHook`.
|
||||
- Phase three: Verifier V2 `claim_checks`.
|
||||
- Phase four: Composer.
|
||||
- Phase five: eval fixtures and full audit closure.
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
# Brief: executor-v2-output-contract
|
||||
|
||||
## Background
|
||||
|
||||
`executor_evidence_v1` still made Chat Executor produce both evidence attribution and final user-facing prose through `diagnosis_summary` and `user_facing_answer`.
|
||||
|
||||
This kept Executor in a "diagnose and narrate" role and left room for unsupported conclusions to appear before later verification and composition stages.
|
||||
|
||||
## Goal
|
||||
|
||||
Narrow Chat Executor output to `executor_evidence_v2`: structured diagnostic material only, with final expression removed from Executor.
|
||||
|
||||
## Scope
|
||||
|
||||
- Update Chat Executor prompt to emit `executor_evidence_v2`.
|
||||
- Remove `diagnosis_summary` and `user_facing_answer` from Executor output.
|
||||
- Keep `claims`, `hypotheses`, `recommended_actions`, `missing_info`, and evidence bindings.
|
||||
- Add temporary ChatService rendering for PASS + V2 output so normal users do not see raw JSON.
|
||||
- Preserve V1 `user_facing_answer` extraction for compatibility.
|
||||
|
||||
## Non-Goals
|
||||
|
||||
- No Gatekeeper implementation.
|
||||
- No Verifier V2 `claim_checks`.
|
||||
- No Composer.
|
||||
- No Planner changes.
|
||||
- No database schema changes.
|
||||
- No evidence tool signature changes.
|
||||
|
||||
## Related OpenSpec
|
||||
|
||||
`openspec/changes/archive/2026-07-07-executor-v2-output-contract/`
|
||||
@@ -0,0 +1,39 @@
|
||||
# Decisions: executor-v2-output-contract
|
||||
|
||||
## Key Decisions
|
||||
|
||||
### Executor V2 removes final-expression fields
|
||||
|
||||
Decision: Chat Executor final output now uses `executor_evidence_v2` and must not include `diagnosis_summary` or `user_facing_answer`.
|
||||
|
||||
Reason: Executor should collect evidence and produce structured diagnostic material, not write final user-facing conclusions.
|
||||
|
||||
### Temporary renderer bridges the gap before Composer
|
||||
|
||||
Decision: `ChatService` renders V2 structured fields into readable Chinese only when Verifier returns `PASS`.
|
||||
|
||||
Reason: Composer is a later phase, but external users must not receive raw JSON during this intermediate stage.
|
||||
|
||||
### V1 compatibility remains
|
||||
|
||||
Decision: Existing V1 `user_facing_answer` extraction remains.
|
||||
|
||||
Reason: It keeps old tests and any lingering V1 output compatible while the staged migration continues.
|
||||
|
||||
### Gatekeeper and Verifier V2 are deferred
|
||||
|
||||
Decision: This phase does not add Gatekeeper or `claim_checks`.
|
||||
|
||||
Reason: The user requested phase-by-phase implementation with archive and commit after each phase. Gatekeeper is phase two.
|
||||
|
||||
## Interface Impact
|
||||
|
||||
- Internal Agent output contract: L4, because fields are removed.
|
||||
- Verifier payload: L2, because raw `executor_final_answer` and parsed `executor_structured_output` remain.
|
||||
- External Chat answer: compatible intent; users still get readable Chinese.
|
||||
|
||||
## Risks
|
||||
|
||||
- The temporary renderer is not a full Composer and should be replaced in the Composer phase.
|
||||
- Verifier prompt still uses V1 `facts_checked`; Verifier V2 is a later phase.
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
# Evidence: executor-v2-output-contract
|
||||
|
||||
## Context Used
|
||||
|
||||
- `devflow/projects/2026-07-07-executor-evidence-output-contract`: V1 evidence-attribution contract kept `user_facing_answer`.
|
||||
- `devflow/projects/2026-07-02-chat-verifier-agent`: Verifier consumes explicit inputs and should not see intermediate reasoning.
|
||||
- `devflow/projects/2026-07-04-evidence-trace-hardening`: evidence summaries and tool invocation references are the evidence foundation.
|
||||
- `mvp/issues/executor-structured-output-v2.md`: staged implementation design; stage one is Executor V2 output contract.
|
||||
|
||||
## Code Evidence
|
||||
|
||||
- `src/main/resources/prompts/chat-executor-prompt.md`: V2 contract now uses `answer_version="executor_evidence_v2"` and removes final-expression fields.
|
||||
- `src/main/java/com/superbiz/agent/service/ChatService.java`: PASS path now tries V1 `user_facing_answer`, then renders V2 structured output to readable Chinese.
|
||||
- `src/main/resources/prompts/chat-verifier-prompt.md`: `user_facing_answer` is now described as compatibility-only.
|
||||
- `src/test/java/com/superbiz/agent/hook/VerifierInputHookTest.java`: V2 structured output without `user_facing_answer` parses successfully.
|
||||
- `src/test/java/com/superbiz/agent/service/ChatServiceSequentialAgentTest.java`: PASS + V2 output renders Chinese and does not expose raw JSON.
|
||||
|
||||
## Key Finding
|
||||
|
||||
The previous V1 contract intentionally kept `user_facing_answer`, but the V2 staged design intentionally removes it. This is an internal Agent contract break, mitigated by a temporary renderer until Composer is implemented.
|
||||
|
||||
Reference in New Issue
Block a user