mirror of
https://github.com/Pasta-Devs/Marinara-Agents.git
synced 2026-12-03 18:55:07 +07:00
[GH-ISSUE #812] The world-generation failure screen never tells you how big your selection was or how much the connection holds #419
Labels
No labels
agent: chess
agent: conversation-calls
agent: eightball
agent: haptic
agent: hierarchical-maps
agent: hierarchical-maps
agent: illustrator
agent: poker
agent: rock-paper-scissors
agent: tic-tac-toe
agent: uno
artifacts
bug
bugfix
build
catalog
ci
client
dependencies
docs
documentation
enhancement
feature
fixed-in-staging
in-pr
normal-scope
packages
pull-request
qol
regression
roadmap
scope-risk
server
soup
upstream
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Agents#419
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 (Sep 13, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Agents/issues/812
Originally assigned to: @SpicyMarinara, @kolacheee on GitHub.
When Pixelforge world generation is refused for being too large, the screen tells the player to pick fewer lorebook entries or a bigger connection, but never says how big their request actually was or how much the connection can hold - even though the engine measured both numbers and sent them. And on one particular refusal (too many entries ticked at once) the screen blames the player's setting description, which is not what overflowed.
How to reproduce (try it yourself)
Part 1 - the refusal with no numbers:
A quiet valley, three days walk from the sea.What you'll see: "The world didn't finish being written. The selected lore and world request exceed the model's context limit. Choose fewer lorebook entries or a connection with a larger context." No sizes. And it tells you to untick lorebook entries you never ticked.
What should happen: the screen should name the two sizes the engine already measured and sent, e.g. "Your request comes to about 1,600 tokens; this connection holds about 400. Untick lorebook entries or pick a connection with a larger context." Open devtools -> Network on the failed call and you can see both figures sitting unused in the response, as
estimatedInputTokensandinputBudget.Part 2 - the refusal that blames the wrong thing (same screen, rarer path):
What you'll see: "The world didn't finish being written. The request was turned down rather than delayed, so another attempt may well get the same answer; a shorter, plainer setting description is the likeliest thing to change it."
What should happen: a sentence naming the real cause - too many entries ticked for one request - and telling the player to untick some. Shortening the setting description cannot help; the list of ticked entry IDs is what overflowed, not the setting text. (The wall is the request body passing 64 KB. Measured at these commits: 2,448 ticked entries go through, 2,449 are rejected with a 413; with a maxed-out 8,000-character setting description it's 2,125 vs 2,126. Devtools shows
413and "The request body is larger than this endpoint accepts.")Where it is
At Agents
49a9c10c:packages/pixelforge/src/18-brief.js:955-957-onFailure?.("context_limit")is called with the kind and nothing else;response.body, which carries both numbers, is never read on that branch.packages/pixelforge/src/18-brief.js:1001-1014- status classification: 404, 409, 429 and 500-and-up becomeunavailable, everything else becomesrefused. A 413 is in neither list, so it lands onrefused.packages/pixelforge/src/60-save.js:1526, 1550-1551-gateReason(kind, stage)takes only the kind and stage; thecontext_limitarm returns a fixed sentence with nowhere to put a number. (It uses a typographic apostrophe in "model's" - grep for U+2019 or it looks like the string is missing.)packages/pixelforge/src/60-save.js:292-293- therefusedadvice line that blames the setting description.packages/pixelforge/src/60-save.js:2201-2203and:2315-2317- both call sites bindonFailure: (kind) => ..., one parameter, so no engine-side change alone could get a number to the screen.packages/server/src/routes/game.routes.ts:11050-11059sends the 422 withestimatedInputTokensandinputBudget; line 10775 sets the route's 64 KB body limit.What's happening
The engine does the right thing: it checks the request against the connection's context window before spending a provider call, refuses, and puts both sides of the comparison in the response. Pixelforge's network layer throws those numbers away one function too early - the failure kind travels on alone, and the function that writes the screen text has no parameter that could carry a size even if one arrived. A search of the whole Pixelforge package finds zero readers of either field.
The second half is the same layer failing differently: a 413 (request body too large) isn't in the list of statuses the classifier recognizes, so it falls into the generic
refusedbucket, whose advice was written for a provider turning the prompt down - hence the pointer at the setting description.The picker already shows the player a live estimate of their own selection ("N entries - about X tokens for the call"), so the interface has half the comparison and the refusal screen has neither half. Rendering
inputBudgetis the minimum that makes "choose fewer" a sized instruction instead of a guess.Suggested fix
Carry the failure detail alongside the failure kind, and let the screen text interpolate it:
onFailurein18-brief.jsto pass an optional detail object (estimatedInputTokens,inputBudget) with the kind, read offresponse.bodyon thecontext_limitbranch, and widen both(kind) =>binders in60-save.jsto keep it.gateReason'scontext_limitarm an interpolated variant used when the detail is present, falling back to today's fixed sentence when it isn't. An older engine sends no such fields, and a missing number must never print as a blank or "undefined".generate()with copy about the number of ticked entries, so the setting-description advice stops firing on it. (The alternative is an engine-side counted 422 for an over-long ID list; the package-side kind is cheaper and also protects players running an older engine, so it's worth doing either way.)Both arms should degrade to today's copy rather than to a sentence with a hole in it.
Context
This is the remainder of a mostly-delivered pair. Engine PR #5977 closed Engine issues #5952 and #5953 by landing context fitting and refusing before a paid call; PR #761 closed #760 by adding the picker's live estimate and a dedicated context-limit sentence, and in the same commit removed the 100-entry selection cap, which is what opened the 413 path above. What neither delivered is the actual magnitudes - the shape the requester asked for by hand on Engine #5952 ("your selection is about 40,000 tokens; this model holds 8,000") - or a story for 413. Nothing currently tracks either. The Pixelforge half is released and in players' hands (shipped in 0.16.3, both sentences present in the built
packages/pixelforge/client.js); the engine half is unreleased on staging, since #5977 landed after Engine v2.4.4. The engine-side companion (raising the route's body limit so the 413 never fires before the counted refusal) is filed separately on Marinara-Engine.Found by an AI-assisted sweep of the merged PRs against their original issues, then re-verified against Engine staging 52799569c on 2026-09-13. Please verify before fixing.
Related issue from the same sweep: Pasta-Devs/Marinara-Engine#6122 (the Engine-side body limit that produces the 413).
@SpicyMarinara commented on GitHub (Sep 13, 2026):
SpicyMarinara/Codex is handling this assigned issue in the release sweep, draft PR #836. We are checking the existing linked work before changing the owning package source, preserving the separate Slurp2 work in #816, and will close this issue only once its fix and validation are on staging.
@kolacheee commented on GitHub (Sep 13, 2026):
Addendum after Engine PR #6137 (staging ac14dd704). Two more places where this same screen loses the cause.
1. The content pack call has no
context_limitarm at all.18-brief.js:955-958learned the code.61-pack.js:2054-2113never did. Its ladder is: 409 wait out, truncated re-roll, thin, then 404/409/429/5xx tounavailable(:2102-2105), and everything else toonFailure?.("refused")(:2112). Line :2110 even logsresponse.body?.errorto the console before discarding it. So a context refusal on the second call prints the pack stage's generic line, "The request was turned down rather than delayed, so another attempt may well get the same answer.", and offers a retry that re-sends the identical body and fails identically.This got easier to hit, not harder, after #6137. The route now also refuses when the fitted output budget falls under 1,024 tokens (
game.routes.ts:11076and :11088-11103, closing Engine #6129), which raises the max context at which the pack call is refused by roughly 960 tokens. Measured against the real fit function and the real package payloads, with a sealed brief at the package's own caps (10 cast, 4 places):At max context 4096 with a setting description of about 5,000 characters the brief seals (estimated 2,281 tokens) and the pack is refused (estimated 2,643, leaving 889 of the 1,024 output tokens required). That is a plain 4K local connection, with no connection swapping needed. Before #6137 the same band sat at 2,909 to 3,287, which is why this looked unreachable earlier.
To reproduce in the app: Settings, Connections, set Max Context to 4096. New chat, open the Pixelforge Experience, leave "Generate a unique world with your GM connection (two calls)" ticked, and point the wizard's connection dropdown at that connection. Paste a Setting description of about 5,000 characters. Tick nothing in the lorebook picker. Start world generation. The world appears, then the pack failure screen shows the generic refusal, while devtools Network on
/experience-generationshows422 {code:"context_limit", availableOutputTokens:889, minimumOutputTokens:1024}.One warning for whoever fixes this: do not reuse the brief's sentence here.
gateReason("context_limit")at60-save.js:1550-1551says "Choose fewer lorebook entries", and the pack request body carries nolorebookEntryIdskey at all. The pack stage needs its own row besiderefusedandstorageat60-save.js:398-401, because the comment at :290 says those two are the only stage forked kinds, so the per stage override hook is the only way in.2. That same sentence blames lore on the no selection path.
The route has written two different
context_limitstrings since #5977 and forks them onlorebookSelectionRequested(game.routes.ts:10852, :11094-11099). With nothing ticked it sends "The world-generation instructions exceed this connection's context window. Choose a larger-context connection or shorten the instructions." The package reads only the code (18-brief.js:955-956) and prints the lore wording regardless, so a player who ticked zero entries is told to untick some.Surfacing the server's own
errorstring for this kind fixes both halves of this issue at once, the missing numbers and the wrong advice: widenonFailureto carry the response detail, and letgateReasoninterpolate it.Found by an AI-assisted sweep and re-verified against staging ac14dd704 on 2026-09-13. Please verify before fixing.