[GH-ISSUE #3655] [Issue]: [Noodle/Logging] Refresh flow logs the outgoing prompt but never the raw model response; failed first attempts are discarded entirely #1977

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

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

Originally assigned to: @SpicyMarinara on GitHub.

Here's another issue report from the professor. Skipped Discord this time because this would only paste as an attachment for some godforsaken reason.

Environment

  • macOS 26, Node.js v24.17.0
  • Marinara Engine (local install, source)
  • Connection: Fable (Claude Pro) / anthropic / claude-fable-5
  • Debug mode enabled for Noodle refreshes

Summary

When a Noodle timeline refresh runs with debug logging on, the console shows the full outgoing prompt but never the raw model response. Users debugging bad refreshes can see exactly what was sent but have no visibility into what came back, which makes diagnosing malformed/low-quality timeline generations needlessly painful.

This is a plain logging asymmetry in packages/server/src/routes/noodle.routes.ts:

  • Line ~1836: the outgoing prompt is logged via logDebugOverride(debugMode, "[debug/noodle] Prompt sent to model:...").
  • After provider.chatComplete() returns, the raw content goes straight into JSON parsing and validation with no corresponding [debug/noodle] raw response log line.

For comparison, other generation paths in the codebase (e.g. game routes, agent executor) do log raw responses in debug mode, so Noodle is the odd one out.

Expected behavior

With debug mode on, each Noodle refresh should log both the outgoing prompt and the raw model response (for the initial attempt and any retry attempts), so a bad generation can be inspected directly from the console.

Actual behavior

  1. Only the prompt is logged. The raw response is never printed, in any mode.
  2. The final response is persisted — finishRefreshRun(runId, { status: "completed", result: content }) (line ~2181) saves it to noodle_refresh_runs.result — but that's the only place it exists, and only for the attempt that ultimately succeeded.
  3. Failed first attempts are lost entirely. When a response fails validation, the flow retries with a correction message and only the corrected response is saved. The original bad response is never logged and never stored. The only trace is logger.warn("[noodle] Retrying timeline generation because %s", retryReason) with the reason truncated to ~180 characters.
  4. Consequence observed on this machine: all stored noodle_refresh_runs rows have status: "completed", so the DB contains zero evidence of what the "bad" generations actually looked like — the exact thing a user is trying to debug.

Steps to reproduce

  1. Enable Noodle and debug mode; trigger a timeline refresh.
  2. Watch the server console: [debug/noodle] Prompt sent to model: appears; no response log ever does.
  3. Force a validation failure (e.g. a model that returns malformed JSON). Observe only the truncated [noodle] Retrying timeline generation because ... warning; the offending raw response is unrecoverable afterwards.
  4. Check mari db list noodle_refresh_runs — only final successful result payloads exist.

Suggested fix (feature request)

  1. Add logDebugOverride(debugMode, "[debug/noodle] Raw model response:", content) (or equivalent) immediately after each chatComplete() call in the refresh flow — both the initial attempt and the retry path. Two-line change gated behind the existing debugMode flag.
  2. Optionally, persist failed attempts too: store the rejected raw response and full (untruncated) retryReason on the run row (e.g. failedAttempts JSON column or a first_result/retry_reason pair) so bad generations can be audited after the fact instead of vanishing.

Workaround

Raw responses for successful refreshes can be recovered from storage:

mari db select noodle_refresh_runs --fields id,status,createdAt
mari db get noodle_refresh_runs <id>   # result column holds the raw model output

There is no workaround for inspecting responses that failed validation and triggered a retry — they are discarded before any logging or persistence.

Additional context

  • Related files: packages/server/src/routes/noodle.routes.ts (refresh flow, prompt logging ~line 1836, run completion ~line 2181), packages/server/src/services/noodle/ (services themselves log almost nothing).
  • The noodle_refresh_runs table already has prompt, result, and error columns, so persisting failed attempts is a natural extension of the existing schema.
Originally created by @stochasticbrainrot on GitHub (Jul 15, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/3655 Originally assigned to: @SpicyMarinara on GitHub. Here's another issue report from the professor. Skipped Discord this time because this would only paste as an attachment for some godforsaken reason. ### Environment - macOS 26, Node.js v24.17.0 - Marinara Engine (local install, source) - Connection: Fable (Claude Pro) / anthropic / claude-fable-5 - Debug mode enabled for Noodle refreshes ### Summary When a Noodle timeline refresh runs with debug logging on, the console shows the full outgoing prompt but **never the raw model response**. Users debugging bad refreshes can see exactly what was sent but have no visibility into what came back, which makes diagnosing malformed/low-quality timeline generations needlessly painful. This is a plain logging asymmetry in `packages/server/src/routes/noodle.routes.ts`: - Line ~1836: the outgoing prompt is logged via `logDebugOverride(debugMode, "[debug/noodle] Prompt sent to model:...")`. - After `provider.chatComplete()` returns, the raw `content` goes **straight into JSON parsing and validation** with no corresponding `[debug/noodle] raw response` log line. For comparison, other generation paths in the codebase (e.g. game routes, agent executor) *do* log raw responses in debug mode, so Noodle is the odd one out. ### Expected behavior With debug mode on, each Noodle refresh should log both the outgoing prompt **and** the raw model response (for the initial attempt and any retry attempts), so a bad generation can be inspected directly from the console. ### Actual behavior 1. Only the prompt is logged. The raw response is never printed, in any mode. 2. The final response *is* persisted — `finishRefreshRun(runId, { status: "completed", result: content })` (line ~2181) saves it to `noodle_refresh_runs.result` — but that's the only place it exists, and only for the attempt that ultimately succeeded. 3. **Failed first attempts are lost entirely.** When a response fails validation, the flow retries with a correction message and only the corrected response is saved. The original bad response is never logged and never stored. The only trace is `logger.warn("[noodle] Retrying timeline generation because %s", retryReason)` with the reason truncated to ~180 characters. 4. Consequence observed on this machine: all stored `noodle_refresh_runs` rows have `status: "completed"`, so the DB contains zero evidence of what the "bad" generations actually looked like — the exact thing a user is trying to debug. ### Steps to reproduce 1. Enable Noodle and debug mode; trigger a timeline refresh. 2. Watch the server console: `[debug/noodle] Prompt sent to model:` appears; no response log ever does. 3. Force a validation failure (e.g. a model that returns malformed JSON). Observe only the truncated `[noodle] Retrying timeline generation because ...` warning; the offending raw response is unrecoverable afterwards. 4. Check `mari db list noodle_refresh_runs` — only final successful `result` payloads exist. ### Suggested fix (feature request) 1. Add `logDebugOverride(debugMode, "[debug/noodle] Raw model response:", content)` (or equivalent) immediately after each `chatComplete()` call in the refresh flow — both the initial attempt and the retry path. Two-line change gated behind the existing `debugMode` flag. 2. Optionally, persist failed attempts too: store the rejected raw response and full (untruncated) `retryReason` on the run row (e.g. `failedAttempts` JSON column or a `first_result`/`retry_reason` pair) so bad generations can be audited after the fact instead of vanishing. ### Workaround Raw responses for *successful* refreshes can be recovered from storage: ```bash mari db select noodle_refresh_runs --fields id,status,createdAt mari db get noodle_refresh_runs <id> # result column holds the raw model output ``` There is no workaround for inspecting responses that failed validation and triggered a retry — they are discarded before any logging or persistence. ### Additional context - Related files: `packages/server/src/routes/noodle.routes.ts` (refresh flow, prompt logging ~line 1836, run completion ~line 2181), `packages/server/src/services/noodle/` (services themselves log almost nothing). - The `noodle_refresh_runs` table already has `prompt`, `result`, and `error` columns, so persisting failed attempts is a natural extension of the existing schema.
bsakaguchi 2026-10-21 05:44:19 +07:00
Author
Owner

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

@SpicyMarinara is handling this in draft PR #3656 against staging.

<!-- gh-comment-id:4984604136 --> @SpicyMarinara commented on GitHub (Jul 15, 2026): @SpicyMarinara is handling this in draft PR #3656 against 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#1977
No description provided.