[GH-ISSUE #6152] A lorebook Outlet entry with a blank outlet name is left out of world generation but still counted as included #3423

Closed
opened 2026-10-21 06:02:57 +07:00 by bsakaguchi · 1 comment
Owner

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

Originally assigned to: @SpicyMarinara on GitHub.

If you set a lorebook entry's Position to "Outlet" but leave the outlet name box empty, and then tick that entry for world generation, its text never reaches the model. Nothing warns you: the Engine reports the entry as included, so the world picker stays silent and the finished brief quietly ignores one of the entries you chose.

How to reproduce (try it yourself)

  1. Start the Engine with debug logging on (set LOG_LEVEL=debug, see docs/CONFIGURATION.md under Logging Levels) so the outbound world prompt is printed to the server console.
  2. Open any lorebook in the lorebook editor. Create an entry named Ashfall with a distinctive body such as UNNAMEDMARK ashfall covers the roads. Expand its drawer, set Position to Outlet, and leave the Outlet name field that appears underneath completely blank. Save. Nothing blocks the save: the field has no required marker.
  3. In the same book create two ordinary entries with Position Before Character and distinctive bodies. Make sure all three entries are switched on.
  4. In Pixelforge, open the world generation picker, tick exactly those three entries, and generate the world.
  5. In the server console, find the block logged as [debug/game/experience-generation] system message:.

What you'll see: the prompt block contains the two ordinary entries and not the Outlet entry. The browser console shows no lore warning from Pixelforge, because the Engine answered includedEntries: 3 with skippedEntries: []. Nothing in the app, and nothing in the sealed brief's repair notes, records that a ticked entry never reached the model. As a control, give that same entry any outlet name (for example world) and regenerate: its text now appears in the prompt block, so the blank name is what causes the loss.

What should happen: either the editor should not let you save an Outlet entry without a name, or, if such an entry is ticked anyway, the reply should name it as skipped so the count and the prompt cannot disagree without a trace.

Where it is

At staging ac14dd704:

  • packages/server/src/services/lorebook/prompt-injector.ts:189 in processActivatedEntries: if (entry.position !== 7 || !entry.outletName) continue;, and line 204 totalEntries: budgeted.length.
  • packages/server/src/routes/game.routes.ts:10923 spreads ...Object.values(lorebookResult.outlets) into the world prompt, and :10929 sets lorebookIncludedEntries = lorebookResult.totalEntries.
  • packages/shared/src/schemas/lorebook.schema.ts:187: outletName: z.string().trim().max(200).default(""), with no cross-field check against position.
  • packages/client/src/components/lorebooks/LorebookEntryRow.tsx:1710-1729: the outlet name input, rendered when position is 7, with no required attribute and no save-time guard.

What's happening

An entry with position 7 and an empty name satisfies every activation gate and the budget, so it is counted in totalEntries, which the world route reports as includedEntries. It is then sorted into none of the buckets the world prompt is built from: the before, after and depth buckets all require a different position, and the outlet map requires a non-empty name. It falls out between the counting step and the assembly step, and because it was never refused it produces no skip record either. Pixelforge trusts the Engine's numbers rather than re-counting (packages/pixelforge/src/18-brief.js:870-880, if (included >= count && !skipped) return;), so three of three with no skips means total silence.

Suggested fix

Close it at the source: make a non-empty outlet name a requirement when Position is Outlet, both in the editor (block or flag the save, matching the docs that already tell users to enter an exact, case-sensitive name) and in the schema, with a refine that rejects position 7 with an empty outletName. Existing rows with the degenerate state would need a migration or a tolerant read path. Optionally, as a second commit, have the world route emit a skip record when a budgeted entry ends up in none of the buckets it concatenates, so that this class of disagreement between the count and the prompt can never be silent again.

Context

The drop itself predates PR #5977: the position 7 name check comes from the Outlets feature commit 6f91d90b4 (2026-07-27), and the count line is older still, so this behaviour is present in the shipped v2.4.4 build rather than being new on staging. PR #5977, which shipped issues #5952 and #5953, added the flattening of named outlets into the world prompt, which shrank the affected set from all outlets to blank-name outlets only, so this is a leftover rather than a regression from that PR; only that narrowing is unreleased. PR #6137 did not touch this area: its server change is confined to game.routes.ts body limits, entry state overrides and the output headroom error, and it does not edit prompt-injector.ts. Note that the reply protocol shipped with #5944 states that skippedEntries is not a census of refusals and that pre-budget refusals are visible only as absence from includedEntries, so the narrow and defensible claim here is only this: the entry is absent from the prompt while present in includedEntries, the one combination that protocol leaves no way to detect. The maintainer regression lane experience-lore-entries passes at this head and covers only the named outlet case, so this path is genuinely uncovered.

Found by an AI-assisted sweep and re-verified against staging ac14dd704 on 2026-09-13. Please verify before fixing.

Originally created by @kolacheee on GitHub (Sep 13, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/6152 Originally assigned to: @SpicyMarinara on GitHub. If you set a lorebook entry's Position to "Outlet" but leave the outlet name box empty, and then tick that entry for world generation, its text never reaches the model. Nothing warns you: the Engine reports the entry as included, so the world picker stays silent and the finished brief quietly ignores one of the entries you chose. ## How to reproduce (try it yourself) 1. Start the Engine with debug logging on (set `LOG_LEVEL=debug`, see `docs/CONFIGURATION.md` under Logging Levels) so the outbound world prompt is printed to the server console. 2. Open any lorebook in the lorebook editor. Create an entry named `Ashfall` with a distinctive body such as `UNNAMEDMARK ashfall covers the roads`. Expand its drawer, set Position to `Outlet`, and leave the `Outlet name` field that appears underneath completely blank. Save. Nothing blocks the save: the field has no required marker. 3. In the same book create two ordinary entries with Position `Before Character` and distinctive bodies. Make sure all three entries are switched on. 4. In Pixelforge, open the world generation picker, tick exactly those three entries, and generate the world. 5. In the server console, find the block logged as `[debug/game/experience-generation] system message:`. **What you'll see:** the prompt block contains the two ordinary entries and not the Outlet entry. The browser console shows no lore warning from Pixelforge, because the Engine answered `includedEntries: 3` with `skippedEntries: []`. Nothing in the app, and nothing in the sealed brief's repair notes, records that a ticked entry never reached the model. As a control, give that same entry any outlet name (for example `world`) and regenerate: its text now appears in the prompt block, so the blank name is what causes the loss. **What should happen:** either the editor should not let you save an Outlet entry without a name, or, if such an entry is ticked anyway, the reply should name it as skipped so the count and the prompt cannot disagree without a trace. ## Where it is At staging `ac14dd704`: - `packages/server/src/services/lorebook/prompt-injector.ts:189` in `processActivatedEntries`: `if (entry.position !== 7 || !entry.outletName) continue;`, and line 204 `totalEntries: budgeted.length`. - `packages/server/src/routes/game.routes.ts:10923` spreads `...Object.values(lorebookResult.outlets)` into the world prompt, and `:10929` sets `lorebookIncludedEntries = lorebookResult.totalEntries`. - `packages/shared/src/schemas/lorebook.schema.ts:187`: `outletName: z.string().trim().max(200).default("")`, with no cross-field check against `position`. - `packages/client/src/components/lorebooks/LorebookEntryRow.tsx:1710-1729`: the outlet name input, rendered when position is 7, with no `required` attribute and no save-time guard. ## What's happening An entry with position 7 and an empty name satisfies every activation gate and the budget, so it is counted in `totalEntries`, which the world route reports as `includedEntries`. It is then sorted into none of the buckets the world prompt is built from: the before, after and depth buckets all require a different position, and the outlet map requires a non-empty name. It falls out between the counting step and the assembly step, and because it was never refused it produces no skip record either. Pixelforge trusts the Engine's numbers rather than re-counting (`packages/pixelforge/src/18-brief.js:870-880`, `if (included >= count && !skipped) return;`), so three of three with no skips means total silence. ## Suggested fix Close it at the source: make a non-empty outlet name a requirement when Position is Outlet, both in the editor (block or flag the save, matching the docs that already tell users to enter an exact, case-sensitive name) and in the schema, with a refine that rejects position 7 with an empty `outletName`. Existing rows with the degenerate state would need a migration or a tolerant read path. Optionally, as a second commit, have the world route emit a skip record when a budgeted entry ends up in none of the buckets it concatenates, so that this class of disagreement between the count and the prompt can never be silent again. ## Context The drop itself predates PR #5977: the position 7 name check comes from the Outlets feature commit `6f91d90b4` (2026-07-27), and the count line is older still, so this behaviour is present in the shipped v2.4.4 build rather than being new on staging. PR #5977, which shipped issues #5952 and #5953, added the flattening of named outlets into the world prompt, which shrank the affected set from all outlets to blank-name outlets only, so this is a leftover rather than a regression from that PR; only that narrowing is unreleased. PR #6137 did not touch this area: its server change is confined to `game.routes.ts` body limits, entry state overrides and the output headroom error, and it does not edit `prompt-injector.ts`. Note that the reply protocol shipped with #5944 states that `skippedEntries` is not a census of refusals and that pre-budget refusals are visible only as absence from `includedEntries`, so the narrow and defensible claim here is only this: the entry is absent from the prompt while present in `includedEntries`, the one combination that protocol leaves no way to detect. The maintainer regression lane `experience-lore-entries` passes at this head and covers only the named outlet case, so this path is genuinely uncovered. Found by an AI-assisted sweep and re-verified against staging ac14dd704 on 2026-09-13. Please verify before fixing.
bsakaguchi 2026-10-21 06:02:57 +07:00
Author
Owner

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

Codex is addressing this report on behalf of @SpicyMarinara in draft PR #6168 as part of the requested issue sweep. I will verify the reported path against staging and preserve existing behavior outside the narrow fix.

<!-- gh-comment-id:5654636334 --> @SpicyMarinara commented on GitHub (Sep 13, 2026): Codex is addressing this report on behalf of @SpicyMarinara in draft PR #6168 as part of the requested issue sweep. I will verify the reported path against staging and preserve existing behavior outside the narrow fix.
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#3423
No description provided.