[GH-ISSUE #6331] [Issue]: Prompt preview omits capability package prompt-context, so it shows a prompt the model never receives #3534

Closed
opened 2026-10-21 06:04:03 +07:00 by bsakaguchi · 2 comments
Owner

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

Originally assigned to: @SpicyMarinara on GitHub.

Summary

Peek Prompt / prompt preview never includes text contributed by capability packages through prompt-context. It shows a prompt the model does not actually receive, so a package author checking their contribution sees it missing even when it is being sent, or sees it "present" by omission when it is in fact being dropped.

Expected behavior

The preview should include package prompt-context blocks exactly as a real generation appends them to the system message, so it shows what the model will receive.

Actual behavior

POST /api/prompts/:id/preview forwards to /api/generate/dryRun (routes/generate/prompt-preview.ts), which is served by routes/generate/dry-run-route.ts. That route is a separate assembler and never calls collectCapabilityPromptContext. Only the real path in routes/generate.routes.ts does: game at the mode: "game" call, and roleplay/conversation in the if (chatMode !== "game") block, both through injectCapabilityContexts, which appends the blocks to the system message.

So for any chat where a package contributes context, the preview and the real request differ.

Verified on staging at 7c82d9096: dry-run-route.ts has no reference to collectCapabilityPromptContext or injectCapabilityContexts.

Steps to reproduce

  1. Install a capability package that holds prompt-context and registers a contributor that returns a fixed marker string for a chat.
  2. Open that chat and use Peek Prompt / POST /api/prompts/:presetId/preview with the chatId. The marker is absent.
  3. Point the chat's connection at an OpenAI-compatible endpoint that logs request bodies and send a real message. The marker is present in the system message the model receives.

Environment

  • Marinara Engine version: staging 7c82d9096 (behaviour confirmed by source); observed live on a 2.4.5-based build
  • Install type: docker
  • OS + version: macOS (Darwin 25.3)
  • Browser or app shell: n/a (API)

Logs, screenshots, or video

Diffing the preview response against a captured real request for the same chat and turn: the preview system message has no package block; the real system message has the package block appended after the preset sections.

Additional context

  • Same class as #2762, where the dry-run path diverged from real generation for minP. The dry-run assembler drifting from generate.routes.ts looks like a recurring risk, not a one-off.
  • Related, and maybe worth a note in the capability docs: a contributor that exceeds its 2 s deadline is dropped with only a warn log (prompt-context contributor <id> exceeded 2000ms). With the preview also omitting contributions, a package author currently has no in-app way to tell whether their context reached the model. That combination hid a contributor that was silently timing out on almost every roleplay turn.
  • Suggested direction: have the dry-run path call the same injectCapabilityContexts (or collect the same packageBlocks) so the two assemblers cannot diverge on this.

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 @BiBoBaBe on GitHub (Sep 18, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/6331 Originally assigned to: @SpicyMarinara on GitHub. ## Summary Peek Prompt / prompt preview never includes text contributed by capability packages through `prompt-context`. It shows a prompt the model does not actually receive, so a package author checking their contribution sees it missing even when it is being sent, or sees it "present" by omission when it is in fact being dropped. ## Expected behavior The preview should include package `prompt-context` blocks exactly as a real generation appends them to the system message, so it shows what the model will receive. ## Actual behavior `POST /api/prompts/:id/preview` forwards to `/api/generate/dryRun` (`routes/generate/prompt-preview.ts`), which is served by `routes/generate/dry-run-route.ts`. That route is a separate assembler and never calls `collectCapabilityPromptContext`. Only the real path in `routes/generate.routes.ts` does: game at the `mode: "game"` call, and roleplay/conversation in the `if (chatMode !== "game")` block, both through `injectCapabilityContexts`, which appends the blocks to the system message. So for any chat where a package contributes context, the preview and the real request differ. Verified on `staging` at 7c82d9096: `dry-run-route.ts` has no reference to `collectCapabilityPromptContext` or `injectCapabilityContexts`. ## Steps to reproduce 1. Install a capability package that holds `prompt-context` and registers a contributor that returns a fixed marker string for a chat. 2. Open that chat and use Peek Prompt / `POST /api/prompts/:presetId/preview` with the `chatId`. The marker is absent. 3. Point the chat's connection at an OpenAI-compatible endpoint that logs request bodies and send a real message. The marker is present in the system message the model receives. ## Environment - Marinara Engine version: staging 7c82d9096 (behaviour confirmed by source); observed live on a 2.4.5-based build - Install type: docker - OS + version: macOS (Darwin 25.3) - Browser or app shell: n/a (API) ## Logs, screenshots, or video Diffing the preview response against a captured real request for the same chat and turn: the preview system message has no package block; the real system message has the package block appended after the preset sections. ## Additional context - Same class as #2762, where the dry-run path diverged from real generation for `minP`. The dry-run assembler drifting from `generate.routes.ts` looks like a recurring risk, not a one-off. - Related, and maybe worth a note in the capability docs: a contributor that exceeds its 2 s deadline is dropped with only a `warn` log (`prompt-context contributor <id> exceeded 2000ms`). With the preview also omitting contributions, a package author currently has no in-app way to tell whether their context reached the model. That combination hid a contributor that was silently timing out on almost every roleplay turn. - Suggested direction: have the dry-run path call the same `injectCapabilityContexts` (or collect the same `packageBlocks`) so the two assemblers cannot diverge on this. ## 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 06:04:03 +07:00
Author
Owner

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

@SpicyMarinara is handling this in the current issue sweep: #6335. Implementation and regression proof are in progress.

<!-- gh-comment-id:5734518007 --> @SpicyMarinara commented on GitHub (Sep 18, 2026): @SpicyMarinara is handling this in the current issue sweep: #6335. Implementation and regression proof are in progress.
Author
Owner

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

Resolved in #6335, merged into staging.

Peek Prompt and generation now share package prompt-context collection and placement, including preset Agent Sections and the existing chat/audience filtering for roleplay events.

Regression proof captures actual requests to a local provider in all three modes, checks package placement and deactivation, and verifies that preview leaves message history unchanged and excludes private events intended for other audiences or chats.

<!-- gh-comment-id:5735397230 --> @SpicyMarinara commented on GitHub (Sep 18, 2026): Resolved in #6335, merged into `staging`. Peek Prompt and generation now share package prompt-context collection and placement, including preset Agent Sections and the existing chat/audience filtering for roleplay events. Regression proof captures actual requests to a local provider in all three modes, checks package placement and deactivation, and verifies that preview leaves message history unchanged and excludes private events intended for other audiences or chats.
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#3534
No description provided.