feat(agent): add composer final answer
This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
# Decisions
|
||||
|
||||
## Scope Decision
|
||||
|
||||
Stage four is limited to Composer final-answer generation and routing.
|
||||
|
||||
Reason: Gatekeeper and Verifier contracts were stabilized in earlier stages; this phase should only close the final-expression path.
|
||||
|
||||
## Composer Responsibility
|
||||
|
||||
Composer is an expression layer, not a diagnosis layer.
|
||||
|
||||
It may rephrase and organize only filtered material. It must not call tools, introduce new facts, rejudge root cause, or read raw Executor/tool output.
|
||||
|
||||
## Filtering Decision
|
||||
|
||||
`ChatService` owns Composer input filtering:
|
||||
|
||||
| Verifier classification | Composer handling |
|
||||
|---|---|
|
||||
| `direct_observation` | `allowed_claims` |
|
||||
| `reasonable_inference` | `allowed_claims`, with bounded wording |
|
||||
| `overstated` | `allowed_hypotheses` or `missing_info` |
|
||||
| `unsupported` | `missing_info` |
|
||||
| `external_unknown` | `missing_info` |
|
||||
| `contradicted` | `missing_info` / REJECT-safe output |
|
||||
|
||||
For REJECT, `allowed_hypotheses` is always empty.
|
||||
|
||||
## Fallback Decision
|
||||
|
||||
Malformed Composer output falls back to deterministic rendering from filtered Composer input.
|
||||
|
||||
Fallback must never expose:
|
||||
|
||||
- raw Composer JSON;
|
||||
- raw Executor JSON;
|
||||
- Executor `user_facing_answer`;
|
||||
- full unscreened tool output.
|
||||
|
||||
## Audit Decision
|
||||
|
||||
No new table is added. Composer output is persisted under:
|
||||
|
||||
```text
|
||||
diagnosis_session.self_evaluation.verifier_evaluation.composer_output
|
||||
```
|
||||
|
||||
The audit snapshot is intentionally compact and stores status plus parsed user-facing fields.
|
||||
|
||||
## Apply Fix Record
|
||||
|
||||
Initial targeted verification exposed test drift:
|
||||
|
||||
- test file had a UTF-8 BOM and failed Java compilation;
|
||||
- scripted chat model did not recognize `COMPOSER_TEST_PROMPT`;
|
||||
- older tests expected three-Agent execution and temporary V2 renderer behavior;
|
||||
- LOW_CONFID assertions required indirect support to disappear instead of appearing as a possible direction.
|
||||
|
||||
Resolution: remove BOM, add Composer script branch, and update assertions to match the committed Composer contract.
|
||||
|
||||
## Interface Impact
|
||||
|
||||
L2 internal behavior change:
|
||||
|
||||
- external Chat API still returns a final answer string;
|
||||
- internal final-answer source changes from Executor/temporary renderer to Composer or safe fallback;
|
||||
- audit JSON gains `composer_output` under existing `self_evaluation`.
|
||||
|
||||
No database schema change.
|
||||
Reference in New Issue
Block a user