[GH-ISSUE #2762] [Issue]: Dry-run (prompt preview/test) path never forwards minP — preview diverges from real generation #1401

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

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

Originally assigned to: @kolacheee on GitHub.

Summary

The dry-run path (prompt preview / test generation) never resolves or forwards minP to the provider, so a preview can diverge from the real send. minP was wired through the main generation path in #2668 / PR #2670, but the parallel dry-run route was missed — it has no minP local, never reads it in its applyParameterOverrides or preset block, and omits it from both provider.chatComplete(...) calls.

Expected behavior

A minP set in a preset, or in Chat/Connection Advanced Parameters, should be applied in the dry-run preview exactly as it is on a real generation, so the preview faithfully mirrors what would be sent. This is the entire purpose of the dry-run/test tool.

Actual behavior

In packages/server/src/routes/generate/dry-run-route.ts, minP is dropped: there is no minP local alongside the other sampler defaults, applyParameterOverrides does not read params.minP, the preset block does not read assembled.parameters.minP, and neither chatComplete call passes a minP key. Because the OpenAI-compatible provider only emits body.min_p when options.minP > 0, the preview's options.minP is always undefined, so min_p is silently absent from the preview request even when the user configured a non-zero value. Every other sampler (temperature/topP/topK/penalties) is forwarded — only minP is missing.

How it breaks the pipeline

Code trace (staging @ e626a3ac):

  • Real path packages/server/src/routes/generate.routes.ts correctly: declares let minP = 0; (:1684), reads it in the preset block minP = assembled.parameters.minP ?? 0; (:2076) and in applyParameterOverrides if (typeof params.minP === "number") minP = params.minP; (:3470), and passes minP: minP || undefined into every provider.chatComplete(...) (:6087, :6244, :6301).
  • Dry-run path packages/server/src/routes/generate/dry-run-route.ts: no minP local among the sampler defaults (:517–522); applyParameterOverrides (:533–553) never reads params.minP; the preset block (:1215–1226) sets topP/topK/penalties but not minP; and both provider.chatComplete(...) calls (:1570, :1632) omit minP.
  • Provider consumes it: packages/server/src/services/llm/base-provider.ts:93 (minP?: number on the options type) and packages/server/src/services/llm/providers/openai.provider.ts:885–892 / :1130–1137 (set body.min_p = options.minP only when options.minP > 0); local-sidecar.provider.ts:60 uses options.minP.

Same orphaned-parameter class as #2668, but scoped to the dry-run/preview route that the #2668 fix (#2670) did not touch.

Steps to reproduce

  1. Set minP = 0.1 in a preset (or Chat Settings → Advanced Parameters) on a connection whose backend accepts min_p (the bundled local sidecar model, or an OpenAI-compatible / KoboldCpp backend where shouldSendTopK() is true).
  2. Run the prompt preview / dry-run / test for that chat and inspect the outgoing request body.
  3. Observe: no min_p key is present in the preview, while a real generation of the same chat does include min_p: 0.1. The preview diverges from the real send.

Suggested fix

Mirror the real route in dry-run-route.ts: (1) add let minP = 0; with the other sampler defaults; (2) read it in applyParameterOverrides (if (typeof params.minP === "number") minP = params.minP;); (3) read it in the preset block (minP = assembled.parameters.minP ?? 0;); (4) pass minP: minP || undefined into both provider.chatComplete(...) calls. The existing Claude no-sampling / temperature-only stripping blocks already match the real route (neither strips minP), so no change is needed there to preserve parity. Validate with pnpm check.

Environment

  • Marinara Engine version: 2.0.0 (staging @ e626a3ac)
  • Install type: source
  • OS + version: All (code-level defect, platform-independent)
  • Browser or app shell: All

Additional context

Follow-up gap from #2668 / PR #2670, which wired minP through the main generation path and providers but did not update the separate dry-run preview route. Confirmed at the code level: provider forwards min_p only when options.minP > 0, and the dry-run route never set options.minP.

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 @kolacheee on GitHub (Jun 21, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2762 Originally assigned to: @kolacheee on GitHub. ## Summary The dry-run path (prompt **preview / test** generation) never resolves or forwards `minP` to the provider, so a preview can diverge from the real send. `minP` was wired through the main generation path in #2668 / PR #2670, but the parallel dry-run route was missed — it has no `minP` local, never reads it in its `applyParameterOverrides` or preset block, and omits it from both `provider.chatComplete(...)` calls. ## Expected behavior A `minP` set in a preset, or in Chat/Connection Advanced Parameters, should be applied in the dry-run preview exactly as it is on a real generation, so the preview faithfully mirrors what would be sent. This is the entire purpose of the dry-run/test tool. ## Actual behavior In `packages/server/src/routes/generate/dry-run-route.ts`, `minP` is dropped: there is no `minP` local alongside the other sampler defaults, `applyParameterOverrides` does not read `params.minP`, the preset block does not read `assembled.parameters.minP`, and neither `chatComplete` call passes a `minP` key. Because the OpenAI-compatible provider only emits `body.min_p` when `options.minP > 0`, the preview's `options.minP` is always `undefined`, so `min_p` is silently absent from the preview request even when the user configured a non-zero value. Every other sampler (temperature/topP/topK/penalties) is forwarded — only `minP` is missing. ## How it breaks the pipeline Code trace (staging @ `e626a3ac`): - Real path `packages/server/src/routes/generate.routes.ts` correctly: declares `let minP = 0;` (~`:1684`), reads it in the preset block `minP = assembled.parameters.minP ?? 0;` (~`:2076`) and in `applyParameterOverrides` `if (typeof params.minP === "number") minP = params.minP;` (~`:3470`), and passes `minP: minP || undefined` into every `provider.chatComplete(...)` (~`:6087`, `:6244`, `:6301`). - Dry-run path `packages/server/src/routes/generate/dry-run-route.ts`: **no** `minP` local among the sampler defaults (~`:517–522`); `applyParameterOverrides` (~`:533–553`) never reads `params.minP`; the preset block (~`:1215–1226`) sets `topP`/`topK`/penalties but not `minP`; and both `provider.chatComplete(...)` calls (~`:1570`, `:1632`) omit `minP`. - Provider consumes it: `packages/server/src/services/llm/base-provider.ts:93` (`minP?: number` on the options type) and `packages/server/src/services/llm/providers/openai.provider.ts:885–892` / `:1130–1137` (set `body.min_p = options.minP` only when `options.minP > 0`); `local-sidecar.provider.ts:60` uses `options.minP`. Same orphaned-parameter class as #2668, but scoped to the dry-run/preview route that the #2668 fix (#2670) did not touch. ## Steps to reproduce 1. Set `minP` = `0.1` in a preset (or Chat Settings → Advanced Parameters) on a connection whose backend accepts `min_p` (the bundled local sidecar model, or an OpenAI-compatible / KoboldCpp backend where `shouldSendTopK()` is true). 2. Run the prompt **preview / dry-run / test** for that chat and inspect the outgoing request body. 3. Observe: no `min_p` key is present in the preview, while a real generation of the same chat *does* include `min_p: 0.1`. The preview diverges from the real send. ## Suggested fix Mirror the real route in `dry-run-route.ts`: (1) add `let minP = 0;` with the other sampler defaults; (2) read it in `applyParameterOverrides` (`if (typeof params.minP === "number") minP = params.minP;`); (3) read it in the preset block (`minP = assembled.parameters.minP ?? 0;`); (4) pass `minP: minP || undefined` into both `provider.chatComplete(...)` calls. The existing Claude no-sampling / temperature-only stripping blocks already match the real route (neither strips `minP`), so no change is needed there to preserve parity. Validate with `pnpm check`. ## Environment - Marinara Engine version: 2.0.0 (staging @ `e626a3ac`) - Install type: source - OS + version: All (code-level defect, platform-independent) - Browser or app shell: All ## Additional context Follow-up gap from #2668 / PR #2670, which wired `minP` through the main generation path and providers but did not update the separate dry-run preview route. Confirmed at the code level: provider forwards `min_p` only when `options.minP > 0`, and the dry-run route never set `options.minP`. ## 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:33:13 +07:00
Author
Owner

@kolacheee commented on GitHub (Jun 21, 2026):

Owning this — starting implementation now (@kolacheee). Opening a draft PR against staging to track the fix.

<!-- gh-comment-id:4763183888 --> @kolacheee commented on GitHub (Jun 21, 2026): Owning this — starting implementation now (@kolacheee). Opening a draft PR against `staging` to track the fix.
Author
Owner

@kolacheee commented on GitHub (Jun 21, 2026):

Draft PR opened against staging: #2763. (Note: because the PR targets staging rather than the default branch, GitHub won't auto-close this issue on merge — please close it manually when #2763 lands.)

<!-- gh-comment-id:4763187513 --> @kolacheee commented on GitHub (Jun 21, 2026): Draft PR opened against `staging`: #2763. (Note: because the PR targets `staging` rather than the default branch, GitHub won't auto-close this issue on merge — please close it manually when #2763 lands.)
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#1401
No description provided.