Repository navigation
feat(agent): enforce cancellation-aware switch boundary for streaming model fallback (issue #210) - #368
Open
XianReallyHot-ZZH wants to merge 1 commit into
Conversation
… model fallback (issue agentic-ai-java#210) ModelFallbackInterceptor matched only top-level CancellationException, so a wrapped cancellation still dispatched another provider call, and streaming failures were passed through unchanged regardless of observable output. - Detect cancellations through the cause chain (depth-bounded against cyclic chains) and terminate without switching; the unwrapped identity is kept before and after the first emitted event. Reactive paths never touch the pooled thread's interrupt flag; the synchronous path keeps its thread-aware semantics. - Switch a failing stream to the next candidate only before any event (text delta, tool call, usage, response) has been emitted; afterwards the failure terminates the stream so two models' output is never concatenated. - Check the request's ExecutionGuard before every attempt, the primary included; a dead run is terminal on both the synchronous and the streaming path. - Dispatch the streaming switch on boundedElastic so a non-streaming fallback candidate cannot park the thread that delivered the failure. - Give each subscription its own switch state, extend the aggregate failure message with the attempt sequence, and document the recommended fallback-outer/retry-inner composition order.
6 tasks
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.
Contributing to ARGI: enforce a cancellation-aware switch boundary for streaming model fallback in ModelFallbackInterceptor — cause-chain cancellation detection, first-event switch gate, per-attempt execution guard checks, boundedElastic switch dispatch and per-subscription switch state, aligning the interceptor with ModelRetryInterceptor's streaming semantics (issue #210).