mirror of
https://github.com/mudler/LocalAGI.git
synced 2026-08-27 11:25:27 -04:00
f0df15cdfe
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