Skip to content

Session loop doesn't stop when model returns finish_reason=stop #11153

@tremo1

Description

@tremo1

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions