Skip to content

fix(agent): send no tools with the LLM connection test - #538

Merged
BaaRai merged 1 commit into
BaaRai:mainfrom
Phantom-IN:fix/conntest-no-background-tools
Nov 26, 2026
Merged

BaaRai merged 1 commit into
BaaRai:mainfrom
Phantom-IN:fix/conntest-no-background-tools

Conversation

@Phantom-IN

Copy link
Copy Markdown
Contributor

Fixes the cause behind #526.

TestConnection passes Tools: []actool.CoreTool{}, but agentcore still appends its background-task tools unless DisableBackgroundTasks is set. I put a logging proxy in front of my local Ollama and the "ping" request carried four tool definitions: TaskOutput, TaskStop, TaskList and Monitor. That matches the report: a much bigger prompt than a direct call, and replies that are TaskOutput-like text or a real tool_calls.

With gemma4:e4b the streaming test never got to OK. The model spent the full 30 s reasoning about whether to use those tools and the test failed with context deadline exceeded. With the tools off it answers OK in about 0.6 s, streaming and non-streaming.

The fix sets DisableBackgroundTasks: true, as agent/goals.go already does. The new TestConnectionSendsNoTools reads the request body from an httptest server and checks it has no tools. It fails on main with "sent 4 tools".

I didn't change the "any non-empty reply is Connected" check the issue also mentions. That felt like a separate decision.

go vet ./agent/ and go test ./agent/ pass.

TestConnection passes an empty Tools slice so the model gets a bare chat
request, but agentcore still appends its background-task tools (TaskOutput,
TaskStop, TaskList, Monitor) unless DisableBackgroundTasks is set. The
request therefore carried four tool definitions, and models answered the
"ping" with a TaskOutput call or tool-like text instead of OK (BaaRai#526).
Against a local gemma4:e4b the streaming test spent its whole 30 s budget
reasoning about those tools and failed; with them gone it answers OK in
under a second.

Set DisableBackgroundTasks, as goal decomposition already does, and add a
test that checks the request body has no tools.
@5P34R

5P34R commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

Review notes

Looks good to merge. DisableBackgroundTasks: true in TestConnection matches what agent/goals.go already does. It complements #573 (a different file and concern) and doesn't conflict with it beyond the usual CHANGELOG line.

@Phantom-IN

Copy link
Copy Markdown
Contributor Author

Thanks for checking it against #573.

@BaaRai
BaaRai merged commit 19fefb4 into BaaRai:main Nov 26, 2026
7 checks passed
@BaaRai

BaaRai commented Nov 26, 2026

Copy link
Copy Markdown
Owner

Merged, thanks @Phantom-IN. I reproduced both sides locally: the new test passes with the option set, and fails with exactly four tools (TaskOutput, TaskStop, TaskList, Monitor) when the line is removed.

@FoxSca

FoxSca commented Nov 26, 2026

Copy link
Copy Markdown

The original issue is no longer reproducible in my tested configuration after applying PR #538.

The fix successfully resolves the unexpected background-task tool injection observed during the Ollama connection test.

The existing database and configuration were preserved throughout the update.

This retest covers the connection diagnostic only, not autonomous agent execution. Response latency was not recorded.

Thank you both for your excellent support, investigation, and fix!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants