Skip to content

fix: add error handling for thrown errors - #6

Open
bettercallzaal wants to merge 1 commit into
mainfrom
ws/fable-audit-fix
Open

fix: add error handling for thrown errors#6
bettercallzaal wants to merge 1 commit into
mainfrom
ws/fable-audit-fix

Conversation

@bettercallzaal

Copy link
Copy Markdown
Owner

Summary

Added two error-handling fixes to prevent silent failures:

  • orchestrator.ts: Added catch block to properly handle and record errors that occur during task processing (pattern matching, gating, spawn, stream draining). Previously uncaught errors would propagate without being recorded as failed events.
  • router.ts: Added error handling to defaultClassifier to gracefully skip patterns whose matches() method throws, instead of crashing classification.

Why it matters

Agent orchestrators must be defensive - errors should be recorded, not swallowed. These fixes ensure the orchestrator remains resilient when patterns or other components fail.

Test status

All 23 tests pass. No security issues detected.

Add catch block to orchestrate() to properly handle and record errors
that occur during task processing. Previously uncaught errors would
bypass the failed event recording.

Add error handling to router defaultClassifier to gracefully handle
pattern.matches() throwing an error instead of crashing the entire
classification process.

Fixes:
- Errors from pattern matching, task preparation, or other ops now
  recorded as failed events instead of propagating uncaught
- Router continues to next pattern if one throws, fail-safe behavior
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.

1 participant