[GH-ISSUE #4879] [Issue]: Fallback-generated messages display the primary model name #2702

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

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

Originally assigned to: @SpicyMarinara on GitHub.

Summary

When the primary chat model fails or returns an empty completion and the configured main fallback produces the usable response, the saved message still displays the primary model name. The fallback works, but the message generation metadata attributes its output to the wrong model and provider.

Expected behavior

The saved assistant message or swipe should identify the model and provider that actually produced its usable response. A normal generation that does not use fallback should continue showing the primary model.

For multi-round tool generations, the displayed provenance should reflect the model that produced the final user-visible response rather than an earlier tool-only round.

Actual behavior

ConnectionFallbackProvider retries successfully with the configured fallback and emits a fallback_used notice containing the fallback connection and model. However, generate.routes.ts always persists conn.model and conn.provider from the primary connection in extra.generationInfo. The client then displays that stored primary model name.

For example, Sol returned an empty completion and Marinara retried successfully with Mythos Fable 5, but the completed message still showed Sol as its model.

Steps to reproduce

  1. Configure Sol as the primary Main generation connection and Mythos Fable 5 as the Main fallback.
  2. Generate a chat response where the primary provider returns an empty completion or otherwise fails before producing usable output.
  3. Confirm the server logs that Main generation retried with Mythos and that a usable response was saved.
  4. Enable model-name display for chat messages and inspect the generated response.
  5. Observe that the response is labeled with the primary Sol model rather than the Mythos fallback that produced it.

Environment

  • Marinara Engine version: 2.4.2 staging
  • Install type: source
  • OS + version: macOS; version not provided
  • Browser or app shell: not provided

Logs, screenshots, or video

WARN: [main-fallback] Primary generation failed before producing usable output; retrying with Mythos Fable 5 (claude-fable-5)
Error: Primary provider returned an empty completion

The resulting message nevertheless displays the primary Sol model.

Additional context

The relevant persistence path currently writes the primary connection unconditionally:

generationInfo: {
  model: conn.model,
  provider: conn.provider,
}

The fallback wrapper does not propagate the content-producing connection back through chat() or chatComplete(), despite already knowing and notifying about the fallback target. The fix should cover streaming, non-streaming/tool-call generation, regenerations, and swipes without changing existing fallback behavior or notifications. Add a regression proving that an empty primary followed by a successful fallback saves the fallback model/provider, while an ordinary successful primary remains attributed to the primary.

Template check

  • I DID NOT read this template and provide the requested details.
Originally created by @SpicyMarinara on GitHub (Aug 10, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/4879 Originally assigned to: @SpicyMarinara on GitHub. ## Summary When the primary chat model fails or returns an empty completion and the configured main fallback produces the usable response, the saved message still displays the primary model name. The fallback works, but the message generation metadata attributes its output to the wrong model and provider. ## Expected behavior The saved assistant message or swipe should identify the model and provider that actually produced its usable response. A normal generation that does not use fallback should continue showing the primary model. For multi-round tool generations, the displayed provenance should reflect the model that produced the final user-visible response rather than an earlier tool-only round. ## Actual behavior `ConnectionFallbackProvider` retries successfully with the configured fallback and emits a `fallback_used` notice containing the fallback connection and model. However, `generate.routes.ts` always persists `conn.model` and `conn.provider` from the primary connection in `extra.generationInfo`. The client then displays that stored primary model name. For example, Sol returned an empty completion and Marinara retried successfully with Mythos Fable 5, but the completed message still showed Sol as its model. ## Steps to reproduce 1. Configure Sol as the primary Main generation connection and Mythos Fable 5 as the Main fallback. 2. Generate a chat response where the primary provider returns an empty completion or otherwise fails before producing usable output. 3. Confirm the server logs that Main generation retried with Mythos and that a usable response was saved. 4. Enable model-name display for chat messages and inspect the generated response. 5. Observe that the response is labeled with the primary Sol model rather than the Mythos fallback that produced it. ## Environment - Marinara Engine version: 2.4.2 staging - Install type: source - OS + version: macOS; version not provided - Browser or app shell: not provided ## Logs, screenshots, or video ```text WARN: [main-fallback] Primary generation failed before producing usable output; retrying with Mythos Fable 5 (claude-fable-5) Error: Primary provider returned an empty completion ``` The resulting message nevertheless displays the primary Sol model. ## Additional context The relevant persistence path currently writes the primary connection unconditionally: ```ts generationInfo: { model: conn.model, provider: conn.provider, } ``` The fallback wrapper does not propagate the content-producing connection back through `chat()` or `chatComplete()`, despite already knowing and notifying about the fallback target. The fix should cover streaming, non-streaming/tool-call generation, regenerations, and swipes without changing existing fallback behavior or notifications. Add a regression proving that an empty primary followed by a successful fallback saves the fallback model/provider, while an ordinary successful primary remains attributed to the primary. ## Template check - [ ] I DID NOT read this template and provide the requested details.
bsakaguchi 2026-10-21 05:53:21 +07:00
Author
Owner

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

Taking this in the current SpicyMarinara assigned-issue sweep. No linked active PR or issue-numbered remote branch was found; implementation will be collected in a focused PR targeting staging.

<!-- gh-comment-id:5245297831 --> @SpicyMarinara commented on GitHub (Aug 10, 2026): Taking this in the current SpicyMarinara assigned-issue sweep. No linked active PR or issue-numbered remote branch was found; implementation will be collected in a focused PR targeting staging.
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#2702
No description provided.