[GH-ISSUE #4741] [Issue]: Model catalog gaps #2605

Closed
opened 2026-10-21 05:51:11 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @xDanteMD on GitHub (Aug 8, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/4741

Originally assigned to: @SpicyMarinara on GitHub.

Summary

While investigating inconsistent Professor Mari workspace behavior (alt greetings reported as generated but missing from the character card), I traced the issue to the model catalog's maxOutput resolution chain. Several model families accessed via NanoGPT, OpenRouter, and the Custom (OAI-compatible) provider silently receive an 8192 maxOutput fallback — far below their actual capabilities. This causes silent data loss when generating complex multi-item outputs, because the workspace agent's truncation detection is bypassed when tool calls are present.

Expected behavior

Models with known capabilities (Deepseek V3/V4, MiMo V2.5, GLM-5.1, etc.) should resolve to their actual maxOutput limits from the static model catalog, rather than falling back to a hardcoded 8192. When truncation occurs mid-tool-call, the workspace agent should detect it and warn the user.

Actual behavior

The catalog gap

resolveMariMaxOutputTokens (workspace-agent.service.ts:851) and resolveConnectionMaxOutputTokens (agent-resolution.ts:174) resolve max output tokens from a static model catalog (MODEL_LISTS in model-lists.ts). Several categories of models are missing or broken:

Provider Deepseek V4 Pro MiMo V2.5 GLM-5.2 Notes
NanoGPT 8,192 8,192 8,192 Empty catalog
Custom (direct API) 8,192 8,192 128,000 Deepseek not in custom; GLM-5.2 is in ZAI_MODELS
OpenRouter 8,192 8,192 8,192 Empty catalog
  • NanoGPT (model-lists.ts:970): nanogpt: [] — empty array. Every model accessed via NanoGPT gets 8192 regardless of actual capabilities.
  • OpenRouter (model-lists.ts:969): openrouter: OPENROUTER_MODELS where OPENROUTER_MODELS = [] — same problem.
  • Deepseek: No "deepseek" exists in the APIProvider type. A DEEPSEEK_MODELS array exists at model-lists.ts:501 but is defined but never imported or referenced anywhere — dead code. Deepseek users must use "Custom (OAI-Compatible)" or NanoGPT, where Deepseek models don't match any catalog entry.
  • Xiaomi MiMo: Not present in any provider's catalog. All MiMo models get the 8192 fallback.
  • GLM-5.1: Missing from ZAI_MODELS (lines 534-552). The catalog includes GLM-5 and GLM-5.2 but not 5.1.

The dynamically fetched model limits from /models endpoints (via readOpenAICompatibleModelLimits at connections.routes.ts:1505) are returned to the UI model picker but never persisted to the connection record — the api_connections DB schema (connections.ts) has no maxOutput column. Only maxTokensOverride (line 74) exists as a manual per-connection escape hatch.

The silent failure chain

When a model with an incorrect 8192 maxOutput is used for complex generation (e.g., writing multiple alt greetings via tool calls), the output gets truncated mid-stream. The workspace agent's truncation detection at line 1964 is conditional on action.commands.length === 0 — it only warns when the model produced no tool calls. When tool calls are present (the common case for complex tasks), the truncation check is bypassed entirely:

// workspace-agent.service.ts:1963-1969
if (action.commands.length === 0) {          // ← only when NO commands
  if (isLengthFinishReason(result.finishReason)) {
    // ... warning shown
  }
  break;
}
// ← if commands exist, truncation is never checked

The truncated JSON gets repaired (brackets closed), the tool calls execute with incomplete data, and the user sees success — but the content is silently missing.

Reproduction scenario

  1. Load a character card in the workspace assistant
  2. Request 10 alt greetings (~750 tokens each) using MiMo V2.5 Pro (NanoGPT, Crof) or Deepseek V4 Pro via API (quanted on Nano, very inconsistent or weird behavior)
  3. The model thinks, calls tools, generates output — appears to succeed
  4. The character card is saved but alt greetings are missing or incomplete
  5. The workspace agent shows no truncation warning because tool calls were present

This is a 50-50 scenario depending on variable token overhead (thinking tokens, tool call verbosity, JSON formatting). It's not a consistent failure — it's inconsistent because the 8192 budget is sometimes enough and sometimes not.

Steps to reproduce

  1. Configure a NanoGPT connection with MiMo V2.5 Pro or Deepseek V4 Pro
  2. Open the workspace assistant (Home screen)
  3. Ask Professor Mari to generate multiple long-form items via tool calls (e.g., 10 alt greetings of 750+ tokens each)
  4. Observe that the output is sometimes silently truncated with no warning
  5. Check the generated content — items may be missing or incomplete

Environment

  • Marinara Engine version: staging
  • Install type: source
  • OS + version: Windows 10
  • Browser or app shell: Desktop app, Firefox

Logs, screenshots, or video

(None available — the behavior is intermittent and depends on token overhead, likely less egregious on dense models; hardcoded caps requiring manual override make testing a catalog of popular MoEs somewhat inefficient)

Additional context

Prior art

This issue relates to several previously reported and fixed issues, but addresses a distinct root cause:

  • #1251 — Model lookup failure masked as fallback success. Supports the pattern of silent fallback when models aren't found in the catalog.
  • #1031 — OpenRouter model context metadata is discarded. Shows dynamic model metadata was being lost, related to the persistence gap.
  • #3110 — MiMo 2.5 Pro requires missing model parameter. A MiMo-specific routing fix, but doesn't address the catalog absence.
  • #3034 — Non-streaming Anthropic drops stop_reason, truncation reported as clean stop. Part of a family of issues where truncation detection was broken per-provider. Fixed, but the workspace agent's conditional check (commands present → skip detection) remains.
  • #2660 — Switching provider keeps previous model's max-tokens cap. Related to the maxTokensOverride being the only manual escape hatch.
  • #4021 — Gemini provider needs update (stale model list). Shows catalog freshness is a known recurring pattern.
  • #2995 — JSON repair trailing-comma regex not string-aware. Proves the repair pipeline has known edge cases, though this specific bug was fixed.
  • #108 — Add NanoGPT as a provider. The original provider addition — but the empty catalog was never populated.

Why this matters for MoE users specifically

MoE models (Deepseek V3/V4, MiMo V2.5, GLM-5.x, Kimi K series) are disproportionately affected because:

  1. They're popular for roleplay due to cost/accessibility (not everyone can use Claude)
  2. They tend to be worse at JSON generation, making them more susceptible to the truncation → repair → incomplete data chain
  3. Via NanoGPT and OpenRouter, they almost universally hit the 8192 fallback
  4. Complex workspace tasks (multi-item generation, character card creation) routinely exceed 8192 tokens when thinking overhead is included

Proposed resolution

Immediate fix (low risk): Add the major MoE model families to MODEL_LISTS with correct maxOutput specifications:

https://api-docs.deepseek.com/quick_start/pricing (TL;DR deepseek-v4-flash, deepseek-v4-pro, 1M context, 384k max output).
https://docs.z.ai/guides/overview/pricing - GLM 5.1 missing entirely from Z.ai provider, as well as nano-gpt
https://mimo.mi.com/models/en-US/mimo-v2.5-pro
Xiaomi official docs included just for official specs, they're censored on the official API. Crof (NanoGPT or direct) doesn't have the extra safety filters (and Reddit says some on OpenRouter also play along)
https://platform.kimi.ai/docs/pricing/chat-k26 Missing from Moonshot and NanoGPT
https://platform.kimi.ai/docs/pricing/chat-k3 Missing from Moonshot and NanoGPT

Wire the existing DEEPSEEK_MODELS dead code into the catalog, or add the models to the appropriate provider catalog.

Structural fix (medium risk): Persist the dynamically fetched maxOutput from /models endpoints into the connection record (new DB column or into defaultParameters JSON), and have the resolution functions check this persisted value before falling back to the static catalog.

Defensive fix (complementary): Extend the workspace agent's truncation detection to fire regardless of whether tool calls are present, so users are warned when output is cut short.

Alternatives considered

  • Rely on maxTokensOverride — requires every user to manually set this for every NanoGPT/OpenRouter connection. Hard to discover in context, not automatic.
  • Fetch limits at generation time — adds latency to every LLM call. Better to cache in the connection record or static catalog.
  • Remove the 8192 fallback entirely — dangerous. Unknown models could have tiny output limits. The fallback is correct as a safety net; the problem is it's too aggressive for well-known models.

  • I DID NOT read this template and provide the requested details.
Originally created by @xDanteMD on GitHub (Aug 8, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/4741 Originally assigned to: @SpicyMarinara on GitHub. ## Summary While investigating inconsistent Professor Mari workspace behavior (alt greetings reported as generated but missing from the character card), I traced the issue to the model catalog's `maxOutput` resolution chain. Several model families accessed via NanoGPT, OpenRouter, and the Custom (OAI-compatible) provider silently receive an **8192 maxOutput fallback** — far below their actual capabilities. This causes silent data loss when generating complex multi-item outputs, because the workspace agent's truncation detection is bypassed when tool calls are present. ## Expected behavior Models with known capabilities (Deepseek V3/V4, MiMo V2.5, GLM-5.1, etc.) should resolve to their actual `maxOutput` limits from the static model catalog, rather than falling back to a hardcoded 8192. When truncation occurs mid-tool-call, the workspace agent should detect it and warn the user. ## Actual behavior ### The catalog gap `resolveMariMaxOutputTokens` (workspace-agent.service.ts:851) and `resolveConnectionMaxOutputTokens` (agent-resolution.ts:174) resolve max output tokens from a static model catalog (`MODEL_LISTS` in model-lists.ts). Several categories of models are missing or broken: | Provider | Deepseek V4 Pro | MiMo V2.5 | GLM-5.2 | Notes | | ------------------- | --------------- | --------- | --------- | ------------------------------------------------ | | NanoGPT | **8,192** | **8,192** | **8,192** | Empty catalog | | Custom (direct API) | **8,192** | **8,192** | 128,000 | Deepseek not in custom; GLM-5.2 is in ZAI_MODELS | | OpenRouter | **8,192** | **8,192** | **8,192** | Empty catalog | - **NanoGPT** (`model-lists.ts:970`): `nanogpt: []` — empty array. Every model accessed via NanoGPT gets 8192 regardless of actual capabilities. - **OpenRouter** (`model-lists.ts:969`): `openrouter: OPENROUTER_MODELS` where `OPENROUTER_MODELS = []` — same problem. - **Deepseek**: No `"deepseek"` exists in the `APIProvider` type. A `DEEPSEEK_MODELS` array exists at `model-lists.ts:501` but is **defined but never imported or referenced anywhere** — dead code. Deepseek users must use "Custom (OAI-Compatible)" or NanoGPT, where Deepseek models don't match any catalog entry. - **Xiaomi MiMo**: Not present in any provider's catalog. All MiMo models get the 8192 fallback. - **GLM-5.1**: Missing from `ZAI_MODELS` (lines 534-552). The catalog includes GLM-5 and GLM-5.2 but not 5.1. The dynamically fetched model limits from `/models` endpoints (via `readOpenAICompatibleModelLimits` at connections.routes.ts:1505) are returned to the UI model picker but **never persisted to the connection record** — the `api_connections` DB schema (connections.ts) has no `maxOutput` column. Only `maxTokensOverride` (line 74) exists as a manual per-connection escape hatch. ### The silent failure chain When a model with an incorrect 8192 `maxOutput` is used for complex generation (e.g., writing multiple alt greetings via tool calls), the output gets truncated mid-stream. The workspace agent's truncation detection at line 1964 is **conditional on `action.commands.length === 0`** — it only warns when the model produced no tool calls. When tool calls are present (the common case for complex tasks), the truncation check is bypassed entirely: ```typescript // workspace-agent.service.ts:1963-1969 if (action.commands.length === 0) { // ← only when NO commands if (isLengthFinishReason(result.finishReason)) { // ... warning shown } break; } // ← if commands exist, truncation is never checked ``` The truncated JSON gets repaired (brackets closed), the tool calls execute with incomplete data, and the user sees success — but the content is silently missing. ### Reproduction scenario 1. Load a character card in the workspace assistant 2. Request 10 alt greetings (~750 tokens each) using MiMo V2.5 Pro (NanoGPT, Crof) or Deepseek V4 Pro via API (quanted on Nano, very inconsistent or weird behavior) 3. The model thinks, calls tools, generates output — appears to succeed 4. The character card is saved but alt greetings are missing or incomplete 5. The workspace agent shows no truncation warning because tool calls were present This is a 50-50 scenario depending on variable token overhead (thinking tokens, tool call verbosity, JSON formatting). It's not a consistent failure — it's inconsistent because the 8192 budget is *sometimes* enough and sometimes not. ## Steps to reproduce 1. Configure a NanoGPT connection with MiMo V2.5 Pro or Deepseek V4 Pro 2. Open the workspace assistant (Home screen) 3. Ask Professor Mari to generate multiple long-form items via tool calls (e.g., 10 alt greetings of 750+ tokens each) 4. Observe that the output is sometimes silently truncated with no warning 5. Check the generated content — items may be missing or incomplete ## Environment - Marinara Engine version: staging - Install type: source - OS + version: Windows 10 - Browser or app shell: Desktop app, Firefox ## Logs, screenshots, or video _(None available — the behavior is intermittent and depends on token overhead, likely less egregious on dense models; hardcoded caps requiring manual override make testing a catalog of popular MoEs somewhat inefficient)_ ## Additional context ### Prior art This issue relates to several previously reported and fixed issues, but addresses a distinct root cause: - **#1251** — Model lookup failure masked as fallback success. Supports the pattern of silent fallback when models aren't found in the catalog. - **#1031** — OpenRouter model context metadata is discarded. Shows dynamic model metadata was being lost, related to the persistence gap. - **#3110** — MiMo 2.5 Pro requires missing model parameter. A MiMo-specific routing fix, but doesn't address the catalog absence. - **#3034** — Non-streaming Anthropic drops stop_reason, truncation reported as clean stop. Part of a family of issues where truncation detection was broken per-provider. Fixed, but the workspace agent's conditional check (commands present → skip detection) remains. - **#2660** — Switching provider keeps previous model's max-tokens cap. Related to the maxTokensOverride being the only manual escape hatch. - **#4021** — Gemini provider needs update (stale model list). Shows catalog freshness is a known recurring pattern. - **#2995** — JSON repair trailing-comma regex not string-aware. Proves the repair pipeline has known edge cases, though this specific bug was fixed. - **#108** — Add NanoGPT as a provider. The original provider addition — but the empty catalog was never populated. ### Why this matters for MoE users specifically MoE models (Deepseek V3/V4, MiMo V2.5, GLM-5.x, Kimi K series) are disproportionately affected because: 1. They're popular for roleplay due to cost/accessibility (not everyone can use Claude) 2. They tend to be worse at JSON generation, making them more susceptible to the truncation → repair → incomplete data chain 3. Via NanoGPT and OpenRouter, they almost universally hit the 8192 fallback 4. Complex workspace tasks (multi-item generation, character card creation) routinely exceed 8192 tokens when thinking overhead is included ## Proposed resolution **Immediate fix (low risk):** Add the major MoE model families to `MODEL_LISTS` with correct `maxOutput` specifications: https://api-docs.deepseek.com/quick_start/pricing (TL;DR deepseek-v4-flash, deepseek-v4-pro, 1M context, 384k max output). https://docs.z.ai/guides/overview/pricing - GLM 5.1 missing entirely from Z.ai provider, as well as nano-gpt https://mimo.mi.com/models/en-US/mimo-v2.5-pro Xiaomi official docs included just for official specs, they're censored on the official API. Crof (NanoGPT or direct) doesn't have the extra safety filters (and Reddit says some on OpenRouter also play along) https://platform.kimi.ai/docs/pricing/chat-k26 Missing from Moonshot and NanoGPT https://platform.kimi.ai/docs/pricing/chat-k3 Missing from Moonshot and NanoGPT Wire the existing `DEEPSEEK_MODELS` dead code into the catalog, or add the models to the appropriate provider catalog. **Structural fix (medium risk):** Persist the dynamically fetched `maxOutput` from `/models` endpoints into the connection record (new DB column or into `defaultParameters` JSON), and have the resolution functions check this persisted value before falling back to the static catalog. **Defensive fix (complementary):** Extend the workspace agent's truncation detection to fire regardless of whether tool calls are present, so users are warned when output is cut short. ## Alternatives considered - **Rely on `maxTokensOverride`** — requires every user to manually set this for every NanoGPT/OpenRouter connection. Hard to discover in context, not automatic. - **Fetch limits at generation time** — adds latency to every LLM call. Better to cache in the connection record or static catalog. - **Remove the 8192 fallback entirely** — dangerous. Unknown models could have tiny output limits. The fallback is correct as a safety net; the problem is it's too aggressive for well-known models. --- - [ ] I DID NOT read this template and provide the requested details.
bsakaguchi 2026-10-21 05:51:11 +07:00
Author
Owner

@SpicyMarinara commented on GitHub (Aug 8, 2026):

Claimed by @SpicyMarinara for the current assigned-issue sweep. Implementation and validation are tracked in draft PR #4747.

<!-- gh-comment-id:5225217940 --> @SpicyMarinara commented on GitHub (Aug 8, 2026): Claimed by @SpicyMarinara for the current assigned-issue sweep. Implementation and validation are tracked in draft PR #4747.
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#2605
No description provided.