← Back to Pull requests

docs: explain model fallback and the streaming switch boundary #9

Closed
unknown closed this pull request without merging on Nov 25, 2026 09:15 UTC
View on GitHub
unknown unknown commented on Nov 25, 2026 03:11 UTC
Author

Purpose

Covers the Streaming fallback item of agentic-ai-java/argi#372 (Core agentic-ai-java/argi#368, issue agentic-ai-java/argi#210). Docs-only; no Core runtime changes.

What's changed

  • New Chinese/English guide frameworks/agent-framework/model-fallback: module and package, configuration, exhaustion error, cancellation and ExecutionGuard handling, the first-event switch boundary for streaming responses, per-subscription switch state, and ordering with ModelRetryInterceptor.

  • examples/streaming-fallback/: an offline example compiled against Core c6e453f20 with nine scenarios (see the coverage table in the guide).

  • Correction to the merged model-retry guide (#7): its streaming section only held for streaming ModelResponses. The example shows the independent ReActAgent with streamModel(true) collects the provider stream inside the model call and passes interceptors a non-streaming response, so both fallback and retry still switch or repeat after partial deltas (scenarios 8 and 9). Both locales now state this and link to the new guide.

  • Sidebar entry and a one-line link from the existing 模型回退 section of hooks-interceptors.
  • Validation

    Details are in examples/streaming-fallback/README.md. On macOS arm64 with Temurin JDK 21 (release target 17) and Maven 3.9.9:

  • Core c6e453f20 (Core main at the time of checking) installed; ModelFallbackTest,ModelRetryTest passed (62 tests).

  • Example compile exec:java passed, and again with -o.

  • npm run typecheck, lint, verify:contract and build (zh-Hans + en) passed on this PR's base 041a2c35; the cross-page anchors resolve in both locales.
  • Reviewer notes

  • Scenarios 8/9 assert the current behaviour: on the independent ReActAgent the delta view shows DraftDone after a mid-stream failure, and the same-ID snapshot then replaces it with Done. The guide documents this and points consumers to the snapshot rules in stream-message-identity. If the intent is that the "never concatenated" guarantee also holds for this engine, that would be a Core change; happy to open a separate Core issue if useful.

  • Scenarios 5/6 exercise the interceptor directly with a streaming handler (the shape the graph engine passes). End-to-end graph-based ReactAgent behaviour is not tested.

  • The validation record now names this PR's exact website base, addressing the base-mismatch note on #7.
  • 🤖 Generated with Claude Code

    Diff: 310 lines (+232 / -78) across 3 files Reviewer: Aias00 Review duration: 363m
    All Vouch review confidence checks passed
    Residual risk 0.17 = Change Risk (0.40) × (1 − Review Confidence (0.57)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.40 · 310 lines diff across 3 files
    0.40
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    56%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.343
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #9"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 56.8% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 40.3% (MEDIUM) · Higher = larger blast radius
    40.3%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 56.8% · Lower = rushed or shallow review
    56.8%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 17.4% · Safe to merge
    17.4%