Expand description
One-shot backfill of pre-existing agent CONVERSATIONS into the GLOBAL transcript store, so the 9 (and any) agents created before cross-channel transcripts shipped load their history when opened from a fresh channel.
The merged feature (#1399) mirrors new agent output into the global
agent:<defId>:current zone, but pre-existing conversations were never
mirrored — they live only in the channel they ran in. This scans every
channel/dev objects.db for blocks belonging to each agent definition,
reads the richest output from that channel’s filestore.db, and seeds the
global zone with it.
Source = the channel block’s output, NOT the provider .jsonl. The
block output is the exact stdout stream-json the renderer already parses
(parseHistoryLines + the claude-stream-json translator); the provider
~/.claude/projects/<slug>/<sid>.jsonl transcript is a different envelope
(queue-operation / user+parentUuid/sessionId) the renderer can’t
consume, so copying it would render empty. Using the block output needs zero
translation.
The seeded snapshot overlay uses sourceBlockId: "", which the frontend
treats as “matches any block” — so opening the agent (a fresh local block
with no local output) takes the v2 fast-path and the
blockfile:read_range global fallback (#1399) serves the backfilled zone.
Marker-gated (.transcripts_backfilled, version-stamped) like the
definition backfill (registry::def_migrate); read-only on every scanned
SQLite (the global store is the only thing written).
Structs§
Constants§
- BACKFILL_
VERSION 🔒 - Bump to re-run the backfill once for everyone (e.g. when the source-selection logic improves).
- MARKER 🔒
Functions§
- backfill_
transcripts_ once - Seed the global transcript zone for each agent in
def_idsfrom its richest channel/dev blockoutput. Marker-gated undertranscripts_dir. Best-effort — any per-DB failure is skipped, never fatal. - collect_
data_ 🔒dirs - Every
<home>/channels/*/versions/*/dataand<home>/dev/<branch>[/<sub>]/data(mirrorsregistry::def_migrate::collect_scan_dbs, returning the data dir). - count_
nonblank_ 🔒lines - dir_
subdirs 🔒 - marker_
version 🔒 - overwrite_
zone_ 🔒file - Create-or-replace a zone file with exactly
bytes(FileStorewrite_filerequires the file to exist first). - read_
agent_ 🔒blocks - Read all blocks from
objdbwhosemeta.agentIdis inwant, returning(def_id, block_oid)pairs. Read-only. - read_
zone_ 🔒output - Reassemble a zone’s
outputfile bytes directly fromdb_file_data(read-only, avoids opening a second writable FileStore on another channel). ReturnsNonewhen absent or empty. Agentoutputis non-circular, so concatenating parts inpartidxorder matchesFileStore::read_file. - seed_
global_ 🔒zone - Write
bytesas the zone’soutputand a v2 snapshot overlay (sourceBlockId: "") so the open path restores it cross-channel. - write_
marker 🔒