feat(agent): add streaming delivery boundary with bounded format repair (T39) #179
All Vouch review confidence checks passed
Residual risk 0.20 = Change Risk (0.45) × (1 − Review Confidence (0.57)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.45 · 444 lines diff across 5 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
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.365
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #179"
general
weight: 0.35
yuluo-yx
Describe what this PR does / why we need it
Second and closing part of T39 (#142): brings the structured delivery contract of #173 to the streaming path and adds the bounded format repair. Streaming consumers so far could only observe raw text deltas — no validated delivery boundary existed, and a format-repair retry had no guarantee against replaying side-effectful tools.
Does this pull request fix one issue?
Fixes #142
Describe how you did it
ReactAgent.streamResult(...), mirroring thestreamMessagesentries, returns aFlux<AgentResult>: text-delta chunks are re-published as provisional results with anullstatus — explicitly unvalidated — and the final aggregated response (located through the existingargiFinalResponseprotocol convention, no protocol change) is buffered and finalized once the stream completes, so unverified chunks are never reported as a delivery. A run that ends without a terminal response is reported as INTERRUPTED, never as completed. The terminal usage comes from the final response itself (the streaming path'sNodeOutput.tokenUsageis unknown).ToolChoice.none()) and never touches the graph, so side-effectful tools cannot be replayed. The repaired output is re-validated without a second attempt (bounded likeModelRetryInterceptor's attempt model); a still-invalid result is markedREPAIRED_STILL_INVALID, and a failing repair client leaves the original failure untouched.callResultautomatically gains the repair capability through the same finalizer.Describe how to verify it
StructuredOutputFinalizerTest(+3): repair turns an invalid output into a completed delivery (one client call); a still-invalid repair is marked and not retried; a failing repair client keeps the original failure.ReactAgentStreamResultTest(4 cases, scripted streaming client end to end): provisional chunks carrynullstatus and the last element is the validated COMPLETED delivery with usage; an invalid stream output is repaired exactly once; without repair capability the delivery reports VALIDATION_FAILED; and a guard test asserting the legacystreamMessagesbehavior is untouched.ReactAgentCallResultTest: two cases adapted to the repair semantics.Special notes for reviews
argiFinalResponsealready marks the final aggregated block;streamResultis a consumer-side extension, andAgentChatProtocol/NodeExecutorare untouched.AgentResultshape with anullstatus instead of extending the four-state terminal vocabulary — the terminal statuses describe deliveries, and a delta is not a delivery.