Repository navigation
fix(agent): honor interceptor tool selection and dynamic registries in standalone ReAct (issue #268) - #333
Merged
yuluo-yx merged 1 commit intoOct 30, 2026
Conversation
…n standalone ReAct (issue agentic-ai-java#268)
This was referenced Oct 31, 2026
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.
Describe what this PR does / why we need it
The standalone ReAct agent's
invokeModeldisclosed the full static tool registry to the model regardless ofModelRequest's tool-selection semantics — an interceptor callingtools(List.of())(explicit empty selection) still left every tool visible, and explicit subsets and invocation-local dynamic registries were ignored. Selection semantics now gate both disclosure and execution, so what the model sees and what can run always agree.Does this pull request fix one issue?
Fixes #268
Describe how you did it
dynamicToolRegistry(static shadows same-named dynamic disclosures, matchingModelRequest.getTools()'s existing distinct order), narrowed by the explicit selection whenhasToolSelection()is set. An explicit empty selection disables disclosure and execution entirely; an absent selection uses every binding.resolveTools's static/dynamic merge previously threw on duplicate names, which made the duplicate-name policy untestable; it now applies the same shadowing rule.Describe how to verify it
ReActAgentTest(+8 cases, all offline via the existingScriptedClientpattern): unfiltered disclosure guard (including the no-copy fast path), explicit empty selection (no disclosure + unknown-tool error on a filtered call), subset selection (chosen tool disclosed and executed, filtered tool never leaks), dynamic tools participating in selection, static-shadowing-dynamic on name conflicts (execution counts 1:0), streaming and non-streaming disclosing the same filtered set, and no selection leakage across sequential runs.Run:
./mvnw -pl argi-agent/argi-agent-core -am test -DskipTests=falseFull module: 69 tests green (with argi-api / runtime-api / agent-api upstream in the reactor); checkstyle clean; studio compilation unaffected.
Special notes for reviews
executeToolruns exactly as before.resolveToolsis the one deliberate behavior widening: a static and a dynamic tool with the same name used to fail the whole merge; the static binding now shadows the dynamic one (consistent withgetTools()), which the issue's acceptance criteria require to be testable.