You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Follow-up to #3549. Surfacing a refused audit anchor (health, doctor, metrics, log line) shipped in #3649. This issue is the recovery path that #3549 left open.
Problem
When the audit database is recreated or restored from an older point, the chain starts again near checkpoint 1 while the anchor file on the host still records a later checkpoint. Anchoring refuses forever. Today the only fix is moving files by hand.
A first-class recovery command, for example containarium audit anchor new-epoch (name tentative).
audit verify-anchor understands epochs: a documented, recorded break verifies as a break, not as tampering. An unexplained drop still fails as it does today.
Detect a reset chain at startup (chain length or base behind the last anchored checkpoint) and report it once, clearly, instead of a silent per-tick loop.
Keep a second copy of the anchor file off the host by default, or have doctor warn when only a local file is configured.
Runbook section: "the audit database was recreated or restored".
agent-2bc6610c-sonnet is starting processing it. This issue is too large for one reviewable PR, so I am cutting it into slices; this claim covers slice 1 only and the issue stays open after it:
Format + library core (this PR): a break record in the anchor file; FileSink.NewEpoch (archives the old file with its sha256, never deletes it, writes the break record, atomic replace); every reader of the file made safe against break lines; rollback protection unchanged inside an epoch. No CLI, no daemon wiring.
containarium audit anchor new-epoch (explicit confirmation flag, root-level caller) and the actor recorded in the audit chain.
verify-anchor reports a recorded break as a break (local file, bucket, TSA) while an unexplained drop still fails.
Startup detection of a reset chain (once, clearly), doctor warning when only a local file is configured, off-host copy.
Runbook section.
Open choices, defaults I am taking unless told otherwise: command name new-epoch as in the issue; the break record is a JSON line with "kind":"epoch_break" in the same file.
agent-2bc6610c-sonnet is starting processing it. Slice 1 merged (0f22bf0). This claim covers slice 2 only: containarium audit anchor new-epoch (explicit confirmation flag, root caller) and recording the actor in the audit chain. Slices 3–5 stay open.
agent-2bc6610c-sonnet: slice 2 merged (c5df8b3). Slice 3a PR opened (local-file break reporting + archive check); 3b (bucket/TSA across a break) is next. CI pending.
agent-2bc6610c-sonnet: slice 3b (bucket and timestamp tokens across a break) is not started: it needs a design decision, so I am flagging it here instead of improvising.
Finding. The bucket sink names each object by checkpoint alone (%020d.json), writes with --if-generation-match=0, and LastPublished is the highest object name. The TSA token directory does the same (<anchor-path>.tsa/<checkpoint>.tsr). After new-epoch the chain restarts at low checkpoints, so with a bucket configured:
the daemon's bucket LastPublished is still the old epoch's high checkpoint, so it refuses to anchor again (the original problem, now in the bucket);
a new epoch's checkpoint that already exists in the bucket with a different root fails as ErrAnchorConflict;
verify-anchor --anchor-bucket reports the old epoch's checkpoints as above the chain tip.
No change on the verify side alone fixes this; the object naming has to change.
Proposed default (needs a yes): an epoch number. The break record gains epoch (n+1), epoch 1 keeps today's names so existing buckets and token dirs stay valid, and epoch n>1 publishes under <prefix>epoch-<n>/ and <path>.tsa/epoch-<n>/. Verification then treats each earlier epoch as sealed history that must equal what its verified archive holds, and checks only the current epoch against the database. An unexplained checkpoint in any prefix still fails. The break record change is additive, so slices 1–3a need no rework.
Alternative: the operator points the daemon at a new bucket prefix at new-epoch time and the break records the old one. Simpler code, but it moves a safety property onto a manual step.
Slices 4 (startup detection, doctor warning, off-host copy) and 5 (runbook) do not depend on this and can proceed. Slice 3a is in #3891 (local file only).
agent-2bc6610c-sonnet: decision received from the maintainer: epoch numbering for slice 3b (design as proposed above). 3b is unblocked but not started; I am taking slice 4 now (startup detection of a reset chain, doctor warning when only a local anchor file is configured, off-host copy).
agent-2bc6610c-sonnet: slice 4a PR #3892 opened (startup detection). Slice 4b (doctor warning for a local-only anchor, off-host copy) needs a decision: a readiness entry would show OK: false on every default install in the cloud probe. Default I would take: a doctor-only advisory line that reads the daemon's anchor configuration, not a readiness entry. Not started. 3b (epoch numbering, approved) is also not started. CI pending on #3891 and #3892.
agent-2bc6610c-sonnet: slice 3b PR #3893 (epoch numbering, stacked on #3891) and slice 5 PR #3894 (runbook, stacked on #3893) opened; slice 4a is #3892. All CI pending. Remaining open item on this issue: 4b (doctor warning for a local-only anchor / off-host copy), waiting on a decision.
Activity
hsinatfootprintai commentedon Dec 2, 2026
agent-2bc6610c-sonnet is starting processing it. This issue is too large for one reviewable PR, so I am cutting it into slices; this claim covers slice 1 only and the issue stays open after it:
FileSink.NewEpoch(archives the old file with its sha256, never deletes it, writes the break record, atomic replace); every reader of the file made safe against break lines; rollback protection unchanged inside an epoch. No CLI, no daemon wiring.containarium audit anchor new-epoch(explicit confirmation flag, root-level caller) and the actor recorded in the audit chain.verify-anchorreports a recorded break as a break (local file, bucket, TSA) while an unexplained drop still fails.doctorwarning when only a local file is configured, off-host copy.Open choices, defaults I am taking unless told otherwise: command name
new-epochas in the issue; the break record is a JSON line with"kind":"epoch_break"in the same file.hsinatfootprintai commentedon Dec 2, 2026
agent-2bc6610c-sonnet: slice 1 PR opened at
f610ecbd— CI pending. The issue stays open for slices 2–5 (listed in the claim above).hsinatfootprintai commentedon Dec 2, 2026
agent-2bc6610c-sonnet is starting processing it. Slice 1 merged (0f22bf0). This claim covers slice 2 only:
containarium audit anchor new-epoch(explicit confirmation flag, root caller) and recording the actor in the audit chain. Slices 3–5 stay open.hsinatfootprintai commentedon Dec 2, 2026
agent-2bc6610c-sonnet: slice 2 PR #3885 opened — CI pending. Issue stays open for slices 3–5.
hsinatfootprintai commentedon Dec 2, 2026
agent-2bc6610c-sonnet: slice 2 merged (c5df8b3). Slice 3a PR opened (local-file break reporting + archive check); 3b (bucket/TSA across a break) is next. CI pending.
docs(changelog): fragment for verify-anchor epoch breaks (#3772)
hsinatfootprintai commentedon Dec 2, 2026
agent-2bc6610c-sonnet: slice 3b (bucket and timestamp tokens across a break) is not started: it needs a design decision, so I am flagging it here instead of improvising.
Finding. The bucket sink names each object by checkpoint alone (
%020d.json), writes with--if-generation-match=0, andLastPublishedis the highest object name. The TSA token directory does the same (<anchor-path>.tsa/<checkpoint>.tsr). Afternew-epochthe chain restarts at low checkpoints, so with a bucket configured:LastPublishedis still the old epoch's high checkpoint, so it refuses to anchor again (the original problem, now in the bucket);ErrAnchorConflict;verify-anchor --anchor-bucketreports the old epoch's checkpoints as above the chain tip.No change on the verify side alone fixes this; the object naming has to change.
Proposed default (needs a yes): an epoch number. The break record gains
epoch(n+1), epoch 1 keeps today's names so existing buckets and token dirs stay valid, and epoch n>1 publishes under<prefix>epoch-<n>/and<path>.tsa/epoch-<n>/. Verification then treats each earlier epoch as sealed history that must equal what its verified archive holds, and checks only the current epoch against the database. An unexplained checkpoint in any prefix still fails. The break record change is additive, so slices 1–3a need no rework.Alternative: the operator points the daemon at a new bucket prefix at
new-epochtime and the break records the old one. Simpler code, but it moves a safety property onto a manual step.Slices 4 (startup detection,
doctorwarning, off-host copy) and 5 (runbook) do not depend on this and can proceed. Slice 3a is in #3891 (local file only).hsinatfootprintai commentedon Dec 2, 2026
agent-2bc6610c-sonnet: decision received from the maintainer: epoch numbering for slice 3b (design as proposed above). 3b is unblocked but not started; I am taking slice 4 now (startup detection of a reset chain,
doctorwarning when only a local anchor file is configured, off-host copy).docs(changelog): fragment for startup detection (#3772)
hsinatfootprintai commentedon Dec 2, 2026
agent-2bc6610c-sonnet: slice 4a PR #3892 opened (startup detection). Slice 4b (doctor warning for a local-only anchor, off-host copy) needs a decision: a readiness entry would show
OK: falseon every default install in the cloud probe. Default I would take: a doctor-only advisory line that reads the daemon's anchor configuration, not a readiness entry. Not started. 3b (epoch numbering, approved) is also not started. CI pending on #3891 and #3892.test(audit): check the Close error in the archive-edit helper (#3772)
docs(changelog): fragment for epoch numbering (#3772)
docs(changelog): fragment for the anchor recovery runbook (#3772)
hsinatfootprintai commentedon Dec 2, 2026
agent-2bc6610c-sonnet: slice 3b PR #3893 (epoch numbering, stacked on #3891) and slice 5 PR #3894 (runbook, stacked on #3893) opened; slice 4a is #3892. All CI pending. Remaining open item on this issue: 4b (doctor warning for a local-only anchor / off-host copy), waiting on a decision.
feat(audit): anchor epoch break record and FileSink.NewEpoch (Footpri…
feat(audit): containarium audit anchor new-epoch, with the actor in t…
feat(audit): verify-anchor reports an epoch break and checks its arch…
feat(audit): report a reset audit chain once, at daemon startup (Foot…
feat(audit): epoch numbering; bucket and timestamp tokens across a br…
hsinatfootprintai commentedon Dec 2, 2026
agent-2bc6610c-sonnet: slice 4b PR #3896 opened at
6e8af21f— CI pending. Doctor-only advisory; closes this issue on merge.