[GH-ISSUE #3547] [Issue]: **Bug — one malformed generated interaction fails the entire Noodle timeline refresh** #1916

Closed
opened 2026-10-21 05:43:46 +07:00 by bsakaguchi · 2 comments
Owner

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

Originally assigned to: @SpicyMarinara on GitHub.

Summary

Imported from the Discord thread "Bug — one malformed generated interaction fails the entire Noodle timeline refresh".

Expected behavior

Not provided in the Discord context.

Actual behavior

See the Discord context transcript below.

Steps to reproduce

  1. Not provided in the Discord context.

Environment

  • Marinara Engine version: Not provided
  • Install type: Not provided
  • OS + version: Not provided
  • Browser or app shell: Not provided

Logs, screenshots, or video

See any attachment links and screenshots in the context below.

Additional context

This issue was created automatically from Discord support context.

Discord thread: Bug — one malformed generated interaction fails the entire Noodle timeline refresh
Discord thread link: https://discord.com/channels/1417099416812392641/1526032138649075762
Requested by: Marinara (marinara_spaghetti, Discord ID 169561011928432653)

Discord thread transcript (2 messages)
[2026-07-13T01:06:54.160Z] ChrisDay: **Observed:** A timeline refresh throws and nothing posts. Server log:
` ` `
level 50 ZodError
path: interactions[0].parentInteractionId
"Only replies can target an existing comment."
msg: "[noodle] Timeline refresh failed"
` ` `
**Mechanism:** A refresh asks the generation model for a batch (posts, interactions, follows, digests). One interaction came back as a non-reply (comment/like/repost/vote) that still carried a `parentInteractionId`. The per-item rule at `packages/shared/src/schemas/noodle.schema.ts:284` correctly rejects that (`type !== "reply" && parentInteractionId !== undefined`).
The problem is *where* the batch is validated: `packages/server/src/routes/noodle.routes.ts:1688` runs one strict `noodleGeneratedRefreshSchema.parse()` over the whole batch — so that single bad item throws and takes the entire refresh with it. Every valid post/comment/follow in the batch is discarded, the run is marked `failed`, and the endpoint 500s. A scheduled refresh silently no-ops; a manual Refresh errors out.
**Expected:** A single malformed item from the LLM should be skipped, not sink the batch. The same file already does exactly that a few lines down — 1720 / 1819 / 1892 each skip a bad item with `logger.warn("Ignoring generated …")` and continue. The top-level parse just doesn't.
**Repro:** Non-deterministic in normal use (depends on the model emitting a bad item; more frequent on smaller/cheaper generation models). Deterministic for a maintainer: a generated batch containing one non-reply interaction with `parentInteractionId` set makes the refresh 500.
**Severity:** Low–Medium. No data loss; the cycle just produces nothing — but it recurs and always looks like "Noodle didn't update," with only the log to explain it.
Proposed fix in follow-up. 🍝
[Discord message: https://discord.com/channels/1417099416812392641/1526032138649075762/1526032138649075762]

[2026-07-13T01:07:16.347Z] ChrisDay: **Proposed fix — skip a bad generated item, don't fail the whole batch**
Make the refresh batch parse resilient per-item, mirroring the graceful skips the same file already uses (`noodle.routes.ts` 1720 / 1819 / 1892).
**Option A (smallest, matches existing pattern):** in the refresh handler, replace the strict `noodleGeneratedRefreshSchema.parse()` at `noodle.routes.ts:1688` with per-element validation — `.safeParse` each entry of posts/interactions/follows/digests, keep the passes, and `logger.warn` + drop the failures. One bad interaction can no longer sink the batch.
**Option B (schema-level, narrower):** have the generated schema coerce instead of reject this case — if a non-reply carries a `parentInteractionId`, strip the `parentInteractionId` (demote to a plain comment) rather than throw.
Option A is the more general fix and matches how the code already tolerates bad-account items. Goal either way: a single malformed LLM interaction is dropped and logged, never fatal to the refresh.
[Discord message: https://discord.com/channels/1417099416812392641/1526032138649075762/1526032231708102687]

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 @SpicyMarinara on GitHub (Jul 13, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/3547 Originally assigned to: @SpicyMarinara on GitHub. ## Summary Imported from the Discord thread "**Bug — one malformed generated interaction fails the entire Noodle timeline refresh**". ## Expected behavior Not provided in the Discord context. ## Actual behavior See the Discord context transcript below. ## Steps to reproduce 1. Not provided in the Discord context. ## Environment - Marinara Engine version: Not provided - Install type: Not provided - OS + version: Not provided - Browser or app shell: Not provided ## Logs, screenshots, or video See any attachment links and screenshots in the context below. ## Additional context This issue was created automatically from Discord support context. Discord thread: **Bug — one malformed generated interaction fails the entire Noodle timeline refresh** Discord thread link: https://discord.com/channels/1417099416812392641/1526032138649075762 Requested by: Marinara (marinara_spaghetti, Discord ID 169561011928432653) <details> <summary>Discord thread transcript (2 messages)</summary> ```text [2026-07-13T01:06:54.160Z] ChrisDay: **Observed:** A timeline refresh throws and nothing posts. Server log: ` ` ` level 50 ZodError path: interactions[0].parentInteractionId "Only replies can target an existing comment." msg: "[noodle] Timeline refresh failed" ` ` ` **Mechanism:** A refresh asks the generation model for a batch (posts, interactions, follows, digests). One interaction came back as a non-reply (comment/like/repost/vote) that still carried a `parentInteractionId`. The per-item rule at `packages/shared/src/schemas/noodle.schema.ts:284` correctly rejects that (`type !== "reply" && parentInteractionId !== undefined`). The problem is *where* the batch is validated: `packages/server/src/routes/noodle.routes.ts:1688` runs one strict `noodleGeneratedRefreshSchema.parse()` over the whole batch — so that single bad item throws and takes the entire refresh with it. Every valid post/comment/follow in the batch is discarded, the run is marked `failed`, and the endpoint 500s. A scheduled refresh silently no-ops; a manual Refresh errors out. **Expected:** A single malformed item from the LLM should be skipped, not sink the batch. The same file already does exactly that a few lines down — 1720 / 1819 / 1892 each skip a bad item with `logger.warn("Ignoring generated …")` and continue. The top-level parse just doesn't. **Repro:** Non-deterministic in normal use (depends on the model emitting a bad item; more frequent on smaller/cheaper generation models). Deterministic for a maintainer: a generated batch containing one non-reply interaction with `parentInteractionId` set makes the refresh 500. **Severity:** Low–Medium. No data loss; the cycle just produces nothing — but it recurs and always looks like "Noodle didn't update," with only the log to explain it. Proposed fix in follow-up. 🍝 [Discord message: https://discord.com/channels/1417099416812392641/1526032138649075762/1526032138649075762] [2026-07-13T01:07:16.347Z] ChrisDay: **Proposed fix — skip a bad generated item, don't fail the whole batch** Make the refresh batch parse resilient per-item, mirroring the graceful skips the same file already uses (`noodle.routes.ts` 1720 / 1819 / 1892). **Option A (smallest, matches existing pattern):** in the refresh handler, replace the strict `noodleGeneratedRefreshSchema.parse()` at `noodle.routes.ts:1688` with per-element validation — `.safeParse` each entry of posts/interactions/follows/digests, keep the passes, and `logger.warn` + drop the failures. One bad interaction can no longer sink the batch. **Option B (schema-level, narrower):** have the generated schema coerce instead of reject this case — if a non-reply carries a `parentInteractionId`, strip the `parentInteractionId` (demote to a plain comment) rather than throw. Option A is the more general fix and matches how the code already tolerates bad-account items. Goal either way: a single malformed LLM interaction is dropped and logged, never fatal to the refresh. [Discord message: https://discord.com/channels/1417099416812392641/1526032138649075762/1526032231708102687] ``` </details> ## 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:43:46 +07:00
  • closed this issue
  • added the
    in-pr
    bug
    labels
Author
Owner

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

I’m addressing this in draft PR #3556 and will close the issue after the fix and regression coverage are verified.

<!-- gh-comment-id:4957235593 --> @SpicyMarinara commented on GitHub (Jul 13, 2026): I’m addressing this in draft PR #3556 and will close the issue after the fix and regression coverage are verified.
Author
Owner

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

Addressed in #3556. Generated Noodle posts, interactions, follows, and digests are now validated independently, so one malformed row is skipped instead of rejecting the whole refresh. Fully malformed output receives one constrained retry.

<!-- gh-comment-id:4957459712 --> @SpicyMarinara commented on GitHub (Jul 13, 2026): Addressed in #3556. Generated Noodle posts, interactions, follows, and digests are now validated independently, so one malformed row is skipped instead of rejecting the whole refresh. Fully malformed output receives one constrained retry.
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#1916
No description provided.