feat(#16): final output validation and artifact retention - #124
feat(#16): final output validation and artifact retention#124qinhaihong-red wants to merge 2 commits into
Conversation
Add report-time final_output schema validation, collect real adapter artifacts into run-owned paths, and support artifact_cleanup.keep_last_runs with a conservative default. Fixes: #16
Review pass: Standards / SpecStandards
Spec
Summary: Standards found 2 required issues; Spec found 2 required issues. The highest-risk issue is artifact capture/retention misattribution because it can persist incorrect trace evidence for parallel real-agent runs. |
Code review and quality passFindings
Axis notes
VerdictRequest changes. The implementation adds useful hardening surface, but artifact ownership/retention and group-report final-output behavior need fixes before merge. |
Use persisted run creation time for artifact retention so pruning old artifact directories cannot mutate retention ordering. Scope real-adapter artifact discovery to a node-owned working directory, carry final-output validation through Run Group reports, and assert the shipped real fan-out workflow renders final output and trace evidence. Refs: #16
Implements the #16 v0.1 hardening slice. With this change, every #16 acceptance criterion is met.
What's in this change
Slice 1 — report-time final output validation (
feat(report))final_output(node,field,schema) so a Workflow can declare the persisted output that reports should treat as the final result.caw reportvalidates that value against the declared JSON Schema at report time and renders the validation result in JSON, JSONL, text, and Markdown.Slice 2 — real adapter artifact capture + run-owned collection (
feat(adapters),feat(executor))claude.printandcodex.execnow report files created or modified by a writable Agent CLI run.artifacts/<node-id>/inside the run directory and persists only those run-owned copies in State.Slice 3 — configurable artifact retention (
feat(executor))artifact_cleanup.keep_last_runsas a conservative keep-last-N policy.Slice 4 — sample and docs sync (
docs)final_output.Tests / gates
claude.printandcodex.exec; shipped real fan-out workflow report evidence for final output, artifacts section, and trace.env UV_CACHE_DIR=/tmp/caw-uv-cache uv run ruff checkenv UV_CACHE_DIR=/tmp/caw-uv-cache uv run ruff format --checkenv UV_CACHE_DIR=/tmp/caw-uv-cache uv run mypyenv UV_CACHE_DIR=/tmp/caw-uv-cache uv run pytest -m 'not e2e'— 514 passed, 14 deselectedenv UV_CACHE_DIR=/tmp/caw-uv-cache CAW_E2E_AGENT=codex uv run pytest -m e2e— 14 passed, 514 deselected (passed outside the sandbox; the sandboxed run failed because Codex CLI could not initialize its app-server client withOperation not permitted)#16 acceptance criteria — all met
claude.print,codex.exec) capture files a writable agent run produces and populateAgentResult.artifactssymmetricallyCloses #16.