Opencode with litellm just stops before finishing the task. #2232

Closed
opened 2026-02-16 17:34:46 -05:00 by yindo · 5 comments
Owner

Originally created by @sylvain-billie on GitHub (Oct 22, 2025).

Originally assigned to: @rekram1-node on GitHub.

Question

On a mac, with opencode version: 0.15.13.

{
  "$schema": "https://opencode.ai/config.json",
  "model": "litellm/gemini-2.5-pro",
  "small_model": "litellm/gemini-2.5-flash",
  "provider": {
    "litellm": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "<name>",
      "options": {
        "baseURL": "<url>",
        "timeout": 600000
      },
      "models": {
        "gemini-2.5-pro": {
          "name": "gemini-2.5-pro",
          "options": {
            "temperature": 0.7,
            "top_p": 1,
            "max_tokens": 2048,
            "stop": [],
            "response_format": {
              "type": "text"
            },
            "tool_choice": "auto",
            "thinking": {
              "type": "enabled",
              "budget_tokens": 4096
            }
          }
        },
        "gemini-2.5-flash-lite": {
          "name": "gemini-2.5-flash-lite"
        },
        "gemini-2.5-flash": {
          "name": "gemini/gemini-2.5-flash"
        }
      }
    }
  },
  "tools": {
    "bash": true,
    "read": true,
    "grep": true,
    "glob": true,
    "list": true,
    "patch": true,
    "todowrite": true
  }
}

I tried without the "options" as well.

What happens is, the agent just gives up in the middle of a task.
If I have subagents, they get started, but they stop, and the primary agent just waits forever.

Anyone knows if I am missing a config or if there is a way to see logs so I can know what's up?

you can see it give up in this gif:

Image

Originally created by @sylvain-billie on GitHub (Oct 22, 2025). Originally assigned to: @rekram1-node on GitHub. ### Question On a mac, with opencode version: 0.15.13. ```json { "$schema": "https://opencode.ai/config.json", "model": "litellm/gemini-2.5-pro", "small_model": "litellm/gemini-2.5-flash", "provider": { "litellm": { "npm": "@ai-sdk/openai-compatible", "name": "<name>", "options": { "baseURL": "<url>", "timeout": 600000 }, "models": { "gemini-2.5-pro": { "name": "gemini-2.5-pro", "options": { "temperature": 0.7, "top_p": 1, "max_tokens": 2048, "stop": [], "response_format": { "type": "text" }, "tool_choice": "auto", "thinking": { "type": "enabled", "budget_tokens": 4096 } } }, "gemini-2.5-flash-lite": { "name": "gemini-2.5-flash-lite" }, "gemini-2.5-flash": { "name": "gemini/gemini-2.5-flash" } } } }, "tools": { "bash": true, "read": true, "grep": true, "glob": true, "list": true, "patch": true, "todowrite": true } } ``` I tried without the "options" as well. What happens is, the agent just gives up in the middle of a task. If I have subagents, they get started, but they stop, and the primary agent just waits forever. Anyone knows if I am missing a config or if there is a way to see logs so I can know what's up? you can see it give up in this gif: ![Image](https://github.com/user-attachments/assets/e7145009-4e1f-4f01-ba87-33129c607442)
yindo closed this issue 2026-02-16 17:34:46 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Oct 22, 2025):

This issue might be a duplicate of existing issues. Please check:

  • #807: Very similar issue where litellm hangs with specific models - user reports the session just hangs after startup
  • #2052: Subagents getting stuck into tool usage loops - describes subagents stopping unexpectedly during tasks
  • #1734: Agent hangs with 'working...' state - similar hanging behavior where agents stop responding
  • #2378: Subagents stop when requesting permission - describes subagents that get started but then stop, with the primary agent waiting

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Oct 22, 2025): This issue might be a duplicate of existing issues. Please check: - #807: Very similar issue where litellm hangs with specific models - user reports the session just hangs after startup - #2052: Subagents getting stuck into tool usage loops - describes subagents stopping unexpectedly during tasks - #1734: Agent hangs with 'working...' state - similar hanging behavior where agents stop responding - #2378: Subagents stop when requesting permission - describes subagents that get started but then stop, with the primary agent waiting Feel free to ignore if none of these address your specific case.
Author
Owner

@rekram1-node commented on GitHub (Oct 22, 2025):

@sylvain-billie as far as I can tell and I watched your whole recording, this is just the model stopping, it isn't opencodes fault (nor is your config bad) it is just the model stopping, it looped a decent amount but there are more capable models than gemini 2.5 pro, even the "dumber" models like kimi k2 are much more capable agentically (can loop longer)

But then again, even good models like gpt-5-codex will do this "stop" occasionally.

@rekram1-node commented on GitHub (Oct 22, 2025): @sylvain-billie as far as I can tell and I watched your whole recording, this is just the model stopping, it isn't opencodes fault (nor is your config bad) it is just the model stopping, it looped a decent amount but there are more capable models than gemini 2.5 pro, even the "dumber" models like kimi k2 are much more capable agentically (can loop longer) But then again, even good models like gpt-5-codex will do this "stop" occasionally.
Author
Owner

@sylvain-billie commented on GitHub (Oct 23, 2025):

@rekram1-node I see, thanks for checking.

But then how can you handle sub-agents? Since they stop, I can't ask them to continue. Any request to them goes back to the primary. And the primary says it's waiting for the sub to finish.

@sylvain-billie commented on GitHub (Oct 23, 2025): @rekram1-node I see, thanks for checking. But then how can you handle sub-agents? Since they stop, I can't ask them to continue. Any request to them goes back to the primary. And the primary says it's waiting for the sub to finish.
Author
Owner

@rekram1-node commented on GitHub (Oct 23, 2025):

we need a better ux for subagents but it is hard to tell what could br causing that for you, the primary agent is aware of whatever the last thing a subagent says

@rekram1-node commented on GitHub (Oct 23, 2025): we need a better ux for subagents but it is hard to tell what could br causing that for you, the primary agent is aware of whatever the last thing a subagent says
Author
Owner

@sylvain-billie commented on GitHub (Oct 23, 2025):

alright, thanks for taking the time. I'll close this issue.

@sylvain-billie commented on GitHub (Oct 23, 2025): alright, thanks for taking the time. I'll close this issue.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#2232