Repository navigation
Description
Parent epic: #338
Part of the debug-record epic. Depends on the foundation child. More than one PR: sub-issues linked below.
What a debugger hits today
A person discovers they needed the record after the failure. Today that is too late twice over: a headless errand's private store is deleted on exit, failure or not, unless kept in advance; and with the switch off nothing keeps the failing call's request and reply. The headless rows are also hard to attribute: the compile, the plan passes and every aforge exec call carry no node and often no tag, so even the call log cannot say which call belonged to which piece of work.
The law
A failure keeps its own evidence without being asked: the headless record survives any failure, the failing call's request and reply are kept beside its error, and every headless call names the work it belonged to.
Fix shape
- Keep on failure: the headless store is kept on any non-success exit and its location printed; deleted on success unless kept on purpose; always kept under the switch.
- Last-failure capture: each model call holds its request and its assembled reply in one buffer; on failure (a refusal, a cut, a decode error, a transport error) the buffer is written beside the error as a body file in a failures folder under the state root, bounded to a count of recent failures; on success the buffer is dropped. Cost when nothing fails is one buffer per call. A failed compile keeps its last reply beside the error the same way (headless: a compile that comes back with a blank goal ends the run instead of using the person's own words #335).
- Attribution: the compile, every plan pass, the gate and the
aforge execexecutor set the tag and the node they belong to, so every headless row is attributable.
Replication
aforge do "count the lines in notes.txt and write the count to count.txt"Today: on exit the private store is gone, and its rows in the call log say compile, ground, gate with no node, and the exec rows say leaf with no node.
Acceptance (functional)
- A headless run that fails (a brief the compile refuses, or a forced provider error) leaves its store on disk and prints where; a run that succeeds leaves none unless kept on purpose.
- With every switch off, a forced provider failure leaves one file in the failures folder holding that call's request and reply or error; with the count set to three, a fourth failure removes the oldest.
- After a headless run every call-log row for it carries a tag and, for work belonging to a node, the node.
- A compile that returns a blank goal leaves its reply text on disk.
Sub-issues
- headless: a failed run keeps its store, and every headless call names its tag and node #349 a failed headless run keeps its store; every headless call names its tag and node
- call log: the one call that failed keeps its request and reply beside its error, without a switch #350 the one call that failed keeps its request and reply beside its error
Drafted with CodeAF · reviewed and owned by the author
Activity
santoshkumarradha commentedon Sep 10, 2026
Consolidated into the epic #338. This issue's law, fix shape, replication and acceptance are reproduced in full in the epic's consolidated plan (comment on #338, 2026-09-10), under the pull request that now carries it — nothing is lost, and this issue stays readable.
Why the children were folded back: the epic split into a foundation child, three decision-family children and a failure-evidence child so separate lanes could take them. Four weeks on, one lane took the foundation and the tree carried nine open issues describing what is now a handful of call sites each. The verified state at dev@95a0d0a9b is that
internal/trace'sRecorder.Call,Recorder.ToolandRecorder.Decisionhave zero callers outside the package's own tests — the shapes are all built and correct, and no feeder is wired, soAFORGE_DEBUG=1today writes a run header and nothing else. That is one lane's work in three pull requests, not nine issues.