[PR #11152] fix(session): stop loop when model returns non-tool finish reason #13670

Open
opened 2026-02-16 18:18:30 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/11152

State: open
Merged: No


Fixes #11153

When the model returns finish_reason=stop, the processor was returning "continue" causing repeated API calls with identical messages.

Change: Return "stop" from processor when finish reason is not "tool-calls" or "unknown".

Verification: Traced through logs from a stuck session - model returned finish_reason=stop but processor returned "continue", loop kept running. With this fix, processor returns "stop" and loop breaks.

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/11152 **State:** open **Merged:** No --- Fixes #11153 When the model returns finish_reason=stop, the processor was returning "continue" causing repeated API calls with identical messages. **Change:** Return "stop" from processor when finish reason is not "tool-calls" or "unknown". **Verification:** Traced through logs from a stuck session - model returned finish_reason=stop but processor returned "continue", loop kept running. With this fix, processor returns "stop" and loop breaks.
yindo added the pull-request label 2026-02-16 18:18:30 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#13670