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.
2.4 KiB
Session export: rendered-file cap aligned with the artifact bound
Problem
Six computed Flutter runs (34, 37, 39, 42, 49, 50) reached Code visit 1 with a
successful, quiescent agent session but stopped at the export handoff gate. Each
recorded session_export.status: partial, html_bytes: 2097152,
truncated: true; the manual versioned repair of run 34 hit the same exact size.
The sessions had completed their computation, so a stage rerun was not the right
recovery.
A read-only inspection of the recorded session rows showed the original native data for those six sessions was between 1,083,391 and 2,111,470 bytes (the complete HTTP export envelope for one of them was 2,126,449 bytes). All were well inside the existing 8 MiB source read cap. The binding limit was the 2 MiB rendered-file cap: html escaping and the readable projection keep native text more than once, so an ordinary session can render larger than its source. Re-exporting the six exact sessions read-only into scratch directories with the new cap produced complete, untruncated files of 2,252,874 to 4,276,358 bytes.
Change
internal/stage/session_export.go raises SessionExportFileLimit from 2 MiB to
8 MiB. That value is the same as the server's ordinary per-artifact file bound
(maxArtifactFileBytes in internal/server/artifacts.go), so a complete export
remains listed and served instead of being cut below the bound that the artifact
inventory already enforces.
The source read remains capped by SessionExportSourceLimit (the single
opencode.MaxSessionExport value, 8 MiB). Normal export verification, versioned
export repair and the handoff gate all use SessionExportFileLimit, so they now
share one larger bound. The export still refuses to overwrite an existing file,
still marks any cut with a visible leading and trailing banner, and still reports
truncated: true and status: partial; nothing treats a partial export as
complete.
Checks
Focused stage and server regressions cover a complete export above the old 2 MiB
cap but inside the new cap, a file above the new cap rejected as partial with the
verification diagnostic, repair accepting the larger complete file while the
original evidence stays unchanged, and the constant staying within the ordinary
artifact file bound. Focused stage/server suites and go build ./... plus
go vet ./... are run before landing; see the delivery report for exact results.