session export: write only session.html, retire the markdown export

A stage's session was exported twice, as session.md and session.html, and both
files were presented. It is now one html file; the markdown export is retired.

- internal/stage/session_export.go: ExportSession renders and writes exactly one
  file, session.html, via writeSessionFile; renderSessionMarkdown and its helpers
  are gone; SessionExportResult carries HTML/HTMLBytes only. The source read, the
  8 MiB source / 2 MiB rendered bounds, the truncation banner, the
  never-overwrite rule and the honest empty-session handling are unchanged.
- internal/protocol/runs.go: SessionExport drops markdown/markdown_bytes (a
  record written before the change still decodes; unknown fields are ignored),
  and adds LegacySessionMarkdownArtifact with RunStep.PresentedArtifacts(), the
  one Go rule that hides the retired session.md from every artifact listing.
- internal/server/runner.go: evidence.Markdown/MarkdownBytes are no longer copied.
- internal/tui: the artifacts panel, the recorded count and the per-visit summary
  derive from PresentedArtifacts(), so the terminal never lists session.md.
- web/src/app.js: the spike's renderArtifacts applies the same filter.
- android: the Session section is the html export alone in a WebView — SessionView,
  the Markdown/HTML toggle and the session markdown path are removed;
  presentedArtifacts(step) filters the retired session.md out of the per-visit
  gallery, the run gallery and its count, the verdict/selection lists and the
  timeline indicator; data/protocol SessionExport drops the markdown fields.
- Tests pin the single html file, prove no session.md is written and that a
  pre-existing one is neither overwritten nor presented, and prove a legacy
  export record still loads and its session.md is hidden.

The legacy session.md of an older run stays on disk (dated evidence); it is only
no longer produced and no longer presented.

Checks (macOS, Go 1.24, Android Gradle 8.11.1, 18 Oct 2026): gofmt -l . prints
nothing; go build ./... && go vet ./... clean; go test ./internal/... ./cmd/...
-> 19 packages ok, 0 failures; node --check web/src/app.js ok and node --test
web/test -> 20/20; gradle --offline --no-daemon :app:assembleDebug
:app:testDebugUnitTest -> BUILD SUCCESSFUL.

Packaged references checked: internal/author/skill/references/delivery.md and
operations.md both described the session.md+session.html pair, so both are
updated here to describe the single session.html export and the retired, hidden
session.md. README.md and internal/author/skill/SKILL.md carry no session.md
reference and install.go's managed inventory is unchanged (no reference added or
removed). docs/notes/session-html-only.md records the remaining stale shared
documentation (docs/stage-artifacts.md, docs/app-integration-verification.md) for
the docs-fold writer; shared docs are not edited by this item.
This commit is contained in:
2026-10-18 10:06:49 +01:00
parent 5a4cfc2e9c
commit 95362134aa
25 changed files with 666 additions and 571 deletions
+6 -4
View File
@@ -17,11 +17,13 @@ with its own rules.
oversized file records nothing and never changes the verdict. Never invent an
artifact or claim a stage produced one — the server observes the directory after the
stage.
- An OpenCode-harness stage also gets its real session exported as `session.md` and
`session.html` in the same directory: bounded (8 MiB source, 2 MiB per file), with
- An OpenCode-harness stage also gets its real session exported as one file,
`session.html`, in the same directory: bounded (8 MiB source, 2 MiB rendered), with
a visible truncation banner and `session_export.truncated` when cut; the step's
`session_export` records the files. Export failures and Pi (no native export path)
record a diagnostic and never fail the run or change the stage result.
`session_export` records the file. The `session.md` export is retired — never
written, never presented (a run recorded before the change still lists it and every
listing hides it). Export failures and Pi (no native export path) record a
diagnostic and never fail the run or change the stage result.
## Publish a build to the LAN
+13 -7
View File
@@ -236,16 +236,22 @@ traversal, absolute paths, symlink escapes and unknown runs/steps.
- When an OpenCode-harness model stage finishes, the server exports its real
session read-only (v1 `opencode export <id>`, v2 `opencode session export <id>`)
and writes `session.md` and `session.html` into the same `<run>/<step>` artifacts
directory; they list and serve like any other artifact.
- The source read is capped at 8 MiB and each file at 2 MiB; a cut source or a cut
rendered file carries a visible truncation banner at both ends and
and writes exactly one file, `session.html`, into the same `<run>/<step>` artifacts
directory; it lists and serves like any other artifact.
- The `session.md` export is retired: nothing writes it any more and it is never
presented. A run recorded before the HTML-only change still lists `session.md`
among its stored artifacts (dated evidence kept on disk, not deleted); every
listing — app, TUI, web spike — hides it rather than showing it beside the html.
- The source read is capped at 8 MiB and the rendered file at 2 MiB; a cut source or
a cut rendered file carries a visible truncation banner at both ends and
`session_export.truncated: true`, and a truncated export is never called whole.
- The step records `session_export` (`session_id`, `backend`, `source`, file names,
sizes, `messages`, `truncated`, `diagnostic`) in `inspect RUN_ID --json`.
- The step records `session_export` (`session_id`, `backend`, `source`, the html
file name, `html_bytes`, `messages`, `truncated`, `diagnostic`) in
`inspect RUN_ID --json`. A record written before the change still carried
`markdown` and `markdown_bytes`; readers ignore those fields.
- A failed export, or a Pi stage with no native export path, records a diagnostic
(Pi: `source: "unavailable"`) and never fails the run or changes the stage result.
An existing `session.md`/`session.html` is never overwritten.
An existing `session.html` is never overwritten.
### Operator-only retention