[GH-ISSUE #6151] A Game Master command with a bad argument reports an empty AI response instead of saying it was refused #3424

Closed
opened 2026-10-21 06:02:57 +07:00 by bsakaguchi · 1 comment
Owner

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

Originally assigned to: @SpicyMarinara on GitHub.

In Game Mode, when the AI's entire reply is one Game Master command and one of its arguments is not an allowed value, the turn disappears and a red error says the AI returned an empty response. The engine actually recognised the command and knows exactly why it refused it, but that reason only reaches the server log, so the player is told something that did not happen.

How to reproduce (try it yourself)

  1. Install the Pixelforge Experience package. It declares a weather command whose word argument must be one of fair, overcast, rain, storm, snow.
  2. Start a new chat, switch it to Game Mode, and select the Pixelforge experience.
  3. Point the chat at a custom OpenAI compatible connection whose endpoint returns the assistant message exactly [weather:{"word":"bogus"}] and nothing else. A real model produces this on its own when it reaches for an off list word like "sunny", since the engine advertises the command and its allowed values in the format reminder.
  4. Type I look at the sky and send.

What you'll see: a red toast reading The AI returned an empty response (finish reason "stop"). Try sending your message again. No new message appears in the chat, and the weather never changes. The only place the real reason exists is the server log: [capability/gm-verbs] Verb weather refused: argument "word" is not one of fair|overcast|rain|storm|snow.

What should happen: the player should be told that the weather command was refused and why, rather than being told the AI sent nothing back.

The same thing happens with [weather:{}] (a required argument missing) and with other commands, for example [standing:{"npc":"Mira","stance":"besties"}], so it is not specific to weather. It only happens when the refused command is the whole reply: if any prose sits alongside it, or a second command in the same reply does validate, the turn saves normally.

Where it is

At staging ac14dd704:

  • packages/server/src/services/capability-packages/capability-gm-verb-runtime.service.ts, parseAndStripGmVerbCalls, lines 292 to 297. A name match strips the tag from the narration; when validateGmVerbArgs fails, the code logs a warning and returns "". calls.push({ verb, args: validated.args }) on line 297 is only reached when validation succeeds.
  • packages/server/src/routes/generate.routes.ts:8149-8158, where hasActionableOutput counts collectedGmVerbCalls.length, which is zero for a refused command.
  • packages/server/src/routes/generate.routes.ts:8248, which sends the emptyResponseMessage error frame. The client turns it straight into a toast at packages/client/src/hooks/use-generate.ts:3082-3091.

What's happening

The parser removes a recognised command tag from the reply text whether or not its arguments pass validation, but it only records the command when validation passes. So a reply that is nothing but a refused command becomes empty text with zero recorded commands. The route then sees no text, no media and no commands, decides the model produced nothing useful, and sends the generic empty response error. The refusal reason is consumed by a server side warning that no player will ever read.

Suggested fix

Carry refusal reasons out of the parser instead of only logging them. Have the verb parser return the refusals next to the accepted calls, then count a refusal as real output so the turn stops falling into the empty response path, and surface the reason in plain language. The pattern used for dice in PR #6137 is the closest precedent: dice.service.ts now returns an unresolved list alongside its warning and generate.routes.ts feeds that list back into the follow up prompt so the reason reaches the player through narration. Game Master commands have no second model call to attach that to, so the choice here is a design call: show a plain notice naming the refused command and the allowed values, save the turn with that notice attached, or re-ask the model once with the refusal explained. Any of those is better than the current outcome, where an accurate diagnosis exists inside the process and a misleading one reaches the person.

Context

The empty response gate this sits behind arrived with PR #6007, which closed #5902 ("A model turn that is only a command tag is thrown away in Game Mode"). The silent strip on a refused command predates that and shipped with the capability verb runtime in #5922, so that half is in shipped builds; the exact shape described here needs #6007, which landed after v2.4.4 and is unreleased on staging. PR #6137 did not touch either site: the verb runtime file has no commits since the previous head, and the hasActionableOutput gate still blames to #6007. The closest relative is #6128, the dice version of the same shape, which #6137 fixed. The regression lane scripts/regressions/capability-gm-verb-runtime.regression.ts pins only "a parsed command only turn gets a hidden anchor" and "empty and unrecognized output still errors", so it passes with this defect live.

Found by an AI-assisted sweep and re-verified against staging ac14dd704 on 2026-09-13. Please verify before fixing.

Originally created by @kolacheee on GitHub (Sep 13, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/6151 Originally assigned to: @SpicyMarinara on GitHub. In Game Mode, when the AI's entire reply is one Game Master command and one of its arguments is not an allowed value, the turn disappears and a red error says the AI returned an empty response. The engine actually recognised the command and knows exactly why it refused it, but that reason only reaches the server log, so the player is told something that did not happen. ## How to reproduce (try it yourself) 1. Install the Pixelforge Experience package. It declares a `weather` command whose `word` argument must be one of fair, overcast, rain, storm, snow. 2. Start a new chat, switch it to Game Mode, and select the Pixelforge experience. 3. Point the chat at a custom OpenAI compatible connection whose endpoint returns the assistant message exactly `[weather:{"word":"bogus"}]` and nothing else. A real model produces this on its own when it reaches for an off list word like "sunny", since the engine advertises the command and its allowed values in the format reminder. 4. Type `I look at the sky` and send. **What you'll see:** a red toast reading `The AI returned an empty response (finish reason "stop"). Try sending your message again.` No new message appears in the chat, and the weather never changes. The only place the real reason exists is the server log: `[capability/gm-verbs] Verb weather refused: argument "word" is not one of fair|overcast|rain|storm|snow`. **What should happen:** the player should be told that the weather command was refused and why, rather than being told the AI sent nothing back. The same thing happens with `[weather:{}]` (a required argument missing) and with other commands, for example `[standing:{"npc":"Mira","stance":"besties"}]`, so it is not specific to weather. It only happens when the refused command is the whole reply: if any prose sits alongside it, or a second command in the same reply does validate, the turn saves normally. ## Where it is At staging ac14dd704: - `packages/server/src/services/capability-packages/capability-gm-verb-runtime.service.ts`, `parseAndStripGmVerbCalls`, lines 292 to 297. A name match strips the tag from the narration; when `validateGmVerbArgs` fails, the code logs a warning and returns `""`. `calls.push({ verb, args: validated.args })` on line 297 is only reached when validation succeeds. - `packages/server/src/routes/generate.routes.ts:8149-8158`, where `hasActionableOutput` counts `collectedGmVerbCalls.length`, which is zero for a refused command. - `packages/server/src/routes/generate.routes.ts:8248`, which sends the `emptyResponseMessage` error frame. The client turns it straight into a toast at `packages/client/src/hooks/use-generate.ts:3082-3091`. ## What's happening The parser removes a recognised command tag from the reply text whether or not its arguments pass validation, but it only records the command when validation passes. So a reply that is nothing but a refused command becomes empty text with zero recorded commands. The route then sees no text, no media and no commands, decides the model produced nothing useful, and sends the generic empty response error. The refusal reason is consumed by a server side warning that no player will ever read. ## Suggested fix Carry refusal reasons out of the parser instead of only logging them. Have the verb parser return the refusals next to the accepted calls, then count a refusal as real output so the turn stops falling into the empty response path, and surface the reason in plain language. The pattern used for dice in PR #6137 is the closest precedent: `dice.service.ts` now returns an `unresolved` list alongside its warning and `generate.routes.ts` feeds that list back into the follow up prompt so the reason reaches the player through narration. Game Master commands have no second model call to attach that to, so the choice here is a design call: show a plain notice naming the refused command and the allowed values, save the turn with that notice attached, or re-ask the model once with the refusal explained. Any of those is better than the current outcome, where an accurate diagnosis exists inside the process and a misleading one reaches the person. ## Context The empty response gate this sits behind arrived with PR #6007, which closed #5902 ("A model turn that is only a command tag is thrown away in Game Mode"). The silent strip on a refused command predates that and shipped with the capability verb runtime in #5922, so that half is in shipped builds; the exact shape described here needs #6007, which landed after v2.4.4 and is unreleased on staging. PR #6137 did not touch either site: the verb runtime file has no commits since the previous head, and the `hasActionableOutput` gate still blames to #6007. The closest relative is #6128, the dice version of the same shape, which #6137 fixed. The regression lane `scripts/regressions/capability-gm-verb-runtime.regression.ts` pins only "a parsed command only turn gets a hidden anchor" and "empty and unrecognized output still errors", so it passes with this defect live. Found by an AI-assisted sweep and re-verified against staging ac14dd704 on 2026-09-13. Please verify before fixing.
bsakaguchi 2026-10-21 06:02:57 +07:00
Author
Owner

@SpicyMarinara commented on GitHub (Sep 13, 2026):

Codex is addressing this report on behalf of @SpicyMarinara in draft PR #6168 as part of the requested issue sweep. I will verify the reported path against staging and preserve existing behavior outside the narrow fix.

<!-- gh-comment-id:5654636447 --> @SpicyMarinara commented on GitHub (Sep 13, 2026): Codex is addressing this report on behalf of @SpicyMarinara in draft PR #6168 as part of the requested issue sweep. I will verify the reported path against staging and preserve existing behavior outside the narrow fix.
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#3424
No description provided.