fix(stage): align session export render cap with artifact bound

Six computed Flutter runs stopped at the export handoff gate because the
rendered session.html cap was 2 MiB while their complete sessions (well inside
the 8 MiB source read bound) rendered between 2.25 and 4.28 MiB once html
escaping and the readable projection duplicated native text.

Raise SessionExportFileLimit to 8 MiB, the server's existing per-artifact file
bound, so a complete export is still listed and served. Normal export
verification, versioned repair and the handoff gate keep using the single
shared constant. The source read bound is unchanged, and an over-cap render is
still visibly truncated and recorded partial.

Add focused regressions for a complete export above the old cap, an over-new-cap
file rejected as partial, repair above the old cap leaving original evidence
untouched, the gate accepting the larger repair, and the constant staying inside
the artifact file bound. Update the artifact, handoff-gate and operations docs
and record the diagnosis in docs/notes/session-export-render-cap.md.
This commit is contained in:
2026-10-21 15:26:29 +01:00
parent 0a00526692
commit 22801a9b06
9 changed files with 261 additions and 12 deletions
+7 -4
View File
@@ -97,10 +97,13 @@ no special casing.
`opencode session export <id>`. Both reuse the same invocation helper and
session-ID/messages validation as the transcript readback. The file is the
harness's real session, never a reconstruction.
- Bounds: the source read is capped at 8 MiB and the rendered file at 2 MiB. When
either is cut, the file carries a visible truncation banner near the start and
the end and the step records `truncated: true`; a truncated export is never
described as whole.
- Bounds: the source read is capped at 8 MiB and the rendered file at 8 MiB,
matching the ordinary per-artifact file bound. The rendered file can exceed
its source because html escaping and the readable projection keep native text
more than once, so the previous 2 MiB render cap cut complete sessions that
were well inside the source bound. When either bound is exceeded, the file
carries a visible truncation banner near the start and the end and the step
records `truncated: true`; a truncated export is never described as whole.
- Evidence: the step records `session_export` (`session_id`, `backend`, `source`,
`html`, `html_bytes`, `messages`, `truncated`, `diagnostic`), so
`pipelines inspect RUN_ID --json` shows what was written without reading the