Skip to content

perf(remote): release unviewed transcripts and trim live windows - #814

Open
Juliusolsson05 wants to merge 3 commits into
fix/remote-output-backpressurefrom
fix/remote-transcript-retention
Open

perf(remote): release unviewed transcripts and trim live windows#814
Juliusolsson05 wants to merge 3 commits into
fix/remote-output-backpressurefrom
fix/remote-transcript-retention

Conversation

@Juliusolsson05

@Juliusolsson05 Juliusolsson05 commented Sep 5, 2026

Copy link
Copy Markdown
Owner

The phone previously accumulated every live transcript even on the session list. Transcript ownership now follows actual view subscriptions: unviewed JSONL/semantic bodies are not mapped or retained, and leaving the last view releases entries, tool indexes, mapper/fold state and identity sets. Selecting the session again backfills durable history and rejects stale pending responses.

Fixes #805
Refs #813

Dependency: incremental PR against fix/remote-output-backpressure (#813). Merge #813 first, then retarget this PR to main and rerun checks. No merge is currently authorized. No protocol migration, desktop/worktree edits or toolkit changes.

Acceptance criteria

  • Several unviewed sessions retain zero transcript entries, tool indexes, seen UUIDs and semantic bodies; metadata remains available.
  • Last-unsubscribe, reselect, rolled file identity, stale requests and session removal have behavioral coverage. Partial semantic suffixes wait for a fresh turn; committed content remains authoritative.
  • Viewed live windows reuse the desktop pure count/estimated-byte trim planner (2,000 entries / 32 MiB triggers; 1,500 / 24 MiB targets), preserving semantic owners and tool pairs. Remote bookkeeping does not use desktop global registries.
  • Indexes rebuild from retained entries in chronological order. Trimmed identities suppress old live replays but allow older pages to reload them in order.
  • Exact history offsets survive trimming and all-duplicate pages; raw-record fan-out is not split. Paging/grace protects recently requested older content. Total entry count remains independent of the retained window.

Validation and reproducible evidence

  • 137 local tests / 14 files pass: all remote transport/store tests plus shared entry/trim tests. Ten new retention regressions exercise real Claude, Codex and OpenCode mappers and semantic folds.
  • The unviewed regression fails on parent fix(remote): bound outgoing queues and recover after overflow #813 with 4,096 retained entries. Fixed: three synthetic sessions each receiving 4,096 entries / 32 MiB logical ASCII text retain zero entries, indexes and UUIDs. These are collection/payload measurements, not production heap savings.
  • A 2,100-entry live burst retains 1,500 entries with matching indexes; 300 entries of 128 KiB each trigger byte trimming below the count threshold. Tests verify replay suppression, chronological reload, tool pairs, semantic owners and exact cursor offsets.
  • Typecheck, test contract, client production build and diff check pass. Full applicable repository checks pass in CI. Existing bundle size/mixed import warnings remain.

Limits and tradeoffs

Safety constraints (active/history semantic ownership, tool pairs, missing stable identity/anchor and whole raw records) can pin a viewed window above its nominal target. Older-history reading has a 30-second trim grace. Small UUID-only tombstone sets grow during a continuously viewed session to preserve exact replay deduplication; all are released when that view ends. Live wire entries lack byte offsets and retain provider-marker fallback; history pages use exact offsets when supplied. Re-selection costs a backfill and an interrupted live turn may wait for durable completion. Mobile heap/FPS gains remain unmeasured.

Plan committed before code: docs/superpowers/plans/2026-09-05-remote-transcript-retention.md.

Current validation: rebased onto main f7507980 (toolkit #812 and MCP repair #818), head 6230658d. Source changes from the earlier implementation are preserved; both required CI gates pass on this head (CI run). No merge is authorized. The initial CI packaging failure reproduced with an unbuilt parser checkout and is fixed by resolving agent-transcript-parser/ghost to pinned source in the remote Vite config. The same unbuilt checkout now passes the full local package gate; no shared parser build or pane layout was changed.

Make view subscriptions own transcript bodies, mapper state and replay identities. Reuse the pure desktop trim policy while preserving tool pairs, semantic owners and exact history offsets; rebuild indexes and retain identity-only tombstones for safe replay and pagination.

Refs #805
A clean checkout has no parser dist directory. The shared live-window planner introduced a runtime ghost-helper import, so mirror the desktop source alias rather than relying on a warmed workspace package build.

Refs #805
@Juliusolsson05
Juliusolsson05 force-pushed the fix/remote-output-backpressure branch from 6182392 to 205eb9d Compare September 6, 2026 00:21
@Juliusolsson05
Juliusolsson05 force-pushed the fix/remote-transcript-retention branch from 5bda3e7 to 6230658 Compare September 6, 2026 00:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant