fix: drop prompt rules that reference disabled tools - #6284
Open
JulianFriedle wants to merge 1 commit into
Open
JulianFriedle wants to merge 1 commit into
JulianFriedle wants to merge 1 commit into
Conversation
3 tasks
This branch has not been deployed
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.
Summary
_assemble_prompt()filtersTOOL_SECTIONSthroughincluded = tool_names - disabled, but appends the static rule blocks (_AGENT_RULES,_API_AGENT_RULES,_DOMAIN_RULES) unchanged. A disabled tool therefore loses its schema and its description while keeping its behavioural rule, so the prompt can instruct the model to use a tool it has not been given. On dev @3b6c16916233 themanage_memoryrule sits in both_AGENT_RULES(L437) and_API_AGENT_RULES(L451), so the prompted and the native-tool-calling path are equally affected.This adds
_strip_disabled_tool_rules(), which removes bullet lines naming a disabled tool in backticks, applied to the finished prompt at both return points of_assemble_prompt(). It is a no-op when nothing is disabled, so default behaviour is unchanged.Target branch
dev, notmain.Linked Issue
Fixes #6285
Type of Change
Checklist
devdocker compose up) and verified the change works end-to-end.How to Test
1. Build and start
2. Verify the disabled tool no longer leaves its rule behind
Expected:
False/True. Only the disabled tool's rule is removed; the rulefor the enabled tool stays. On
devwithout this change the same commandprints
True/True.3. Unit tests
Expected:
6 passed.4. End-to-end
Put a tool with a behavioural rule into
disabled_tools, send a messagematching that rule's trigger in agent mode, and confirm the model now uses an
available tool instead of making no call at all.
Visual / UI changes — REQUIRED if you touched anything that renders
Not applicable — this PR touches
src/agent_loop.pyand adds a test file. Norendering code, no CSS, no
static/js/.