When the model returns a response with finish_reason=stop (no tool calls, just text), the session loop continues making API calls with identical messages instead of stopping.
Expected: Loop stops when model indicates it's done
Actual: Loop continues, sending the same request repeatedly
Root cause: In processor.ts, the process() function returns "continue" even when finish_reason=stop. It only returns "stop" for errors or blocked states.
Impact: Causes infinite loops until timeout or error, wastes API calls
When the model returns a response with
finish_reason=stop(no tool calls, just text), the session loop continues making API calls with identical messages instead of stopping.Expected: Loop stops when model indicates it's done
Actual: Loop continues, sending the same request repeatedly
Root cause: In
processor.ts, theprocess()function returns"continue"even whenfinish_reason=stop. It only returns"stop"for errors or blocked states.Impact: Causes infinite loops until timeout or error, wastes API calls