Enforce runtime report contracts and recoverable session exports
This commit is contained in:
+20
@@ -878,3 +878,23 @@ run test uses a controlled executor, not a model). The isolated installed CLI
|
||||
also exercised the actual OpenCode API's session creation and skill activation,
|
||||
while capturing interactive launch arguments to avoid a model turn. Full
|
||||
model-driven authoring and Linux execution are **not tested**.
|
||||
|
||||
## Per-run report contract
|
||||
|
||||
`pipelines run NAME PROMPT --output-format html` requires a server-written
|
||||
`public/report.html` before run success; `--output-format markdown` requires
|
||||
`public/report.md`. Omit the option for historical behavior. The `run_pipeline`
|
||||
wire request and returned run record carry `output_format` (`html` or `markdown`),
|
||||
and retries inherit it. Request-key replays must retain the same format.
|
||||
Reports use nonempty terminal text output and are bounded to 2 MiB; missing,
|
||||
empty, unsafe or unverifiable files fail the run. This checks structure, not
|
||||
factual correctness. See [audit notes](notes/audit-deliverables.md).
|
||||
|
||||
`pipelines repair-session-export RUN_ID SEQUENCE [--json]` asks the runtime to
|
||||
read back that settled visit's exact recorded native session/backend. It never
|
||||
executes a stage or changes a definition. It writes a versioned repair artifact
|
||||
and appends evidence without replacing original files or outcomes. The protocol
|
||||
command is `repair_session_export` with `run_id` and `export_sequence`; the reply
|
||||
is a run detail containing each visit's `session_export_repairs`. CLI JSON emits
|
||||
the repair record with explicit completeness `status`, and incomplete repair
|
||||
exits nonzero. Recovery still depends on upstream session availability.
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
# Explicit run reports and session export completeness
|
||||
|
||||
Launch with `pipelines run NAME PROMPT --output-format html` (or `markdown`),
|
||||
or choose Report format in the web run dialog. The wire field is
|
||||
`output_format: "html" | "markdown"`; omission preserves prior behavior. It is
|
||||
stored with the run, compared for request-key replay and inherited by retries.
|
||||
This never changes a pipeline definition and is not inferred from prompt text.
|
||||
|
||||
Before success, the server takes the first nonblank string in the terminal
|
||||
output's `markdown`, `report`, `result`, `summary`, `message` fields, renders a
|
||||
report deterministically and records the verified artifact on the terminal
|
||||
visit. Fixed filenames are `public/report.html` and `public/report.md`.
|
||||
Both source and rendered output are capped at 2 MiB. Existing targets and
|
||||
symlinked directories are refused; reports are not overwritten. Missing or
|
||||
empty textual output, invalid targets and failed verification fail the run.
|
||||
HTML has inline styling, no executable raw HTML, and a restrictive content
|
||||
security policy preventing external resource loading. This is a structural
|
||||
file contract, **not factual validation** or proof that every task was fulfilled.
|
||||
|
||||
Session export is owned by the runtime, not the model stage. No stage prompt,
|
||||
definition or execution contract changes. Ownership is recorded during execution;
|
||||
export evidence also snapshots the original session ID/backend/directory before
|
||||
the run finishes. Evidence records `status` as `complete`, `empty`, `failed`,
|
||||
`partial`, or `unavailable`, plus attempt count and capture time. Zero-message
|
||||
readbacks are retried within the runtime's 10-second export budget and then
|
||||
recorded as **empty with a warning**, without producing success-looking HTML.
|
||||
Known temporary transport/store failures and interrupted JSON with verified
|
||||
identity can retry (at most 3 attempts). Wrong-session responses, unsupported
|
||||
envelopes and permanent CLI failures do not retry. A 200 ms delay does not prove
|
||||
that settling writes caused an invalid readback. Expected array/data envelopes
|
||||
are normalized, always retaining exact session identity validation.
|
||||
|
||||
`pipelines repair-session-export RUN_ID SEQUENCE --json` invokes the
|
||||
`repair_session_export` protocol command (`run_id`, `export_sequence`). It is
|
||||
read-only to the native session: no generation, resumption, interruption or
|
||||
stage execution. It requires a settled run/session and exact original ownership
|
||||
metadata, never guesses the backend, and appends a repair attempt to the run.
|
||||
Successful readback writes `public/session-repair-SEQUENCE-RANDOM.html` and
|
||||
records its bounded inventory entry. Original exports/evidence and run outcomes
|
||||
are preserved. Failed/empty/partial attempts remain inspectable warnings; CLI
|
||||
JSON returns the repair record itself and exits nonzero for incomplete evidence.
|
||||
There are at most 20 manual repair attempts per visit. Repairs cannot guarantee
|
||||
recovery if the upstream session or original directory is gone. The web pane
|
||||
explains original failure and lists repair attempts/links separately.
|
||||
|
||||
No production service, live run or historical data was modified for this audit.
|
||||
Unit/fixture tests cover reports, failure gates, retry inheritance, idempotency,
|
||||
migration, transient/permanent export readback, empty-export diagnostics and
|
||||
versioned repairs preserving originals. Browser screenshots are not captured; new web states
|
||||
remain partial pending a permitted isolated browser review.
|
||||
Reference in New Issue
Block a user