Skip to content

feat(#447): structured error capture for phase failures - #457

Merged
admarble merged 4 commits into
mainfrom
feature/447-improve-error-capture-for-tooling-failures-60-of-a
Mar 26, 2026
Merged

admarble merged 4 commits into
mainfrom
feature/447-improve-error-capture-for-tooling-failures-60-of-a

Conversation

@admarble

Copy link
Copy Markdown
Contributor

Summary

  • Add RingBuffer-based stderr/stdout tail capture (last 50 lines) to ClaudeCodeDriver and AiderDriver
  • Add error classifier that categorizes failures into 6 types: context_overflow, api_error, hook_failure, build_error, timeout, unknown
  • Add errorContext schema field to PhaseLog (backward-compatible optional field)
  • sequant logs --failed now shows error category and stderr tail (5 lines default, 50 with --verbose)
  • sequant stats groups failures by error category instead of truncated strings

AC Verification

AC Source Description Status Evidence
AC-1 Original Phase runner captures stderr/stdout tail (last 50 lines) ✅ ring-buffer.ts, driver updates
AC-2 Original Structured error info stored in PhaseLog (errorContext field) ✅ run-log-schema.ts:ErrorContextSchema
AC-3 Original sequant logs --failed shows error context ✅ logs.ts display + --verbose flag
AC-4 Original Failure categorization in stats improved ✅ stats.ts uses errorContext.category
Derived ACs
AC-5 Error Handling Old logs without errorContext render correctly ✅ Schema field is optional, tests confirm
AC-6 Test Coverage Unit tests for RingBuffer and error classifier ✅ 31 tests in 2 test files
AC-7 Code Quality Error categories defined as constants ✅ ERROR_CATEGORIES readonly array

Test plan

  • npm run build passes
  • npm run lint passes (0 errors, 0 warnings)
  • npm test — 2199/2200 pass (1 pre-existing timeout in state-utils.test.ts)
  • 31 new tests covering RingBuffer, ErrorContext schema, classifier, backward compat
  • sequant logs --help shows --verbose flag

Closes #447

🤖 Generated with Claude Code

Add RingBuffer-based stderr/stdout tail capture (last 50 lines) to all
agent drivers, with automatic error classification into categories
(context_overflow, api_error, hook_failure, build_error, timeout, unknown).

- AC-1: Drivers capture stderr/stdout via RingBuffer(50)
- AC-2: ErrorContext schema added to PhaseLog (backward-compatible optional field)
- AC-3: `sequant logs --failed` shows error category and stderr tail (5 lines default, 50 with --verbose)
- AC-4: `sequant stats` groups failures by error category instead of truncated strings
…de through pipeline

Tighten /429/, /502/, /503/ patterns with \b word boundaries to prevent
false positives on embedded numbers. Plumb exitCode from AiderDriver
through AgentPhaseResult → PhaseResult → errorContext so the schema
field declared in ErrorContextSchema is actually populated at runtime.
@admarble
admarble merged commit e426d15 into main Mar 26, 2026
5 checks passed
@admarble
admarble deleted the feature/447-improve-error-capture-for-tooling-failures-60-of-a branch March 26, 2026 13:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve error capture for tooling failures (60% of all failures)

1 participant