Skip to content

How to control Timeouts #1065

Closed
Closed

Description

@mrbm

I am running ollama on my local network on a dedicaled m4 24gig with Qwen3:14b Quant with 65k context window.

I had it create a slightly more than basic react app and it created things, wrote some of the thngs in the dialog and wrote 50% of the things to disk, the other 50 it didn't I gave it a command to write the rest of the items...and then it did some, but not all of it, i did another command to finish...and now it just timesout.

I am reading the ollama serve logs and noticed that open code is sending a timeout singnal around 4 min ond each time.

So...the issue is opencode.

I didn't set a timeout in the config. Then i tried setting a timeout in the opencode config to 600 seconds, same results.

{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "ollama-local-remote": {
      "npm": "@ai-sdk/openai-compatible",
      "options": {
        "baseURL": "http://192.168.XX.XXX:11434/v1",
        "timeout": 600000
      },
      "models": {
        "llama3:8b": {"name": "Ollama Llama3"},
        "qwen3:14b-65k": {
          "name": "qwen3:14b 65k (remote local)",
          "tools": true,
          "reasoning": true,
          "options": { "num_ctx": 65536 }
        },
        "qwen3:14b-q4_K_M": {
          "name": "qwen3:14b-q4_K_M (remote local)",
          "tools": true,
          "reasoning": true
        }

Is this the right way to do it? Or is this something that can't be changed. Thanks! OpenCode.ai special sauce is going to be for those homebuilds which are going to have less resources and as a result opencode needs to be able to wait longer. Love the community thoughts or is this coming soon. I think there was 3 releases yesterday so i know things are happening rapidly.

Activity

  1. thdxr commented on Jul 16, 2025

    @thdxr
    Member

    hmm im not sure where this timeout is being set - i don't think that timeout option exists

  2. self-assigned this
    on Jul 16, 2025
  3. mrbm commented on Jul 16, 2025

    @mrbm
    Author

    I am not attempted to be super familiar with the code base, but just a quick search brings me to this:

    https://github.com/sst/opencode/blob/dev/packages/opencode/src/util/timeout.ts

    Is there a way to set this project to wait a certain time length max or indefinitely? Or does this have a default waiting period occuring at some stage of the project? Maybe some &http.Client method has a default timeout? I'm in a dr office waiting with my eyes dialated so can't really see anymore.. but maybe these notes help

  4. douglarek commented on Jul 17, 2025

    @douglarek

    Maybe same as #655, opencode does not complete a download service but ends abruptly. My scenario is upgrading software packages in the Gentoo overlay. The download stops halfway, causing the Manifest that records the package to write an incorrect checksum.

  5. mrbm commented on Jul 17, 2025

    @mrbm
    Author

    https://github.com/sst/opencode/blob/60b55f9d921805a4a9d38c9eed05a060df08df82/packages/opencode/src/tool/bash.ts

    i see timeouts here, i have no idea how this might be effecting http.client requests to an llm or requests for other things, but i think there is a possible issue somehere.

  6. mrbm commented on Jul 17, 2025

    @mrbm
    Author

    @thdxr i think the real pillar of strength that claude and google can't take from this project will be the ability to use local models which are obvious always going to run slower. I do think testing on a slow response scenario where from a separate machine running ollama might not response for 7 min while it thinks is a worthy test case to backtrack and find where open code might be closing the connection pre-maturely.

  7. thdxr commented on Jul 24, 2025

    @thdxr
    Member

    yep will look into this

  8. noahfraiture commented on Jul 28, 2025

    @noahfraiture

    I agree that timeout would be very convenient, but also for other capabilities like bash execution

  9. ggaabe commented on Jul 31, 2025

    @ggaabe
    Contributor

    running into timeouts from slow local model responses as well. would be great to control.

  10. dc-tec commented on Aug 1, 2025

    @dc-tec

    Same here when running a larger local model, would be nice if we could configure the timeout.

  11. dysangel commented on Aug 3, 2025

    @dysangel

    same. My model was trying to do multiple tool calls and eventually timing out. I'd be happy to just be able to disable the timeout for local use

  12. egyptianbman commented on Aug 9, 2025

    @egyptianbman
    Contributor

    Same here, getting constant timeouts with ollama. When this happens, the request is not aborted so the model keeps churning and subsequent requests are more likely to fail as the model is busy.

  13. dysangel commented on Aug 9, 2025

    @dysangel

    I've been looking into this the last few days. By default a lot of network requests time out after 5 minutes. I'm submitting a PR to mlx-lm to send back SSE comments which notify that the prompt is currently processing and keep the connection alive. If necessary we could make similar keepalive tweaks to ollama and llama.cpp etc to allow time for local models to process very large contexts without all the clients disconnecting

  14. jamviking commented on Aug 9, 2025

    @jamviking

    As I am experiencing the same timeout issue when running OpenCode against a local LMStudio installation, us local users need a way to override the default NodeJS timeout as documented here: https://blog.appsignal.com/2023/11/08/how-to-use-timeouts-in-nodejs.html

    Hope this helps as I need it...

  15. dysangel commented on Aug 9, 2025

    @dysangel

    @jamviking if you're using an MLX model, then yes that issue is still present

  16. 8 remaining items

  17. egyptianbman commented on Aug 18, 2025

    @egyptianbman
    Contributor

    For those that are blocked by the fix being merged, I've found that https://github.com/charmbracelet/crush works as well as opencode and doesn't suffer from the timeout issue.

  18. dysangel commented on Aug 18, 2025

    @dysangel

    my fix for mlx-lm was merged into main, so if you set up an MLX server now, you should have no timeout issues

  19. eduardogarre commented on Aug 24, 2025

    @eduardogarre

    Also affected by this issue

  20. mrbm commented on Aug 24, 2025

    @mrbm
    Author

    Hey @thdxr just making sure you saw this and the solution somebody provided.

  21. adamwlarson commented on Aug 26, 2025

    @adamwlarson

    also impacted by this

  22. dannyfranca commented on Aug 30, 2025

    @dannyfranca

    1+, Using GPT-5 with Opencode and high reasoning is not practical at all.

  23. rekram1-node commented on Aug 31, 2025

    @rekram1-node
    Contributor

    support will be added in next release thx for your patience

  24. Cyrille37 commented on Nov 5, 2025

    @Cyrille37

    Thanks for timeout provider option, it works great.

    I need an increased timeout with my computer without GPU

  25. wangsen992 commented on Dec 16, 2025

    @wangsen992

    Thanks for timeout provider option, it works great.

    I need an increased timeout with my computer without GPU

    @Cyrille37 I'm look for a solution to this issue. Based on your comment it seems you managed to do this, may I ask how did you do it to enable longer timeouts? Thank you!

  26. rekram1-node commented on Dec 16, 2025

    @rekram1-node
    Contributor

    @wangsen992 what version are u on, what timeouts are u seeing?

  27. Cyrille37 commented on Dec 17, 2025

    @Cyrille37

    @wangsen992 Added timeout in provider's options config. Have a look at #3708 for an example.

  28. Cyrille37 commented on Dec 17, 2025

    @Cyrille37

    Also, this option is not in documentation, only found in config schema.

  29. dysangel commented on Dec 17, 2025

    @dysangel

    @Cyrille37 thanks! I'll have to try open again sometime

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions