← Back to Pull requests

test(agent): lock the execution binding of the successful model turn (issue #269) #343

Closed
unknown closed this pull request without merging on Nov 01, 2026 07:25 UTC
View on GitHub
unknown unknown commented on Nov 01, 2026 03:13 UTC
Author

Describe what this PR does / why we need it

Locks the acceptance behavior of #269 with the test suite the issue requires. With #333 merged, the main scenario is already covered: an interceptor that swaps the whole registry via ModelRequest.toolRegistry(...) now has its registry flow into the effective tool set and back to the same-turn execution, so the issue's repro (original=1, replacement=0) no longer reproduces on current main — but none of the six behavior scenarios the issue's acceptance criteria ask for existed as tests, and the fallback/multi-attempt binding semantics were unproven.

Does this pull request fix one issue?

Fixes #269

Describe how you did it

Five new offline cases in ReActAgentTest (existing ScriptedClient pattern, one with a scripted-stream subclass):

1. Issue repro: an interceptor swaps the registry for a same-named implementation B — execution counts prove B ran (1) and the pre-chain A never did (0).
2. A tool added by the interceptor (absent from the static registry) is disclosed and executable.
3. A tool removed by the interceptor never falls back to the pre-chain binding — the call surfaces through the existing unknown-tool error path.
4. Each turn executes with that turn's own bindings: a tool disclosed only on the first model call executes once and is gone on the second turn even though the shared message list keeps growing.
5. The streaming tool-call path executes the replacement binding identically.

No production code was needed: the effective-set handoff introduced in #333 (chain-end resolution, per-turn AtomicReference, success-turn ownership) already satisfies the issue's acceptance criteria; this PR turns that into locked, reviewable behavior.

Describe how to verify it

./mvnw -pl argi-agent/argi-agent-core -am test -DskipTests=false -Dtest=ReActAgentTest — 21/21 green (16 pre-existing + 5 new). Full argi-agent-core reactor: 132/132. Checkstyle clean.

Special notes for reviews

The issue's duplicate-name clause (static shadows dynamic on conflicts) was already settled by #333's resolveTools/effectiveToolSet merge and is exercised by staticToolShadowsDynamicToolOnNameConflict. If the maintainers would rather close #269 as covered-by-#333 without this test PR, I'm happy to — but the acceptance criteria explicitly call for these behavior tests, so submitting them as the issue's deliverable.

Diff: 300 lines (+225 / -75) across 3 files Reviewer: yuluo-yx Review duration: 251m
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 · 300 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.341
Shallow Review Depth shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #343"
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.1% (MEDIUM) · Higher = larger blast radius
40.1%
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.3% · Safe to merge
17.3%