[PR #399] [MERGED] fix: guard against large output limit causing infinite summarize loop #9608

Closed
opened 2026-02-16 18:13:50 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/anomalyco/opencode/pull/399
Author: @unkhz
Created: 6/25/2025
Status: Merged
Merged: 6/25/2025
Merged by: @thdxr

Base: devHead: fix/output-limit-summarize-loop


📝 Commits (1)

  • 654b52f fix: guard against large output limit causing infinite summarize loop

📊 Changes

1 file changed (+4 additions, -1 deletions)

View changed files

📝 packages/opencode/src/session/index.ts (+4 -1)

📄 Description

Attempt fixing https://github.com/sst/opencode/issues/262

Problem:
The auto summarize logic goes into infinite loop summarizing the previous conversation if model output limit ends up being larger than the context limit.

Easy way to reproduce this is using a local model with such configuration. However, this could happen for other providers as well if the reported limits are faulty.

{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "lmstudio": {
      "npm": "@ai-sdk/openai-compatible",
      "options": {
        "baseURL": "http://localhost:8080/v1"
      },
      "models": {
        "qwen/qwen3-30b-a3b": {
          "limit": { "context": 131072, "output": 1000000 }
        },
        "mistralai/devstral-small-2505": {
          "limit": { "context": 131072, "output": 1000000 }
        }
      }
    }
  }
}

Solution:
Use 0 as minimum value for the limit calculation to avoid any possibility of that calculation resulting in negative number.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/anomalyco/opencode/pull/399 **Author:** [@unkhz](https://github.com/unkhz) **Created:** 6/25/2025 **Status:** ✅ Merged **Merged:** 6/25/2025 **Merged by:** [@thdxr](https://github.com/thdxr) **Base:** `dev` ← **Head:** `fix/output-limit-summarize-loop` --- ### 📝 Commits (1) - [`654b52f`](https://github.com/anomalyco/opencode/commit/654b52f22037f248b08c84023ac3b587f2dd3082) fix: guard against large output limit causing infinite summarize loop ### 📊 Changes **1 file changed** (+4 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `packages/opencode/src/session/index.ts` (+4 -1) </details> ### 📄 Description Attempt fixing https://github.com/sst/opencode/issues/262 Problem: The auto summarize logic goes into infinite loop summarizing the previous conversation if model output limit ends up being larger than the context limit. Easy way to reproduce this is using a local model with such configuration. However, this could happen for other providers as well if the reported limits are faulty. ```json { "$schema": "https://opencode.ai/config.json", "provider": { "lmstudio": { "npm": "@ai-sdk/openai-compatible", "options": { "baseURL": "http://localhost:8080/v1" }, "models": { "qwen/qwen3-30b-a3b": { "limit": { "context": 131072, "output": 1000000 } }, "mistralai/devstral-small-2505": { "limit": { "context": 131072, "output": 1000000 } } } } } } ``` Solution: Use 0 as minimum value for the limit calculation to avoid any possibility of that calculation resulting in negative number. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-16 18:13:50 -05:00
yindo closed this issue 2026-02-16 18:13:50 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#9608