Expand description
A zone of the shared transcript store that SQLite reports as corrupt
(SQLITE_CORRUPT, “database disk image is malformed”).
Until now that was a WARN line per failed append: on one machine a single agent’s zone logged 218,133 of them over thirteen days while nothing told the user and every line kept being sent to the damaged pages (docs/analysis/RCA_UPGRADE_0_59_30_TO_0_59_34_ISSUES_2026_10_19.md §6). Now the first corrupt error on a zone, from an append, a tail read or an index rebuild:
- marks the zone damaged for the rest of the process: appends to it skip the shared store (the block’s own copy keeps being written) and readers use the block’s own copy instead;
- records one incident for the user and tells the agent once.
Only the shared store’s zones are marked: a block’s own store is a per-channel file and is not touched by this.
Structs§
- Damaged
- The zones found damaged, in the order they were found.
Constants§
- EVENT_
INCIDENT_ RECORDED - The broker event that shows a recorded incident in every open window now; the window shows
what is in
incidents.jsonlagain when it starts. - FRAMES_
ZONE - The key under which damage to the frame table is marked. It is found by a sum over the whole
table (
history.usage), not by a read of one zone, so it belongs to no agent: a zone’s own read finds it only when that zone’s frames are on the damaged pages. - GLOBAL_
MEMORY_ ZONE - The key under which Global Memory’s record in the shared store is marked.
- INCIDENT_
KIND - The
kindof the incident (agentmux_common::incidents::Incident::kind).
Functions§
- agent_
note - What the agent is told, once.
- damaged_
count - How many zones have been found damaged in this process.
- global_
for - The shared transcript store, unless
zoneof it was found corrupt in this process: a reader with a copy of its own to fall back to asks this instead ofagent_session::global_transcript_store(). - incident_
for - The incident for a damaged zone, as the user is told about it.
- install_
broker - Attach the broker (bootstrap), so an incident reaches the open windows when it is recorded.
- is_
corrupt - Whether
eis SQLite saying the database file is corrupt. - is_
damaged - Whether
zoneof the shared store was found corrupt in this process. - memory_
zone - The key under which an agent’s memory record in the shared store is marked. The record spans several zones (its files, its bundle, its claims), none with a copy of its own to fall back to, so it is marked as a whole.
- note_
corrupt - If
eis a corrupt-database error fromoponzoneof the shared store, marks the zone damaged and, the first time, records the incident and tells the agent. Returns whetherewas one, so a caller can fall back to the block’s own copy instead of treating it as a transient failure. - note_
corrupt_ text note_corruptfor a reader that has already turned the error into text (the segment log, the archive and snapshot code returnStringerrors): SQLite’s own wording for a corrupt file is what is looked for.- note_
if_ shared note_corruptwhenfsis the shared store itself, which a reader of either store (the index code takes a store and a zone) cannot tell otherwise; false, and nothing marked, for any other store.- write_
incident - Writes the incident to
incidents.jsonlindirunless an unacknowledged one for the same agent is already there (a restart finds the same damage again).