Transcript limits and enforcement
Part of the transcript model record. Built so far: implementation status.
Old data
Nothing stored is rewritten, replayed or migrated. Every shape is a named case in legacy.py with a fixture.
- Attach rows linked by predecessor only or by both edges; anchored on a user row (
sub_agent_step); manual or cross-session (external_reference, still AttachCard). - Rows with no blocks (backfill from
tool_calls), no status, errors stored in content, no id (a stable key from timestamp and role replaceshist_<i>),extraas object or JSON string,readSpeaker,readNotice, pasted elements, chapter pins,gui_agentnames. - Attach rows without
tool_call_id: matchattach.promptto the agent or task tool input, then order among agent and task blocks of that reply.send_messageconsumes a card only with evidence. Still unmatched:blockIdnull, drawn as an unpaired card. - Code nodes without
tool_call_id: same rule through caller edges. - Receipts on rows without
origin: the existing header pattern, and the named sender session must exist in the store, so old delivered messages keep their look and a typed line naming no real session stays a user row. - Old steer rows, restart prompts and fallback blocks fold as they do now; steering already in blocks is not doubled.
- Summaries with
covers_idsstay compaction rows and stop counting as versions. - Old tool rows reached by provider id are served by the second match in
tool_output.py. - A head folded away by aggregation (
_resolve_head) and a broken predecessor chain (predecessor-walk fallback, logged). - A branch that continues past an attach row or other side row, left by a version arrow that once stood on one: the walk to a version's tip passes through it.
- Running attach rows with no job id.
Turn grouping is computed at read time, so it applies to every old conversation with no write. Saved anchors stay valid because row ids do not change and any row id resolves. New metadata (tool_call_id on attach, origin, client_request_id) is ignored by old readers.
Enforcement
Types. schema.py generates wire-types.generated.ts, and a freshness test fails if they differ. TranscriptChange is a closed union with an exhaustive never check. Row.rowKind is a union, so dispatch has no default. Store writers are not on the public store type.
Contract tests. tests/unit/webui/transcript/test_transcript_contracts.py and apps/web/tests/chat/transcript/transcript-contract.test.mjs. No scan has an allowlist. Scans read source only, never build output (openprogram/interfaces/server/_frontend/, docs/_site/).
- Only
apply-transcript-update.tswrites rows. - No client code builds
_replyor derives an id from another id. - No
session_reloadstring inopenprogramorapps. - No code in
apps/webreadsdisplay,functionorcontentto decide a row's type. - No file outside the transcript package folds attach, steer or restart rows. One named exception:
joinedReplyinrestart-continuation.ts, which concatenates exactly the rows named byrow.continues, all of its own turn. - No shift-based pairing in
components/chat/messages. - No transcript row status literal lists outside
status.pyandrow-status.ts. The scan coversinterfaces/server/transcript/,ws_actions/session/,apps/web/components/chat/,apps/web/lib/chat/,apps/web/lib/session-store/andapps/web/lib/runtime-bridge/session/. Execution lifecycle lists are another vocabulary and out of scope:use-ws.ts,event_effects.py,execution/projections/dag.py. legacy.pyis the only module reading old record shapes. Two named exceptions: the second match intool_output.py, which serves old tool rows by provider id (Old data), andstripLegacySpeakerLabel, which strips old channel labels from display text and decides no row type (Limits that remain).- No import from
interfaces/serverinruntimeorstate.tests/contracts/repository/test_runtime_layering.pydoes not scan this direction, so the transcript contracts do. - The observer does no projection or I/O.
Behaviour tests.
- Page-edge sweep: every cut equals the unpaged read.
- Live equals cold through production reducers and components, across stream, partial history, page edges, completion, late tree updates, errors, cancellation, reload, reconnect and a fresh chat.
- Frames come from the real server emit path, never hand-written and never with an injected id.
- Duplicate delivery changes nothing.
- Interleaving property test: any order of writes, foreign writes, reads, page reads, view eviction, dropped frames and reconnects ends equal to a fresh read.
- Interleaved text, tool, text and steer on the real publisher keep stored block order.
- Unknown row and unknown item create nothing.
- Reader window invariance under background updates.
- Terminal status table.
- Stop with no write after the flag clears still settles the row.
- A second message to a running agent while it is expanded reaches the view.
- Four cached conversations: a fifth closes one view on the server.
- 300,000-node real server benchmark: first open, page read, evicted session, foreign-write rebuild, memory per view.
Process. Each step is built in its own worktree, rebased, merged once. Commits carry only their own paths. Affected tests and these contract tests only. Each read or live flip was checked against real shapes in the dev instance with a compare tool, and its mismatches were cleared before the flip landed.
Limits that remain
Narrowed, not closed
| Area | What remains |
|---|---|
| Follow and scroll | use-chat-area-stick.ts is not rewritten. It loses the reloads and window resets that fed it, but its own complexity (662 lines, 22 placement calls) remains, so the scroll bug class is narrowed. |
| Inferred display | isGuiToolCall (gui-tool-view.ts) still separates two tools named computer_use by their arguments, because no writer records the difference. stripLegacySpeakerLabel still strips channel speaker labels from old rows. |
| Wrong conversation | Transcript frames are scoped by view, but responseSessionId's fallback to the active chat stays for the run-level frames that remain. |
| Run slot | The 24 setRunningTaskFor sites stay. They no longer write rows, but the slot keeps its own lifecycle. |
| Old-row heuristics | F18: old attach rows with no prompt match pair by order within the reply, on the server. F36: on old rows, text naming a real existing session still reads as a receipt. |
| Tool result length (F19, F20) | Live, final and reload show one value and one truncated flag. The tool result is cut to 4000 characters before it is stored (event_parsing.shorten), and storing more would change what feeds model context, so text past the cut does not exist to load. |
| Local notices (F25) | local_command and no-op notices stay transient client rows and vanish on page reload, because no record is written. |
| Split pane (F29) | Rows, folding, bot view, todo plans, goal records and rewind marks are shared. The message rail and find stay main-view only, because controls do not move or appear. |
| Reply fields (F32) | Timestamps, usage, sibling navigation and speaker arrive by row. Provider retry notices stay live-only under the reconnect contract. |
Accepted behaviour
| Case | Accepted result |
|---|---|
| Placeholder write failed | No live text; the terminal row appears when the turn ends. |
| Last text frame dropped | The terminal row heals it; no read runs. |
| Empty provider block between two same-type blocks | Run numbering can shift at the final write; one open step closes, nothing else. |
| Power loss on the quiet path | The tail of the reply in progress can be lost. |
| Cron children's writes | They appear on the next read of that session. |
| A conversation being read on one socket | Its text holds on that socket until the read ends. |
| A page projecting under the view lock | Non-text updates for that one session wait. |
| Collapsed sub-agent row | Shows running state and no text preview. |
Risks measured, not removed
- A long autonomous turn is indivisible and can be many megabytes. Tool bodies keep the 32 KiB inline cap. Steps 0 and 5 measure it, and step 5 shows no regression before the flip.
- Owner-map memory at 300,000 nodes is tens of MB per view, with shared strings and the LRU. Measured in step 0.
- Golden fixtures cover named old shapes, and the compare tool covered the dev profile only, so a shape found only in stable data can surface later. An unknown shape draws as a plain row.
- Offsets are UTF-16 units across Python and JS. A wrong computation becomes a repair read, not corruption; surrogate-pair fixtures cover it.
- About six to seven weeks of work in the highest-traffic chat files while other sessions commit.
Alternatives not taken
Proposals examined for this design, and why each is not part of it
| Proposal | Why it is not part of this design |
|---|---|
| Enable progress preview for sync jobs | _poll_progress had no caller anywhere in the repository, so no job had a preview; the sync card gets a job id and a live view, and the dead poller is deleted. |
Avoid _update_attach_card's notices.queue path for sync jobs | notices.queue already returns False when job.wait is true, and sync jobs have wait=True. |
job_progress is a reason step 7 delivers | its only emitter was inside the uncalled poller; the live job reason is job_attach. |
Put turn_id on text frames | the runtime tap cannot know the opener (restart and steer rows join another row's turn), so a text miss drops with no read and the numbered stream finds a missing row. |
| Park every frame for the session | run-level frames (running_task, execution.updated) are ordered by run_seq and follow the read today, so only row-writing frames park. Terminal chat_response is row-writing while the old reducers run, and it parks for exactly that period. |
Carry client_request_id through TurnRequest | the web chat action writes the user node itself (_build_user_msg, with user_already_persisted=True), so the runtime's own user write at prep.py:130 never runs for it and the id does not need to enter the runtime. |
Move the chat-action join and first_read to step 7 | first_read replaces a pending row by clientRequestId, which local rows carry only from step 8, so step 7 keeps the attach reloads for a socket with no view. |
Keep settleDeliveredSteer in handleUserMessage | the settle runs from the steer row's clientRequestId, which also covers reads, where no frame exists. |
| Wake the publisher from token retirement on Stop | terminal rows are never held, so nothing waits on the flag clearing. |
| The HTTP route takes the whole branch | CommandReply refuses over 4 MiB, so that route stays bounded while the CLI, worker_turn and rehearsal take the whole branch. |
Use is_checkout_target for checkout | /api/chat/checkout already applies it (chat_branches.py:595); attach rows pass that rule, so F23 is closed by arrows no longer naming them. |
linear_history fallback leaves F42 open | broken old chains must still display, and the walk feeds the same projection so the shape cannot differ; session_persistence.py:108 and routes/chat.py:81 fill only the server mirror, which a version 3 transcript never reads. |
| Build on one client-side transcript fold | it keeps a client-side merge decision, the bug class this design removes; the delivery order that fold offered is met by the server-first steps. |