Skip to content

Wire structured error propagation through UnitResult #6

@igouss

Description

@igouss

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.tsErrorContext interface + field on UnitResult
  • auto/resolve.tsresolveAgentEndCancelled(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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions