[GH-ISSUE #3958] [Issue]: Local LLM model's can time out if generation takes longer than 600 seconds, even when streaming. #2135

Closed
opened 2026-10-21 05:45:40 +07:00 by bsakaguchi · 4 comments
Owner

Originally created by @Sciguy429 on GitHub (Jul 23, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/3958

Originally assigned to: @SpicyMarinara on GitHub.

Summary

My local LLM's are 'failing' JSON parser validation when running as agents, despite generating valid JSON. Marinara Engine is canceling the task midway through and then rejecting the incomplete response.

Expected behavior

Local endpoints should not be restricted by typical endpoint timeout constraints. Most of my model's run at 10-15 tk/s and can take a good 2-3 minutes to prompt process a long context window chat. This is expected behavior for a local instance and the timeout should be configurable within the connection settings.

Actual behavior

LLama.cpp reports the task as 'canceled' and the web console from Marinara Engine shows a partial but not malformed JSON response:

26.36.453.098 I slot print_timing: id  0 | task 14020 | n_decoded =   4470, tg =  15.50 t/s, tg_3s =  15.44 t/s
26.39.484.757 I slot print_timing: id  0 | task 14020 | n_decoded =   4517, tg =  15.50 t/s, tg_3s =  15.50 t/s
26.42.524.759 I slot print_timing: id  0 | task 14020 | n_decoded =   4564, tg =  15.50 t/s, tg_3s =  15.46 t/s
26.42.847.579 W srv          stop: cancel task, id_task = 14020
26.42.911.950 I slot      release: id  0 | task 14020 | stop processing: n_tokens = 11819, truncated = 0
26.42.911.965 I srv  update_slots: all slots are idle

Response as listed in console (with the story data omitted):
Image
The final line of JSON shows it getting cut off midway through the generation:

{REDACTED STORY EDITS}
</span>\n</div>",
  "changes": [
    {
      "description": "Formatted the AL

Steps to reproduce

  1. Use a local LLM endpoint (IE llama.cpp).
  2. Enable any agent which takes a long time to run (like the HTML reformatter).
  3. Feed it a long task which will require at least 600s of generation time from llama.cpp for your particular model.

Environment

  • Marinara Engine version: V2.3.3
  • Install type: Releases page ZIP
  • OS + version: Windows 11
  • Browser or app shell: Firefox

Additional context

I have had this exact issue with a number of LLM tools at this point. Mainly Killocode and other VSCode based harnesses. The ideal solution for all of these in the past had been to add a configuration option for the timout to allow it to be disabled for local instances (and in some cases, add a defaults check which shuts it off automatically for known local address ranges: 127.0.0.1, 192.168.X.X and 10.10.X.X).

Furthermore, in reference to my previous issue from yesterday #3931 it seems this was actually the root cause. Of my local models:

  • DeepSeek-V4-Flash: Works (Processing speed is fast enough to not hit the timeout most of the time).
  • MiMo-V2.5: Fails
  • Stepfun-3.7-Flash: Fails
  • Hy3: Fails

After figuring out that the debug logs are in the browser and not the terminal, I checked and none of the failing models are responding with invalid JSON data, they are all getting cut off on the same manner as the logs I provided above.

(Also apologies if this technically counts as a feature request and not a bug. Wasn't sure which one to put it under.)

Template check

Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked:

  • [] I DID NOT read this template and provide the requested details.
Originally created by @Sciguy429 on GitHub (Jul 23, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/3958 Originally assigned to: @SpicyMarinara on GitHub. ## Summary My local LLM's are 'failing' JSON parser validation when running as agents, despite generating valid JSON. Marinara Engine is canceling the task midway through and then rejecting the incomplete response. ## Expected behavior Local endpoints should not be restricted by typical endpoint timeout constraints. Most of my model's run at 10-15 tk/s and can take a good 2-3 minutes to prompt process a long context window chat. This is expected behavior for a local instance and the timeout should be configurable within the connection settings. ## Actual behavior LLama.cpp reports the task as 'canceled' and the web console from Marinara Engine shows a partial but not malformed JSON response: ``` 26.36.453.098 I slot print_timing: id 0 | task 14020 | n_decoded = 4470, tg = 15.50 t/s, tg_3s = 15.44 t/s 26.39.484.757 I slot print_timing: id 0 | task 14020 | n_decoded = 4517, tg = 15.50 t/s, tg_3s = 15.50 t/s 26.42.524.759 I slot print_timing: id 0 | task 14020 | n_decoded = 4564, tg = 15.50 t/s, tg_3s = 15.46 t/s 26.42.847.579 W srv stop: cancel task, id_task = 14020 26.42.911.950 I slot release: id 0 | task 14020 | stop processing: n_tokens = 11819, truncated = 0 26.42.911.965 I srv update_slots: all slots are idle ``` Response as listed in console (with the story data omitted): <img width="2871" height="694" alt="Image" src="https://github.com/user-attachments/assets/31fdc55b-8fc3-4d92-94d2-b4ce0e18ac67" /> The final line of JSON shows it getting cut off midway through the generation: ``` {REDACTED STORY EDITS} </span>\n</div>", "changes": [ { "description": "Formatted the AL ``` ## Steps to reproduce 1. Use a local LLM endpoint (IE llama.cpp). 2. Enable any agent which takes a long time to run (like the HTML reformatter). 3. Feed it a long task which will require at least 600s of generation time from llama.cpp for your particular model. ## Environment - Marinara Engine version: V2.3.3 - Install type: Releases page ZIP - OS + version: Windows 11 - Browser or app shell: Firefox ## Additional context I have had this exact issue with a number of LLM tools at this point. Mainly Killocode and other VSCode based harnesses. The ideal solution for all of these in the past had been to add a configuration option for the timout to allow it to be disabled for local instances (and in some cases, add a defaults check which shuts it off automatically for known local address ranges: 127.0.0.1, 192.168.X.X and 10.10.X.X). Furthermore, in reference to my previous issue from yesterday #3931 it seems this was actually the root cause. Of my local models: * DeepSeek-V4-Flash: Works (Processing speed is fast enough to not hit the timeout most of the time). * MiMo-V2.5: Fails * Stepfun-3.7-Flash: Fails * Hy3: Fails After figuring out that the debug logs are in the browser and not the terminal, I checked and none of the failing models are responding with invalid JSON data, they are all getting cut off on the same manner as the logs I provided above. (Also apologies if this *technically* counts as a feature request and not a bug. Wasn't sure which one to put it under.) ## Template check Please **uncheck (untick)** the box below before submitting so we know you read the template. It is intentionally pre-checked: - [] I DID NOT read this template and provide the requested details.
bsakaguchi 2026-10-21 05:45:40 +07:00
Author
Owner

@SpicyMarinara commented on GitHub (Jul 23, 2026):

Hey pookie, you can edit the CHAT_GENERATION_TIMEOUT_MS in your .env file to lengthen it.

https://github.com/Pasta-Devs/Marinara-Engine/blob/main/docs/CONFIGURATION.md#timeouts

<!-- gh-comment-id:5055582063 --> @SpicyMarinara commented on GitHub (Jul 23, 2026): Hey pookie, you can edit the `CHAT_GENERATION_TIMEOUT_MS` in your `.env` file to lengthen it. https://github.com/Pasta-Devs/Marinara-Engine/blob/main/docs/CONFIGURATION.md#timeouts
Author
Owner

@Sciguy429 commented on GitHub (Jul 24, 2026):

CHAT_GENERATION_TIMEOUT_MS

I have added some timeout overrides to my config and am still getting the issue:

# Marinara Engine - runtime configuration.
# This file is empty by design. Copy any setting you want to change from
# .env.example (same folder) and edit the value here. Most changes take
# effect within ~2 seconds without a restart.
PROVIDER_LOCAL_URLS_ENABLED=true

#Timeout options
CHAT_GENERATION_TIMEOUT_MS=3600000
EMBEDDING_TIMEOUT_MS=3600000
CUSTOM_TOOL_TIMEOUT_MS=3600000

The first agent pass for the HTML agent is still bound by the 300s timeout, but the second is now bound by a 600s timeout for some reason:
Image

Image

I am not sure at all what is going on here. Did I mess up the file formatting in some way?

<!-- gh-comment-id:5064805204 --> @Sciguy429 commented on GitHub (Jul 24, 2026): > `CHAT_GENERATION_TIMEOUT_MS` I have added some timeout overrides to my config and am still getting the issue: ``` # Marinara Engine - runtime configuration. # This file is empty by design. Copy any setting you want to change from # .env.example (same folder) and edit the value here. Most changes take # effect within ~2 seconds without a restart. PROVIDER_LOCAL_URLS_ENABLED=true #Timeout options CHAT_GENERATION_TIMEOUT_MS=3600000 EMBEDDING_TIMEOUT_MS=3600000 CUSTOM_TOOL_TIMEOUT_MS=3600000 ``` The first agent pass for the HTML agent is still bound by the 300s timeout, but the second is now bound by a 600s timeout for some reason: <img width="2541" height="141" alt="Image" src="https://github.com/user-attachments/assets/35693057-5ab7-4e9c-bf54-92a4a6f58a73" /> <img width="2499" height="337" alt="Image" src="https://github.com/user-attachments/assets/7f3dec6a-a07e-4e18-b807-cf6bc06affb8" /> I am not sure at all what is going on here. Did I mess up the file formatting in some way?
Author
Owner

@SpicyMarinara commented on GitHub (Jul 24, 2026):

No, these should be respected. I'll investigate.

<!-- gh-comment-id:5066474777 --> @SpicyMarinara commented on GitHub (Jul 24, 2026): No, these should be respected. I'll investigate.
Author
Owner

@SpicyMarinara commented on GitHub (Jul 24, 2026):

Root cause found and fixed in draft PR #4025 (owned by @SpicyMarinara, Claude agent session).

Your .env was correct — the override just wasn't wired to agents. Agent LLM calls (the HTML reformatter, trackers, etc.) never read CHAT_GENERATION_TIMEOUT_MS; they were bounded by a hardcoded 300s total-duration cap, which is why a healthy model streaming at ~15 tk/s still got cancelled at exactly 5 minutes.

The "second pass bound by 600s" you saw is the automatic invalid-JSON retry: when the first pass is cut at 300s the truncated output fails validation, and the retry runs with a fresh 300s signal — so 300 + 300 ≈ 600s of wall-clock. Not a different timeout.

The PR adds a dedicated AGENT_CALL_TIMEOUT_MS (10s–1h, hot-reloaded like the chat one). Setting e.g. AGENT_CALL_TIMEOUT_MS=1800000 will let your slower models finish. Once it's merged to staging you'll be able to test it.

<!-- gh-comment-id:5066571387 --> @SpicyMarinara commented on GitHub (Jul 24, 2026): Root cause found and fixed in draft PR #4025 (owned by @SpicyMarinara, Claude agent session). Your `.env` was correct — the override just wasn't wired to agents. Agent LLM calls (the HTML reformatter, trackers, etc.) never read `CHAT_GENERATION_TIMEOUT_MS`; they were bounded by a hardcoded 300s **total-duration** cap, which is why a healthy model streaming at ~15 tk/s still got cancelled at exactly 5 minutes. The "second pass bound by 600s" you saw is the automatic invalid-JSON retry: when the first pass is cut at 300s the truncated output fails validation, and the retry runs with a *fresh* 300s signal — so 300 + 300 ≈ 600s of wall-clock. Not a different timeout. The PR adds a dedicated `AGENT_CALL_TIMEOUT_MS` (10s–1h, hot-reloaded like the chat one). Setting e.g. `AGENT_CALL_TIMEOUT_MS=1800000` will let your slower models finish. Once it's merged to staging you'll be able to test it.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#2135
No description provided.