Repository navigation
Failure events 2/4: FailureManager and the DispatchEvents stream - #199
Open
shawnburke wants to merge 1 commit into
Open
shawnburke wants to merge 1 commit into
shawnburke wants to merge 1 commit into
Conversation
This was referenced Nov 20, 2026
The second of four PRs split from #190. It builds on the protocol and the single failure path, and delivers failures to clients that ask for them. - FailureManager owns everything failure-related: the per-dispatch queues (unbounded, so no failure is dropped), the axon_handler_failure_events_pending metric, retries through Manager.Trigger, and the 5-attempt cap. It queues only for clients that set DispatchRequest.failure_events. - Dequeue hands out a *FailureEvent. The stream calls Resolve(action) when the client answers, or Requeue() if the stream ends first, so an unanswered failure is sent again, ahead of the rest. - DispatchEvents drains the FailureManager with the same drain() that Dispatch uses for the Manager, and applies each DROP or RETRY answer. - The FailureManager is provided in the serve and relay stacks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
engrams-agent
Bot
force-pushed
the
shawn/failure-events-2-manager
branch
from
November 20, 2026 02:12
e1a7aa0 to
5019c4b
Compare
shawnburke
marked this pull request as ready for review
November 20, 2026 02:17
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
Customer ask to be able to be notified if Axon handlers fail, with the handler invoke info and the failure reason, and the ability to retry or drop them in that case.
This is the management of those failures which sends an invoke to the SDK hook to execute the failure handler code.
Summary
Part 2 of 4, split from #190 (COR2-1098). This PR delivers failures to clients that ask for them, and applies each client's answer. Based on #198.
Stack:
DispatchEvents(this PR)Design
FailureManager(handler/failure_manager.go) owns everything failure-related:axon_handler_failure_events_pendingmetric;Manager.Trigger, and the 5-attempt cap.It queues only for dispatch ids that subscribed, through
DispatchRequest.failure_eventsor by openingDispatchEvents.Handles.
Dequeuehands out a*FailureEvent. The stream callsResolve(action)when the answer arrives, orRequeue()if the stream ends first. An unanswered failure is then sent again, ahead of the rest. Exactly one of the two takes effect.DispatchEventsdrains theFailureManagerwith the samedrain()thatDispatchuses, and applies each answer.Retry finds the handler again after the client re-registered (new id, same dispatch id and name).
The
FailureManageris provided in the serve and relay stacks.Compatibility
failure_events, so nothing is queued.DispatchEventsanswersUnimplemented; the SDK logs once and stops asking.Known limits
Test plan
make -C agent test,test-racecaller_rejectedfailure.TIMEOUT, is answered RETRY, and runs as attempt 2;🤖 Generated with Claude Code