[PR #8710] [MERGED] fix(generate): game tool results stay before a user-turn prefill; repair staging node regressions #8760

Closed
opened 2026-11-07 17:39:29 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/8710
Author: @Gunterlie
Created: 11/3/2026
Status: ✅ Merged
Merged: 11/3/2026
Merged by: @Gunterlie

Base: staging ← Head: fix/staging-node-regressions


📝 Commits (5)

  • f2e756f fix(generate): keep game tool results before a user-turn prefill; sync two stale regressions
  • 3ccac22 fix(generate): keep attachments on one message when splitting the prefill
  • 1b9cd1e fix(generate): do not split the prefill out of a Single User Message
  • a5bdaa9 fix(generate): keep a reasoning-carrying user prefill last in game tool rounds
  • b86e3b9 fix(generate): split the prefill out of a Single User Message with its label

📊 Changes

6 files changed (+46 additions, -25 deletions)

View changed files

📝 packages/server/src/routes/generate.routes.ts (+12 -12)
📝 packages/server/src/routes/generate/generate-route-utils.ts (+7 -3)
📝 packages/server/src/routes/generate/tool-rounds.ts (+20 -4)
📝 scripts/regressions/assistant-prefill-ends-prompt.regression.ts (+1 -0)
📝 scripts/regressions/game-tool-controls.regression.ts (+5 -5)
📝 scripts/regressions/open-issues.regression.ts (+1 -1)

📄 Description

Why

Staging's required node-regressions (shards 1/3 and 3/3) and complete-node-regressions are red since the merges of 2026-11-02 21:57Z. They block every PR (e.g. #8708). No linked issue: CI repair requested by the maintainer.

Root causes

  1. open-issues.regression.ts (shard 3/3): stale assertion. #8704 (debug prompts keep real line breaks) changed the turn-game bot runner to log debugJson(moveMessages). The test still matched JSON.stringify(moveMessages, null, 2). The new behaviour is intended, so the assertion is updated.
  2. game-tool-controls.regression.ts (shard 1/3): real product bug from #8703. #8703 sends an Assistant Prefill as a user turn when there is no reply to open. endPromptOnAssistantPrefill then reports endsOnPrefill: false, and the prefill is merged into the last user message. The game tool-planning pass (tool-rounds.ts) only inserts its tool-results note before the tail when the tail is an assistant prefill. So the note was appended after the prefill and the prompt no longer ended on the prefill (against #8703's intent).

What changed

  • generate-route-utils.ts: endPromptOnAssistantPrefill also returns userPrefill (the prefill text) in the user-turn case. endsOnPrefill keeps its meaning for all other callers.
  • generate.routes.ts: passes userPrefill into the tool-rounds context.
  • tool-rounds.ts: when the last user message ends with userPrefill, split the prefill back out, insert the tool results before it, and keep the prefill last. Attachments stay on one message.
  • Regressions: open-issues regex follows debugJson; game-tool-controls expects the prefill role user; assistant-prefill-ends-prompt expects the new userPrefill field. The ordering expectation (results before the prefill) is unchanged.

Validation

  • pnpm check passes. game-tool-controls, open-issues, assistant-prefill-ends-prompt, generate-tool-rounds, game-tool-outcomes, provider-compat regressions pass locally.
  • Full regression:node locally: 1648/1650 passed. The 2 failures (native-export-memory, multiplayer-peer-server-security) are local-environment issues (missing runner DATA_DIR, local TLS hostname), not part of the failing CI shards.
  • CodeRabbit: 1 finding (attachments copied to both split messages), fixed. Not covered by a new test.

Manual verification (unchecked)

  • Manually verify: a game turn with tools enabled and an Assistant Prefill. The debug prompt ends on the prefill text.
  • Manually verify: a game turn with tools enabled, an Assistant Prefill and Single User Message. The prompt is still sensible.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/8710 **Author:** [@Gunterlie](https://github.com/Gunterlie) **Created:** 11/3/2026 **Status:** ✅ Merged **Merged:** 11/3/2026 **Merged by:** [@Gunterlie](https://github.com/Gunterlie) **Base:** `staging` ← **Head:** `fix/staging-node-regressions` --- ### 📝 Commits (5) - [`f2e756f`](https://github.com/Pasta-Devs/Marinara-Engine/commit/f2e756fa3443fdec64884626b92a6439ea81c284) fix(generate): keep game tool results before a user-turn prefill; sync two stale regressions - [`3ccac22`](https://github.com/Pasta-Devs/Marinara-Engine/commit/3ccac22dc3c54d64c394f52bc6113243a99a889e) fix(generate): keep attachments on one message when splitting the prefill - [`1b9cd1e`](https://github.com/Pasta-Devs/Marinara-Engine/commit/1b9cd1e20bf56e7bb3a609277194e0a9dc0ea70c) fix(generate): do not split the prefill out of a Single User Message - [`a5bdaa9`](https://github.com/Pasta-Devs/Marinara-Engine/commit/a5bdaa92e9034596012b3144547486e0e6df6e13) fix(generate): keep a reasoning-carrying user prefill last in game tool rounds - [`b86e3b9`](https://github.com/Pasta-Devs/Marinara-Engine/commit/b86e3b944a112dfa1c246b86710011c158a829b3) fix(generate): split the prefill out of a Single User Message with its label ### 📊 Changes **6 files changed** (+46 additions, -25 deletions) <details> <summary>View changed files</summary> 📝 `packages/server/src/routes/generate.routes.ts` (+12 -12) 📝 `packages/server/src/routes/generate/generate-route-utils.ts` (+7 -3) 📝 `packages/server/src/routes/generate/tool-rounds.ts` (+20 -4) 📝 `scripts/regressions/assistant-prefill-ends-prompt.regression.ts` (+1 -0) 📝 `scripts/regressions/game-tool-controls.regression.ts` (+5 -5) 📝 `scripts/regressions/open-issues.regression.ts` (+1 -1) </details> ### 📄 Description ## Why Staging's required `node-regressions` (shards 1/3 and 3/3) and `complete-node-regressions` are red since the merges of 2026-11-02 21:57Z. They block every PR (e.g. #8708). No linked issue: CI repair requested by the maintainer. ## Root causes 1. **`open-issues.regression.ts` (shard 3/3): stale assertion.** #8704 (debug prompts keep real line breaks) changed the turn-game bot runner to log `debugJson(moveMessages)`. The test still matched `JSON.stringify(moveMessages, null, 2)`. The new behaviour is intended, so the assertion is updated. 2. **`game-tool-controls.regression.ts` (shard 1/3): real product bug from #8703.** #8703 sends an Assistant Prefill as a user turn when there is no reply to open. `endPromptOnAssistantPrefill` then reports `endsOnPrefill: false`, and the prefill is merged into the last user message. The game tool-planning pass (`tool-rounds.ts`) only inserts its tool-results note before the tail when the tail is an assistant prefill. So the note was appended after the prefill and the prompt no longer ended on the prefill (against #8703's intent). ## What changed - `generate-route-utils.ts`: `endPromptOnAssistantPrefill` also returns `userPrefill` (the prefill text) in the user-turn case. `endsOnPrefill` keeps its meaning for all other callers. - `generate.routes.ts`: passes `userPrefill` into the tool-rounds context. - `tool-rounds.ts`: when the last user message ends with `userPrefill`, split the prefill back out, insert the tool results before it, and keep the prefill last. Attachments stay on one message. - Regressions: `open-issues` regex follows `debugJson`; `game-tool-controls` expects the prefill role `user`; `assistant-prefill-ends-prompt` expects the new `userPrefill` field. The ordering expectation (results before the prefill) is unchanged. ## Validation - `pnpm check` passes. `game-tool-controls`, `open-issues`, `assistant-prefill-ends-prompt`, `generate-tool-rounds`, `game-tool-outcomes`, `provider-compat` regressions pass locally. - Full `regression:node` locally: 1648/1650 passed. The 2 failures (`native-export-memory`, `multiplayer-peer-server-security`) are local-environment issues (missing runner `DATA_DIR`, local TLS hostname), not part of the failing CI shards. - CodeRabbit: 1 finding (attachments copied to both split messages), fixed. Not covered by a new test. ## Manual verification (unchecked) - [ ] Manually verify: a game turn with tools enabled and an Assistant Prefill. The debug prompt ends on the prefill text. - [ ] Manually verify: a game turn with tools enabled, an Assistant Prefill and Single User Message. The prompt is still sensible. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 17:39:29 +07:00
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#8760
No description provided.