[GH-ISSUE #4110] [Issue]: One invalid field silently resets all Noodle settings #2227

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

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

Summary

One invalid field in the stored Noodle settings silently discards every Noodle setting and reverts them to defaults. Users lose choices they never touched — Lorebook context, invited character folders, the generation connection — with no log line and no UI signal.

Expected behavior

If a single stored settings field fails validation, only that field should fall back to its default. Every other stored value should be preserved, and the server should log which field was rejected.

Actual behavior

normalizeNoodleSettings in packages/server/src/services/storage/noodle.storage.ts does this:

if (!parsed.success) return noodleSettingsSchema.parse(DEFAULT_NOODLE_SETTINGS);

Any single unparseable field throws away the whole object. The user-visible result is that Noodle settings appear to reset themselves, and the reset is completely silent — no warning, no error, nothing in the logs to diagnose it after the fact.

The most visible downstream symptom is Noodle timeline generation. enableLorebookContext defaults to false and invitedCharacterGroupIds defaults to [], so after a reset:

  • # Character Profiles in the refresh prompt falls back to "No character profiles." (noodle-public-prompt.service.ts:531)
  • the lorebook scan is scoped to zero character IDs, so # World / Lore is empty (noodle-public-prompt.service.ts:438)

The model then receives little more than the account name list and invents unrelated content. This was reported on Discord by a user whose Noodle posts abruptly stopped reflecting their character cards and Star Wars lorebooks, producing generic output about kings and copper coins instead.

The blast radius grows each time a narrow field is added to the settings schema. autoPostingDefaultIntensity: z.union([z.literal(1), z.literal(3), z.literal(6)]), added in 0ac4d396f, is exactly that shape: one out-of-range stored value resets everything else.

Steps to reproduce

  1. In Noodle Settings, enable World & Lore → Lorebook context and invite a character folder.
  2. Hand-edit the stored noodle.settings value so autoPostingDefaultIntensity is an invalid number, e.g. 4.
  3. Reload Noodle Settings.
  4. Observe that the Lorebook context toggle is off and the invited character folders are gone, not just the intensity. Nothing is logged.

Environment

  • Marinara Engine version: 2.3.5 (staging @ 3d5732ad0)
  • Install type: source
  • OS + version: Linux
  • Browser or app shell: n/a — reproduced server-side against normalizeNoodleSettings

Logs, screenshots, or video

No logs are produced — that is a core part of the problem. On the current staging code path the reset leaves no trace whatsoever.

Additional context

Possible originating report (investigated — see follow-up below)

This may be the cause of the following Discord report by AgentX — but that is a hypothesis, not a confirmed link. The user's stored settings still need to be inspected before anyone treats this as the fix for their case.

https://discord.com/channels/1417099416812392641/1495493775617687775/1530687702653997126

Hmm... My perfect Noodle is now gone. Not sure what happened. None of the lorebook entries are being passed to the LLM, so all of the posts and replies are just random stuff (like kings, copper coins, real work stuff, etc.) unlike yesterday and eariler this morning when it passed by Star Wars lorebooks and desc and was actually making sense. Looking at the recent requests sent to LLM, none of the char cards or lorebooks were sent, just the account names so the LLM didn't have any info to work from so it just invented stuff.

The described symptom — account names present, character cards and lorebook entries absent — matches what a settings reset to defaults produces (enableLorebookContext: false, invitedCharacterGroupIds: []). Other paths could produce the same output, so this stays labelled as a possible cause until confirmed.

Follow-up report — this hypothesis now looks unlikely

A later message from AgentX:

Okay, now. I have a bunch of rando Elaras in my LLM response. It's just using randos now. Still no lorebooks. I have rando turned off, so Elara isn't posting to my noodle feed, but I see their responses in LLM response. Got error saying couldn't update timeline because there's no responses (because they were all rando responses).

Interesting, it's creating rando's now with their own desc and lore, so I got Kaelen_Storm and Elara_Whisper

I'm not seeing any lore. My SW characters talking about medieval fantasy stuff. I refreshed a few times.

Two things follow from this, and they point away from the settings-reset bug:

  1. The "randos" are hallucinated, not real accounts. Kaelen_Storm / Elara_Whisper are authors the model invented because the prompt gave it nothing to work from. validateNoodleGeneratedRefresh rejects handles outside the known set (noodle-public-generation.service.ts:351-353), triggers one correction retry, and throws on a second failure (:411) — which is the "couldn't update timeline because there's no responses" error they saw.
  2. allowRandomUsers is off, and its default is already false. A reset to defaults could not have enabled random users, and the user confirms they are off. So the settings-wipe path does not explain this report.

With allowRandomUsers off, chooseNoodleParticipantAccounts only yields character-kind candidates (noodle-participant-selection.ts:73-76). Selection clearly succeeded — otherwise generation would have stopped with "Invite a character, select a character folder, or enable random users before refreshing" (noodle-public-generation.service.ts:236-239). So character accounts were selected, yet # Character Profiles was still empty.

That leaves a more likely root cause: characters.getById(account.entityId) returned null for every selected account (noodle-public-prompt.service.ts:330). Orphaned Noodle accounts — rows whose entityId no longer resolves to a character — would produce exactly this. The account name list still renders (it comes from noodle_accounts), the character cards vanish, and the lorebook scan is scoped to character IDs that do not exist, so no entries activate. Every symptom in both reports, from one cause.

Worth noting: nothing prunes noodle_accounts when a character is deleted — there is no delete/prune path in noodle.storage.ts — so orphaned accounts persist and keep getting picked as participants.

Next diagnostic step: for each invited Noodle account of kind character, check whether a characters row with that entityId still exists.

  • Fix in progress: #4109 (draft) — drops only the rejected fields, keeps the rest, and logs which fields were rejected.
  • Regression coverage added there to scripts/regressions/noodle-settings.regression.ts.
  • Note: this is the mechanism by which settings can silently reset. It has not been confirmed as the cause of the specific Discord report; that user's stored settings still need inspection.

Template check

  • I DID NOT read this template and provide the requested details.
Originally created by @Gunterlie on GitHub (Jul 25, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/4110 ## Summary One invalid field in the stored Noodle settings silently discards **every** Noodle setting and reverts them to defaults. Users lose choices they never touched — Lorebook context, invited character folders, the generation connection — with no log line and no UI signal. ## Expected behavior If a single stored settings field fails validation, only that field should fall back to its default. Every other stored value should be preserved, and the server should log which field was rejected. ## Actual behavior `normalizeNoodleSettings` in `packages/server/src/services/storage/noodle.storage.ts` does this: ```ts if (!parsed.success) return noodleSettingsSchema.parse(DEFAULT_NOODLE_SETTINGS); ``` Any single unparseable field throws away the whole object. The user-visible result is that Noodle settings appear to reset themselves, and the reset is completely silent — no warning, no error, nothing in the logs to diagnose it after the fact. The most visible downstream symptom is Noodle timeline generation. `enableLorebookContext` defaults to `false` and `invitedCharacterGroupIds` defaults to `[]`, so after a reset: - `# Character Profiles` in the refresh prompt falls back to "No character profiles." (`noodle-public-prompt.service.ts:531`) - the lorebook scan is scoped to zero character IDs, so `# World / Lore` is empty (`noodle-public-prompt.service.ts:438`) The model then receives little more than the account name list and invents unrelated content. This was reported on Discord by a user whose Noodle posts abruptly stopped reflecting their character cards and Star Wars lorebooks, producing generic output about kings and copper coins instead. The blast radius grows each time a narrow field is added to the settings schema. `autoPostingDefaultIntensity: z.union([z.literal(1), z.literal(3), z.literal(6)])`, added in 0ac4d396f, is exactly that shape: one out-of-range stored value resets everything else. ## Steps to reproduce 1. In Noodle Settings, enable **World & Lore → Lorebook context** and invite a character folder. 2. Hand-edit the stored `noodle.settings` value so `autoPostingDefaultIntensity` is an invalid number, e.g. `4`. 3. Reload Noodle Settings. 4. Observe that the Lorebook context toggle is off and the invited character folders are gone, not just the intensity. Nothing is logged. ## Environment - Marinara Engine version: 2.3.5 (`staging` @ 3d5732ad0) - Install type: source - OS + version: Linux - Browser or app shell: n/a — reproduced server-side against `normalizeNoodleSettings` ## Logs, screenshots, or video No logs are produced — that is a core part of the problem. On the current `staging` code path the reset leaves no trace whatsoever. ## Additional context ### Possible originating report (investigated — see follow-up below) This **may** be the cause of the following Discord report by AgentX — but that is a hypothesis, not a confirmed link. The user's stored settings still need to be inspected before anyone treats this as the fix for their case. https://discord.com/channels/1417099416812392641/1495493775617687775/1530687702653997126 > Hmm... My perfect Noodle is now gone. Not sure what happened. None of the lorebook entries are being passed to the LLM, so all of the posts and replies are just random stuff (like kings, copper coins, real work stuff, etc.) unlike yesterday and eariler this morning when it passed by Star Wars lorebooks and desc and was actually making sense. Looking at the recent requests sent to LLM, none of the char cards or lorebooks were sent, just the account names so the LLM didn't have any info to work from so it just invented stuff. The described symptom — account names present, character cards and lorebook entries absent — matches what a settings reset to defaults produces (`enableLorebookContext: false`, `invitedCharacterGroupIds: []`). Other paths could produce the same output, so this stays labelled as a possible cause until confirmed. #### Follow-up report — this hypothesis now looks unlikely A later message from AgentX: > Okay, now. I have a bunch of rando Elaras in my LLM response. It's just using randos now. Still no lorebooks. I have rando turned off, so Elara isn't posting to my noodle feed, but I see their responses in LLM response. Got error saying couldn't update timeline because there's no responses (because they were all rando responses). > > Interesting, it's creating rando's now with their own desc and lore, so I got Kaelen_Storm and Elara_Whisper > > I'm not seeing any lore. My SW characters talking about medieval fantasy stuff. I refreshed a few times. Two things follow from this, and they point away from the settings-reset bug: 1. **The "randos" are hallucinated, not real accounts.** `Kaelen_Storm` / `Elara_Whisper` are authors the model invented because the prompt gave it nothing to work from. `validateNoodleGeneratedRefresh` rejects handles outside the known set (`noodle-public-generation.service.ts:351-353`), triggers one correction retry, and throws on a second failure (`:411`) — which is the "couldn't update timeline because there's no responses" error they saw. 2. **`allowRandomUsers` is off, and its default is already `false`.** A reset to defaults could not have enabled random users, and the user confirms they are off. So the settings-wipe path does not explain this report. With `allowRandomUsers` off, `chooseNoodleParticipantAccounts` only yields **character-kind** candidates (`noodle-participant-selection.ts:73-76`). Selection clearly succeeded — otherwise generation would have stopped with "Invite a character, select a character folder, or enable random users before refreshing" (`noodle-public-generation.service.ts:236-239`). So character accounts *were* selected, yet `# Character Profiles` was still empty. That leaves a more likely root cause: **`characters.getById(account.entityId)` returned `null` for every selected account** (`noodle-public-prompt.service.ts:330`). Orphaned Noodle accounts — rows whose `entityId` no longer resolves to a character — would produce exactly this. The account name list still renders (it comes from `noodle_accounts`), the character cards vanish, and the lorebook scan is scoped to character IDs that do not exist, so no entries activate. Every symptom in both reports, from one cause. Worth noting: nothing prunes `noodle_accounts` when a character is deleted — there is no delete/prune path in `noodle.storage.ts` — so orphaned accounts persist and keep getting picked as participants. **Next diagnostic step:** for each invited Noodle account of kind `character`, check whether a `characters` row with that `entityId` still exists. - Fix in progress: #4109 (draft) — drops only the rejected fields, keeps the rest, and logs which fields were rejected. - Regression coverage added there to `scripts/regressions/noodle-settings.regression.ts`. - Note: this is the *mechanism* by which settings can silently reset. It has not been confirmed as the cause of the specific Discord report; that user's stored settings still need inspection. ## Template check - [ ] I DID NOT read this template and provide the requested details.
bsakaguchi 2026-10-21 05:46:26 +07:00
Author
Owner

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

Resolved by #4109 and merged into staging in 21635e06c9.

<!-- gh-comment-id:5081018025 --> @SpicyMarinara commented on GitHub (Jul 25, 2026): Resolved by #4109 and merged into `staging` in 21635e06c996c76e62e03eb87be609788cf7cd98.
Author
Owner

@Gunterlie commented on GitHub (Jul 26, 2026):

Root cause found, with the reporter's raw request logs. The prompt body was never sent to the model.

"messages": [
  { "role": "system", "content": "You write a fake social media timeline..." },
  { "role": "user",   "content": "# Content Uniqueness ... # JSON Output Format ..." }
],
"max_tokens": 32768

buildRefreshPrompt returns three messages (noodle-public-prompt.service.ts:621); two arrived. The context body — accounts, character profiles, world/lore, timeline — was deleted in transit. Both attached logs show the same shape across four requests.

Mechanism, in fitMessagesToContext:

  1. findOldestRemovableConversationBlock (base-provider.ts:332) protects only system messages and the final message. The first user message — the whole prompt body — is removed first.
  2. Noodle sets contextKind nowhere, so the fallback pass at :460 treats that body as expendable history.
  3. max_tokens is only reduced once the input budget hits the 128-token floor (:422), leaving a window where the budget is too small for the prompt but too large to trigger the reduction. So the prompt is deleted while max_tokens keeps its full value.

A stored max_tokens: 32768 against a ~36k window leaves ~3.3k input budget; a ~4k prompt gets deleted and max_tokens stays 32768 — matching the capture exactly, down to the 1210 prompt tokens the backend reported.

Fix in #4124. Not Noodle-specific: any single-shot prompt builder is exposed.

Correcting the record on the other two PRs. Neither is this bug:

  • #4111 (stale Noodle accounts) — real bug, reproduced, but not what happened here.
  • #4109 (settings wipe on one invalid field) — real bug, but allowRandomUsers defaults to false so it never explained the reported symptoms.

Both stand on their own merits; neither should be described as the fix for this report.

<!-- gh-comment-id:5082490209 --> @Gunterlie commented on GitHub (Jul 26, 2026): **Root cause found, with the reporter's raw request logs.** The prompt body was never sent to the model. ```json "messages": [ { "role": "system", "content": "You write a fake social media timeline..." }, { "role": "user", "content": "# Content Uniqueness ... # JSON Output Format ..." } ], "max_tokens": 32768 ``` `buildRefreshPrompt` returns three messages (`noodle-public-prompt.service.ts:621`); two arrived. The context body — accounts, character profiles, world/lore, timeline — was deleted in transit. Both attached logs show the same shape across four requests. Mechanism, in `fitMessagesToContext`: 1. `findOldestRemovableConversationBlock` (`base-provider.ts:332`) protects only system messages and the *final* message. The first user message — the whole prompt body — is removed first. 2. Noodle sets `contextKind` nowhere, so the fallback pass at `:460` treats that body as expendable history. 3. `max_tokens` is only reduced once the input budget hits the 128-token floor (`:422`), leaving a window where the budget is too small for the prompt but too large to trigger the reduction. So the prompt is deleted while `max_tokens` keeps its full value. A stored `max_tokens: 32768` against a ~36k window leaves ~3.3k input budget; a ~4k prompt gets deleted and `max_tokens` stays 32768 — matching the capture exactly, down to the 1210 prompt tokens the backend reported. Fix in #4124. Not Noodle-specific: any single-shot prompt builder is exposed. **Correcting the record on the other two PRs.** Neither is this bug: - #4111 (stale Noodle accounts) — real bug, reproduced, but not what happened here. - #4109 (settings wipe on one invalid field) — real bug, but `allowRandomUsers` defaults to false so it never explained the reported symptoms. Both stand on their own merits; neither should be described as the fix for this report.
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#2227
No description provided.