mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #3030] [Issue]: Dry-run preview diverges from real generation for stored topP=0 (0 is silently rewritten to 1) #1599
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#1599
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @kolacheee on GitHub (Jun 29, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/3030
Originally assigned to: @SpicyMarinara on GitHub.
What's wrong
There are two copies of
normalizeChatTopP. The canonical one (used by the real/generatepath) preserves a stored topP of 0 as 0. The duplicate copy in the dry-run route rewrites any value<= 0to 1. Both read the same stored connection/chat parameters, so a user-stored topP of 0 (schema-valid, min 0) resolves to 0 in real generation but to 1 in the Dry Run preview — the preview does not match what the model actually receives.How to reproduce (try it yourself)
POST /api/generate.POST /api/generate/dryRun.You'll see: the real call sends topP=0 (canonical
Math.min(0,1)=0), but the dry-run preview reports/sends topP=1 (if (value <= 0) return 1).Expected: the dry-run preview resolves topP identically to the real path, preserving 0.
Where it is
packages/server/src/routes/generate/dry-run-route.ts:464-468(divergent local copy; resolved at call site line 609, applied at 1344-1345) vs canonicalpackages/server/src/services/generation/generation-parameters.ts:28-32(real call sitegenerate.routes.ts:3709, applied at 3746-3747). Schema:packages/shared/src/schemas/prompt.schema.ts:39(topP z.number().min(0).max(1)).What's happening
dry-run-route.tsdefines its ownnormalizeChatTopPthat maps any value<= 0to 1, while the shared version treats 0 as legitimate (Math.min(0,1)=0). The two drifted, so the preview path no longer mirrors the real path for the boundary value topP=0.Suggested fix
In
packages/server/src/routes/generate/dry-run-route.ts, delete the localnormalizeChatTopP(lines 464-468) and import the canonical one: addnormalizeChatTopPto a named import from../../services/generation/generation-parameters.js(same directory already imported formodel-access-policy.js). The call site at line 609 is unchanged and now invokes the shared function. The only behavioral change is at topP=0 (the bug); negative values are unreachable here because stored params are validated throughgenerationParametersSchema(min 0), and all other inputs already resolve identically.AI-investigated against v2.0.6; cited lines read and confirmed. Please verify before fixing.
@SpicyMarinara commented on GitHub (Jun 29, 2026):
Fixed on staging in PR #3031 (merged as
f542e282). Closing manually because GitHub auto-close keywords only close issues when merged into the default branch (main), not staging.