mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #7180] [MERGED] fix(game): honour the configured text-generation timeout in GM mode #7612
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#7612
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?
📋 Pull Request Information
Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/7180
Author: @SpicyMarinara
Created: 10/6/2026
Status: ✅ Merged
Merged: 10/6/2026
Merged by: @SpicyMarinara
Base:
staging← Head:fix/gm-generation-timeout-7177📝 Commits (3)
7ef8c25fix(game): honour the configured text-generation timeout in GM mode1bdc014fix(game): keep fixed total caps and give a setup retry the full wait34b9b6cMerge remote-tracking branch 'origin/staging' into fix/gm-generation-timeout-7177📊 Changes
5 files changed (+136 additions, -30 deletions)
View changed files
📝
CHANGELOG.md(+1 -0)📝
packages/server/src/routes/game.routes.ts(+40 -23)📝
packages/server/src/services/game/initial-game-setup.ts(+0 -2)➕
scripts/regressions/game-generation-timeout.regression.ts(+94 -0)📝
scripts/regressions/open-issues.regression.ts(+1 -5)📄 Description
Linked issue
Closes #7177
Why this change
With Qwen3.8-27B on llama.cpp, a new Game Mode game failed with
GameGenerationTimeoutErrorat exactly 300 seconds. Setting Request timeouts → Text generation orCHAT_GENERATION_TIMEOUT_MSto 3600 s or 20 s made no difference. With gemma-4-31B and a 20 s setting, setup ran past 300 s and succeeded. An earlier report was marked as fixed in staging, but neither earlier fix touched the Game routes.Root cause:
game.routes.tsruns every Game Master call throughrunGameChatComplete/runGameChatStream. Both use a watchdog that defaulted to a hard-codedGAME_GENERATION_TIMEOUT_MS = 5 * 60 * 1000, and only answer tokens (onToken) reset it.reasoning_content. The OpenAI-compatible provider passes that toonThinking, notonToken, so the watchdog never resets while the model thinks. It fires at exactly 300 s whatever the setting says.docs/CONFIGURATION.mddescribes.The undici lead, checked and ruled out: 300 s is also undici's default
headersTimeout/bodyTimeout. ButllmFetchalways passes both asCHAT_GENERATION_TIMEOUT_MS(base-provider.ts,llmAgentOptions), so undici's defaults never apply. The existingllm-first-chunk-timeoutregression already proves undici follows the setting. Fastify and Node server timeouts only cover receiving the request, and the client's/game/setupcall has no timeout.Why earlier fixes missed it: #6359 added the Request timeouts settings, and #6971 (#6970) made undici's chunk wait follow the setting. Neither changed the Game watchdog. #3684 raised the setup route's response tracker to 500 s, but the 300 s watchdog inside it always fired first, so that change never took effect.
What changed
packages/server/src/routes/game.routes.tsgetChatGenerationTimeoutMs()when each call starts, instead of using a fixed 5 minutes.onToken), streamed thinking (onThinking) resets the watchdog, as answer tokens already did. This matches the chat routes, where any streamed chunk counts. Calls withoutonTokenkeep a total cap, so thinking from providers that always stream (ChatGPT and Claude subscriptions) cannot stretch it.runGameChatCompleteandrunGameChatStreamare exported for the regression.packages/server/src/services/game/initial-game-setup.ts: removed the unused 500 sGAME_SETUP_GENERATION_TIMEOUT_MS. Its pinning assertion inopen-issues.regression.tsis removed too.scripts/regressions/game-generation-timeout.regression.ts: a fake OpenAI-compatible server with fixed routes and fixed delays drives the realcustomprovider throughrunGameChatComplete, the way new-game setup does. Four calls run side by side, so it finishes in about 14 s:Game setup timed out after 10 secondsin under 12 s. Shorter is enforced.reasoning_contentbefore the answer: succeeds. Thinking counts as progress.onToken(like the image-prompt calls) on the same thinking stream: fails at about 10 s. Thinking does not stretch a total cap.Other generation paths (task item 4):
/api/generate. They already wrap provider calls inwithLlmRequestTimeout(getChatGenerationTimeoutMs()), so they have no 300 s cap.AGENT_CALL_TIMEOUT_MS.services/conversation/auto-summary.service.ts:DEFAULT_SUMMARY_TIMEOUT_MS, for Conversation day/week summaries.services/conversation/autonomous.service.ts:GENERATION_TIMEOUT_MS, a stale-lock reset, not a request timeout.Known ceiling: routes that never streamed (recap, character sheet, recruit, map, party turn, scene wrap, Experience generation) keep one response timer per request. That timer is now the configured value, not 300 s. For a single non-streamed request this is the same as a wait limit. If Experience generation or scene wrap falls back to a second, streamed attempt after an empty reply, both attempts share that one timer, as they shared the 300 s before.
Validation
pnpm checkpasses locallyCONTRIBUTING.mdManual verification notes
What the agent ran (not a substitute for the checklist):
pnpm check: exit 0.pnpm exec prettier --checkon the changed files: clean.Game setup timed out after 5 secondsat 5.0 s. With the fix it completes at 8 s.game.routes.ts(includingopen-issues,experience-generationandgame-generation-parameters), plusllm-first-chunk-timeoutandrequest-timeouts.stagingmerge base): 0 findings on the first commit. The rerun after the review-fix commit was rate limited (32-minute wait), so that commit relies on the GitHub CodeRabbit review.game.routes.tsregressions,request-timeoutsandllm-first-chunk-timeoutpass again, andpnpm checkexits 0.To check by hand:
reasoning_content) and Text generation set to 3600 s: starting a new Game Mode game gets past 300 s of thinking and finishes setup.Docs and release impact
docs-i18nbranch updated to match, or a[docs-i18n]follow-up issue opened (see CONTRIBUTING.md § Translated documentation)docs/CONFIGURATION.mdalready saysCHAT_GENERATION_TIMEOUT_MScovers Game generations. This PR makes that true, so no docs change or translation follow-up is needed. Only CHANGELOG is updated.UI evidence (if applicable)
Not applicable: server-only change.
Summary by CodeRabbit
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.