Skip to content

fix: drop prompt rules that reference disabled tools - #6284

Open
JulianFriedle wants to merge 1 commit into
odysseus-dev:devfrom
JulianFriedle:fix/disabled-tool-rules
Open

JulianFriedle wants to merge 1 commit into
odysseus-dev:devfrom
JulianFriedle:fix/disabled-tool-rules

Conversation

@JulianFriedle

@JulianFriedle JulianFriedle commented Sep 14, 2026

Copy link
Copy Markdown

Summary

_assemble_prompt() filters TOOL_SECTIONS through included = 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 the manage_memory rule 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

  • This PR targets dev, not main.

Linked Issue

Fixes #6285

Type of Change

  • Bug fix (non-breaking — fixes a confirmed issue)

Checklist

  • I searched open issues and open PRs — this is not a duplicate.
  • This PR targets dev
  • My changes are limited to the scope described above — no unrelated refactors or whitespace changes mixed in.
  • I actually ran the app (docker compose up) and verified the change works end-to-end.
  • I did not run the app/runtime validation.

How to Test

1. Build and start

docker compose up -d --build

2. Verify the disabled tool no longer leaves its rule behind

docker compose exec odysseus python -c "
from src.agent_loop import _assemble_prompt
p = _assemble_prompt({'manage_memory','manage_notes'}, {'manage_memory'})
print('manage_memory in prompt:', 'manage_memory' in p)
print('manage_notes  in prompt:', 'manage_notes' in p)
"

Expected: False / True. Only the disabled tool's rule is removed; the rule
for the enabled tool stays. On dev without this change the same command
prints True / True.

3. Unit tests

python3 -m pytest tests/test_disabled_tool_rules.py -q

Expected: 6 passed.

4. End-to-end

Put a tool with a behavioural rule into disabled_tools, send a message
matching 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.py and adds a test file. No
rendering code, no CSS, no static/js/.

  • I am not an LLM agent submitting a bulk PR.

@github-actions github-actions Bot added needs work PR description incomplete — please update before review needs runtime validation Runtime validation not attested — tick the app-run box after running it, or state the gap labels Sep 14, 2026
@github-actions github-actions Bot added ready for review Description complete — ready for maintainer review and removed needs work PR description incomplete — please update before review needs runtime validation Runtime validation not attested — tick the app-run box after running it, or state the gap labels Sep 14, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready for review Description complete — ready for maintainer review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rules for disabled tools stay in the system prompt

1 participant