fix(eval): preserve durable task traces#323
Conversation
|
/forgeclaw review |
bogdanovich
left a comment
There was a problem hiding this comment.
Automated review by Reviewer agent.
|
Automated review by Reviewer agent. Review SummaryA malformed or otherwise unreadable existing task trace makes reconciliation permanently discard the valid recovered trace instead of repairing the canonical file. Findings
|
|
/forgeclaw review |
bogdanovich
left a comment
There was a problem hiding this comment.
Automated review by Reviewer agent.
|
Automated review by Reviewer agent. Review SummaryTwo high-confidence durability/liveness issues remain in the task-trace admission and shutdown paths. Findings
At the 128-entry limit this branch deletes the terminal trace and records it as completed. It is then neither retried after writer capacity returns nor reconstructed during this process lifetime, so a burst during a slow/stalled store permanently loses canonical task evidence. The added test explicitly accepts 17 such losses. Keep an on-disk retry marker/spool, or apply bounded producer backpressure while preserving recoverability; do not mark the trace completed until it has been durably admitted.
|
|
/forgeclaw review |
|
Automated review by Reviewer agent. Review SummaryOne major restart-reconciliation bug remains: a mutable completion ID changes historical record digests, so a recovered delivery outcome can be discarded in favor of stale canonical task evidence. Findings
During startup reconstruction, every retained event is normalized against the latest task record. For an older Coverage Notes
|
|
Addressed the latest summary-only finding in
Validation: |
|
/forgeclaw review |
|
Automated review by Reviewer agent. Review SummaryTwo high-confidence durability defects remain in task-trace retry accounting and asynchronous writer failure handling. Findings
A capacity rejection sets
Coverage Notes
|
|
Addressed both findings from the latest review in 53dd75b.
Validation:
|
|
/forgeclaw review |
bogdanovich
left a comment
There was a problem hiding this comment.
Automated review by Reviewer agent.
|
Automated review by Reviewer agent. Review SummaryA terminal task can be pruned by the registry before the asynchronous trace projector installs its durable trace-pending marker, losing the only recovery source before a task trace is submitted. Findings
The terminal update is pruned while |
|
/forgeclaw review |
bogdanovich
left a comment
There was a problem hiding this comment.
Automated review by Reviewer agent.
|
Automated review by Reviewer agent. Review SummaryA task trace that has already received its persistence acknowledgement is permanently tombstoned in memory, so a later delivery-recovery event for the same generation is silently omitted from the canonical trace. Findings
After EventPersisted, observeWriterEvent removes the state and recordCompletedLocked adds this generation to completed. Every later registry event then returns here before it can rebuild or extend the trace. A task can still reopen after that acknowledgement (for example a delivery retry transitions a previously final delivery back to pending and then delivered), so the later completion ID/outcome never reaches the canonical trace. The existing dirty path only covers updates that arrive before the write acknowledgement. Keep a sequence watermark or reconstruct the state when a newer event arrives, re-protect the registry record, and reconcile the extended candidate. Add an acknowledgement-controlled test for failed delivery -> persisted/marker cleared -> delivery recovery in the same process.
Disabling capture clears all projector state and then calls SetTraceCaptureProtection(false), which clears every TraceCapturePending marker and prunes terminal records. That can happen while an admitted writer item is still queued/in flight or while overflow-deferred traces exist only in the registry. If retention or MaxRecords pressure applies, the registry can delete the recovery source before persistence is acknowledged; a later writer failure then has nothing to retry on restart. Stop accepting new capture on disable, but retain pending/in-flight durability markers until each trace is acknowledged or deliberately preserved for startup recovery. |
|
/forgeclaw review |
bogdanovich
left a comment
There was a problem hiding this comment.
Automated review by Reviewer agent.
|
Automated review by Reviewer agent. Review SummaryA stale writer acknowledgement can release the durable task-trace marker before the newer shutdown snapshot is persisted, allowing the newest task events to be lost on a crash. Findings
When a previously admitted trace becomes dirty,
A contiguous merged task-event sequence does not prove that every incompleteness reason was repaired. For example, a task can reopen after an earlier complete persistence and then be captured during shutdown while delivery is still nonterminal; that candidate is marked |
|
/forgeclaw review |
bogdanovich
left a comment
There was a problem hiding this comment.
Automated review by Reviewer agent.
|
Automated review by Reviewer agent. Review SummaryA persistence acknowledgement can clear the registry protection marker before a concurrently committed newer task event is projected, leaving the newer revision vulnerable to pruning on restart. Findings
|
|
/forgeclaw review |
bogdanovich
left a comment
There was a problem hiding this comment.
Automated review by Reviewer agent.
|
Automated review by Reviewer agent. Review SummaryTask-ID reuse can overwrite a terminal generation while its trace is still pending, removing the durable recovery anchor before persistence is confirmed. Findings
Coverage Notes
|
|
/forgeclaw review |
bogdanovich
left a comment
There was a problem hiding this comment.
Automated review by Reviewer agent.
|
Automated review by Reviewer agent. Review SummaryOne high-confidence durability race remains: a stale persistence acknowledgement can clear trace protection after a newer registry revision commits. The focused task-ID reuse test is also deterministically failing at this head. Findings
This waits for the trace file, but Coverage Notes
|
|
/forgeclaw review |
|
Automated review by Reviewer agent. Review SummaryDirect inspection found no additional high-confidence issue in the current head, but the required Codex advisory analysis could not complete because ACPx returned a runtime error. Coverage Notes
|
|
Re-running review because the previous pass was explicitly inconclusive after a transient ACPx advisory runtime error; head and green checks are unchanged.\n\n/forgeclaw review |
|
/forgeclaw review |
1 similar comment
|
/forgeclaw review |
|
Automated review by Reviewer agent. Review SummaryInconclusive: the required Codex advisory analysis could not run because ACPx returned an internal runtime error. Direct inspection and GitHub Actions CI found no additional independently validated findings at head ed3b691. Coverage Notes
|
What changed
delivery_failedtraces open so later delivery recovery extends the canonical trace throughdeliveredWhy
Recovery audit of merged PR #317 found four high-confidence durability and memory-bound defects in
pkg/agent/trace_task_projector.go. Trace capture is enabled in production workspaces, so these are forward fixes for data loss, stale canonical outcomes, and unbounded memory growth.User/developer impact
Task traces now preserve the strongest durable evidence across restart, record successful delivery recovery, use a bounded shutdown deadline and recover from the durable registry when admission cannot finish, and remain memory-bounded under prolonged writer saturation. No configuration or migration is required.
Validation
go test ./...go test -race ./pkg/evalcapture ./pkg/agentgo vet ./pkg/evalcapture ./pkg/agent./scripts/pre-push-lint.sh --changedLater PRs
PR #322 remains draft and paused. After this forward-fix merges, it will be updated onto latest
mainand adjusted to use the same durable admission behavior before review resumes.Audit report:
/home/server/.picoclaw/reviewer/agent-workspaces/forgeclaw/reports/recovery-audit-pr-317-dc6b500316ad.json