[GH-ISSUE #6721] [Issue]: Decision time limits cover a whole group of statements, so statements time out before the model works on them #3767

Closed
opened 2026-10-21 06:06:59 +07:00 by bsakaguchi · 0 comments
Owner

Originally created by @kolacheee on GitHub (Sep 26, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/6721

Originally assigned to: @kolacheee on GitHub.

A decision's time limit should belong to one statement. Today several backends give one limit to a whole group of statements, or start a statement's clock while it is still waiting behind the others. Statements then time out without the model ever working on them, and they read as no. This is the general form of #6718, which covered only Open-Jev 2B.

How to reproduce (try it yourself)

  1. Set Decision model to the Primary local model or Utility local model (llama.cpp, the default 2 parallel jobs for Primary or 1 for Utility).
  2. In a preset, add 32 different decision statements, for example {{#if decision:"The scene changed location."}}The scene has moved.{{/if}}, each with its own statement.
  3. Send a message, then look at which branches made it into the prompt (Peek Prompt).

What you'll see: only some branches are answered, and the rest read as no. For a local model nothing is logged at the default log level; with debug logging, each [decision] Local result line for the missing ones ends in (timeout). On the decision sidecar or a Decision connection the log shows [decision] Activation request failed: timeout.

What should happen: every statement gets its own full time limit, measured while the model is working on it.

Measured on staging 14773492f with Gemma 4 E4B Q8 on llama-server with 2 slots, through the engine's own local-model code:

Chat 8 statements 16 statements 32 statements
Short 8 answered 16 answered 19 answered
Long 0 answered in one run 16 answered 16 answered

Where it is

  • Local chat models (packages/server/src/services/decision/sidecar-decision.backend.ts, askSidecarNoulQuestions): every statement is sent at once, each with its own 4 s clock that starts when it is sent. llama-server works on only --parallel requests at a time, which is 2 by default for Primary and 1 for Utility, and queues the rest.
  • Decision connections (packages/server/src/services/decision/decision-default.ts): one System One request carries every statement and gets the connection's Time limit once, 1.5 s by default, whether it asks 1 statement or 32.
  • Decision sidecar (same file): a model installed by pasting its repository has no measured per-statement cost, so it gets a flat 4 s for the whole group. Every sidecar group is also capped at 20 s. The sidecar's server answers one request at a time behind a lock, and requests sent together each start their clock while they wait. Activation questions at different scan depths are sent together.

What's happening

The limit is attached to the request, not to the statements in it, and the clock starts when the request is sent, not when the model starts on it.

Suggested fix

  • Build every limit per statement, counting each Choice option as a statement. A connection's Time limit applies to each statement. The sidecar gets 4 s for its first statement and its measured cost, or 4 s when unmeasured, for each further one. Drop the group cap.
  • Queue decision requests per model server, as many at a time as it has slots, and start each statement's clock when it gets a slot.

Context

Staging only; the local-model and sidecar decision paths arrived in #6540 and #6556. Investigated with an AI agent; verify before fixing.

Originally created by @kolacheee on GitHub (Sep 26, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/6721 Originally assigned to: @kolacheee on GitHub. A decision's time limit should belong to one statement. Today several backends give one limit to a whole group of statements, or start a statement's clock while it is still waiting behind the others. Statements then time out without the model ever working on them, and they read as no. This is the general form of #6718, which covered only Open-Jev 2B. ## How to reproduce (try it yourself) 1. Set **Decision model** to the **Primary local model** or **Utility local model** (llama.cpp, the default 2 parallel jobs for Primary or 1 for Utility). 2. In a preset, add 32 different decision statements, for example `{{#if decision:"The scene changed location."}}The scene has moved.{{/if}}`, each with its own statement. 3. Send a message, then look at which branches made it into the prompt (Peek Prompt). **What you'll see:** only some branches are answered, and the rest read as no. For a local model nothing is logged at the default log level; with debug logging, each `[decision] Local result` line for the missing ones ends in `(timeout)`. On the decision sidecar or a Decision connection the log shows `[decision] Activation request failed: timeout`. **What should happen:** every statement gets its own full time limit, measured while the model is working on it. Measured on staging `14773492f` with Gemma 4 E4B Q8 on llama-server with 2 slots, through the engine's own local-model code: | Chat | 8 statements | 16 statements | 32 statements | | --- | --- | --- | --- | | Short | 8 answered | 16 answered | 19 answered | | Long | 0 answered in one run | 16 answered | 16 answered | ## Where it is - **Local chat models** (`packages/server/src/services/decision/sidecar-decision.backend.ts`, `askSidecarNoulQuestions`): every statement is sent at once, each with its own 4 s clock that starts when it is sent. llama-server works on only `--parallel` requests at a time, which is 2 by default for Primary and 1 for Utility, and queues the rest. - **Decision connections** (`packages/server/src/services/decision/decision-default.ts`): one System One request carries every statement and gets the connection's **Time limit** once, 1.5 s by default, whether it asks 1 statement or 32. - **Decision sidecar** (same file): a model installed by pasting its repository has no measured per-statement cost, so it gets a flat 4 s for the whole group. Every sidecar group is also capped at 20 s. The sidecar's server answers one request at a time behind a lock, and requests sent together each start their clock while they wait. Activation questions at different scan depths are sent together. ## What's happening The limit is attached to the request, not to the statements in it, and the clock starts when the request is sent, not when the model starts on it. ## Suggested fix - Build every limit per statement, counting each Choice option as a statement. A connection's Time limit applies to each statement. The sidecar gets 4 s for its first statement and its measured cost, or 4 s when unmeasured, for each further one. Drop the group cap. - Queue decision requests per model server, as many at a time as it has slots, and start each statement's clock when it gets a slot. ## Context Staging only; the local-model and sidecar decision paths arrived in #6540 and #6556. Investigated with an AI agent; verify before fixing.
bsakaguchi 2026-10-21 06:06:59 +07:00
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#3767
No description provided.