Files
LocalAGI/core
Ettore Di Giacinto f0df15cdfe fix(agent): guard the tool-call lookup that ends a job
consumeJob read Messages[len-2].ToolCalls[0] behind a guard that only
checked that the message list was non-empty. Neither index was safe.

When the model returns no tool selection, the fragment still ends in a
tool role but the message before it carries an empty ToolCalls slice.
On a LocalAI backend serving a 50176-token context, a 50603-token
request produced exactly that, and the read panicked with "index out of
range [0] with length 0". consumeJob runs on its own goroutine with no
recover, so the panic ended the process instead of the job, and the
agent crash-looped on every restart.

The lookup moves to lastToolCallName, which reports failure instead of
indexing when the conversation is too short or carries no tool call.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KZaoEXfGsjmkhXtVxtvPp4
2026-08-24 18:49:54 +00:00
..
2026-03-25 14:25:29 +00:00
2026-08-22 08:33:30 +02:00