transcripts: a session's stream as a page, and a term for keeping it #25

Merged
mikluko merged 1 commit from transcripts into main 2026-11-16 05:44:27 +00:00
Owner

Spec-bb1.27. The registry already holds every frame the server saw with its time (#8); this puts the stream on a page and removes it when its term is out.

  • session.Registry.Transcript (card: Info, when it began, when it stopped; and the whole stream with the time of each event) and Purge(before) (ended sessions only, with events, instructions, marks, bundle), in a new file internal/session/transcript.go, agreed with roomcity-b8. No schema change.
  • chat.Transcript renders a stream as a room shows a session, through the same renderer with its limits lifted: tool output and permission detail whole, the owner's words in, the plan as it ended, a host-answered permission as a notice naming the option.
  • internal/transcripts: /-/<session> HTML (markdown with raw HTML dropped, CSP allowing no script), /-/<session>/raw as one JSON message a line, /-/ listing; read-only, no-store. Mounted on the page listener only; a test shows the network and runtime listeners answer 404.
  • [server] transcript_term (default 90 days), and a loop in serve that purges hourly.

Not here, and why:

  • The card has no room: marks are cleared when gc stops a session, so a mark would be gone when the transcript is wanted. The journal's notice links the room as it starts. If the card should name it, the room needs a place that outlives the stop.
  • Authorization is the proxy's: oauth2-proxy with the group admin, in the sandbox's manifests. The handler checks nothing, because the listener is loopback.
  • 'Done' (the journal's link opens a finished session of worker, whole, for a member of admin and refuses anyone else) waits for spec-bb1.23.

go test -race on transcripts, session, chat, serve and config passes; lint findings in the files I touched are the ones that were there.

Spec-bb1.27. The registry already holds every frame the server saw with its time (#8); this puts the stream on a page and removes it when its term is out. - `session.Registry.Transcript` (card: Info, when it began, when it stopped; and the whole stream with the time of each event) and `Purge(before)` (ended sessions only, with events, instructions, marks, bundle), in a new file `internal/session/transcript.go`, agreed with roomcity-b8. No schema change. - `chat.Transcript` renders a stream as a room shows a session, through the same renderer with its limits lifted: tool output and permission detail whole, the owner's words in, the plan as it ended, a host-answered permission as a notice naming the option. - `internal/transcripts`: `/-/<session>` HTML (markdown with raw HTML dropped, CSP allowing no script), `/-/<session>/raw` as one JSON message a line, `/-/` listing; read-only, no-store. Mounted on the page listener only; a test shows the network and runtime listeners answer 404. - `[server] transcript_term` (default 90 days), and a loop in serve that purges hourly. Not here, and why: - The card has no room: marks are cleared when gc stops a session, so a mark would be gone when the transcript is wanted. The journal's notice links the room as it starts. If the card should name it, the room needs a place that outlives the stop. - Authorization is the proxy's: oauth2-proxy with the group admin, in the sandbox's manifests. The handler checks nothing, because the listener is loopback. - 'Done' (the journal's link opens a finished session of worker, whole, for a member of admin and refuses anyone else) waits for spec-bb1.23. `go test -race` on transcripts, session, chat, serve and config passes; lint findings in the files I touched are the ones that were there.
transcripts: a session's stream as a page, and a term for keeping it
All checks were successful
test / changelog (pull_request) Successful in 6s
image / image (pull_request) Successful in 22s
test / go (pull_request) Successful in 53s
b7c19affcd
"Where transcripts are kept and how one is viewed": the registry already
holds every frame the server saw, with its time, and the prompts and the
changes in the session's life; this puts it on a page and removes it when its
term is out.

session: Registry.Transcript returns a session's card (its Info, when it
began and when it stopped) and its whole stream with the time of each event;
Registry.Purge removes the sessions that ended before a time, with their
events, instructions, marks and bundle. A session that has not ended is never
removed. No schema change.

chat: Transcript renders a stream as the room shows a session, through the
same renderer with its limits lifted: a tool call's output and a permission
request's detail are whole, the owner's own words are in, the plan is as it
stood at the end, and a permission answered by the host is a notice naming
the option.

transcripts: the page, mounted on the server's page listener alone, which
only the pod's authenticating proxy reaches: /-/<session> as HTML (the
agent's markdown with raw HTML dropped, a Content-Security-Policy that allows
no script), /-/<session>/raw as the stream, one JSON message a line, and /-/
for the sessions. It is read-only and sends no-store.

config and serve: [server] transcript_term, 90 days by default, and a loop
that purges once an hour.

Assisted-By: Claude <noreply@anthropic.com>
Author
Owner

Review for spec-bb1.27, of b7c19af. go vet and go test -race -count=3 on transcripts, session, chat, serve and config are green here. The page is safe as built: goldmark is used without its unsafe option, so raw HTML in an agent's text is dropped and a javascript: link is refused; the folds go through the template's own escaping; the policy allows no script; it is mounted on the page's loopback listener alone, which the proxy takes whole. It is read-only and the raw stream is what the registry holds, with each frame's own time. Not merged yet; one change, and one thing to write down.

1. Purge can take a new session's stream with the old one.
It picks the names in one statement and removes each in a transaction of its own, checking state = Ended only in the last delete, of the row in sessions:

Purge reads: `worker w1` ended long ago
gc starts `worker w1` afresh              a new row state Starting, its first instruction, its bundle
Purge's transaction for w1               deletes events, instructions, marks and bundle of the NEW start; the last delete finds no Ended row and removes nothing

The session then has no start nudge and nothing to stage. Make the delete of the sessions row, with its state = Ended, the first statement of the transaction, and go on only if it removed a row; with a test.

2. The card is three things short of the decision, not one.
"Where transcripts are kept" gives the card the city, the agent, gc's session id, the room, when it began and ended, and how it ended. You name the room as missing. gc's session id and how the session ended are missing too, for the same reason: nothing of the registry outlives the stop but the row and the stream. I do not hold the page for it, since it needs a place in the registry that roomcity-b8 owns, but write all three on spec-bb1.27 so that the ticket is not closed with one of them remembered. I report them to specs-18.

Noted, not a change here: an always-on agent's name never ends, so its stream is never purged and its page grows with every start afresh; Transcript reads the whole of it into memory.

Review for spec-bb1.27, of b7c19af. `go vet` and `go test -race -count=3` on transcripts, session, chat, serve and config are green here. The page is safe as built: goldmark is used without its unsafe option, so raw HTML in an agent's text is dropped and a `javascript:` link is refused; the folds go through the template's own escaping; the policy allows no script; it is mounted on the page's loopback listener alone, which the proxy takes whole. It is read-only and the raw stream is what the registry holds, with each frame's own time. Not merged yet; one change, and one thing to write down. **1. `Purge` can take a new session's stream with the old one.** It picks the names in one statement and removes each in a transaction of its own, checking `state = Ended` only in the last delete, of the row in `sessions`: Purge reads: `worker w1` ended long ago gc starts `worker w1` afresh a new row state Starting, its first instruction, its bundle Purge's transaction for w1 deletes events, instructions, marks and bundle of the NEW start; the last delete finds no Ended row and removes nothing The session then has no start nudge and nothing to stage. Make the delete of the `sessions` row, with its `state = Ended`, the first statement of the transaction, and go on only if it removed a row; with a test. **2. The card is three things short of the decision, not one.** "Where transcripts are kept" gives the card the city, the agent, gc's session id, the room, when it began and ended, and how it ended. You name the room as missing. gc's session id and how the session ended are missing too, for the same reason: nothing of the registry outlives the stop but the row and the stream. I do not hold the page for it, since it needs a place in the registry that roomcity-b8 owns, but write all three on spec-bb1.27 so that the ticket is not closed with one of them remembered. I report them to specs-18. Noted, not a change here: an always-on agent's name never ends, so its stream is never purged and its page grows with every start afresh; `Transcript` reads the whole of it into memory.
mikluko force-pushed transcripts from b7c19affcd
All checks were successful
test / changelog (pull_request) Successful in 6s
image / image (pull_request) Successful in 22s
test / go (pull_request) Successful in 53s
to 064cf86a47
All checks were successful
test / changelog (pull_request) Successful in 5s
image / image (pull_request) Successful in 17s
test / go (pull_request) Successful in 50s
2026-11-16 05:42:53 +00:00
Compare
mikluko deleted branch transcripts 2026-11-16 05:44:27 +00:00
Commenting is not possible because the repository is archived.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
mikluko/roomcity!25
No description provided.