Problem
UnitResult has status: "error" but nothing ever produces it — dead code. All error context (provider errors, timeouts, idle watchdog kills) is discarded at the resolve boundary:
resolveAgentEnd(event) always produces { status: "completed", event }
resolveAgentEndCancelled() always produces { status: "cancelled" } with zero context
The journal's error classification relies on regex-matching message content — fragile and unreliable across providers.
Solution
Add typed ErrorContext to UnitResult and wire it through the 4 call sites that discard error information. Replace regex heuristics in stuck detection and journal emit with structured field access.
Implementation
PR: gsd-build#2612
Files changed
auto/types.ts — ErrorContext interface + field on UnitResult
auto/resolve.ts — resolveAgentEndCancelled(errorContext?)
auto-timers.ts — idle/hard timeout error context
auto/run-unit.ts — session error/timeout context
auto/phases.ts — structured classification + journal enrichment
- 3 test files updated
Problem
UnitResulthasstatus: "error"but nothing ever produces it — dead code. All error context (provider errors, timeouts, idle watchdog kills) is discarded at the resolve boundary:resolveAgentEnd(event)always produces{ status: "completed", event }resolveAgentEndCancelled()always produces{ status: "cancelled" }with zero contextThe journal's error classification relies on regex-matching message content — fragile and unreliable across providers.
Solution
Add typed
ErrorContexttoUnitResultand wire it through the 4 call sites that discard error information. Replace regex heuristics in stuck detection and journal emit with structured field access.Implementation
PR: gsd-build#2612
Files changed
auto/types.ts—ErrorContextinterface + field onUnitResultauto/resolve.ts—resolveAgentEndCancelled(errorContext?)auto-timers.ts— idle/hard timeout error contextauto/run-unit.ts— session error/timeout contextauto/phases.ts— structured classification + journal enrichment