[PR #8784] [MERGED] fix(multiplayer): whispered own rolls, Retry at the generation limit, IPv6 request buckets #8802

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

📋 Pull Request Information

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

Base: staging ← Head: fix/multiplayer-rolls-retry-limits


📝 Commits (2)

  • a244a5c fix(multiplayer): whispered own rolls, Retry at the generation limit, IPv6 request buckets
  • 89b1509 fix(client): keep the Retry limit message after the host raises the limit

📊 Changes

8 files changed (+94 additions, -7 deletions)

View changed files

📝 packages/client/src/features/multiplayer/MultiplayerHostControls.tsx (+11 -2)
📝 packages/client/src/localization/locales/en.json (+1 -0)
📝 packages/server/src/services/multiplayer/game-projection.ts (+6 -1)
📝 packages/server/src/services/multiplayer/peer-server.ts (+2 -1)
📝 packages/server/src/services/multiplayer/room-store.ts (+7 -1)
📝 scripts/regressions/multiplayer-game-projection.regression.ts (+21 -0)
📝 scripts/regressions/multiplayer-peer-server-security.regression.ts (+36 -2)
📝 scripts/regressions/multiplayer-room.regression.ts (+10 -0)

📄 Description

Important

Contributions target staging. Only SpicyMarinara may promote this repository's staging branch or a same-repository hotfix/* branch to main.

Linked issue

Closes #8783

Why this change

A release-prep audit found three multiplayer defects, and two verifiers confirmed each one. (1) A player never saw the result of a check the Game Master whispered to them. ownRolls read an audience key that nothing writes, and the transcript strips the check tag. (2) When a failed round had used the room's last allowed generation, Retry reported success but left the room active and stuck. The failure banner and Retry button disappeared, and guests' actions were refused. (3) The room listener limited requests per full IPv6 address but sockets per /64. One IPv6 host could multiply its per-address request budget across the addresses in its /64 and use up the shared pre-auth budget that admitted guests also need. No linked issue exists; one should be opened before the PR is submitted.

What changed

  • Retry now refuses with an error when the room is at its AI generation limit. Before, it seemed to work and left the room stuck. IPv6 guests on the same /64 (for example, everyone on one home LAN) now share one request budget, as they already shared the socket limit. Nothing else that worked before stops working.
  • Room Game: a skill check the Game Master whispers to a player now shows in that player's own check results. It stays out of other players' results and the public rolls. Older replies with no saved audience stay private.
  • Room Game: at the generation limit, Retry keeps the round paused with everyone's actions and tells the host to raise Maximum AI generations in Chat Settings, then try again. The message stays the same after the host raises the limit, so it never points them to Resume, which would drop the kept actions.
  • Room listener: request rate limits now group IPv6 addresses by /64, as the socket limit already did, so one IPv6 host can't multiply its per-address request budget across its /64.

Validation

  • pnpm check passes locally
  • Container (Docker / Podman) built and ran without issue
  • Ran the app, clicked through the changes manually
  • Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)
  • Above manual verification completed (describe below)
  • Read and followed CONTRIBUTING.md

Manual verification notes

  • Manually verify in a two-Engine Room Game that when the GM whispers a skill check to the guest ([whisper:] ... [skill_check ...]), the result shows in the guest's own check results and not in the host's.
  • Manually verify that when a round fails on the room's last allowed generation (for example, set Maximum AI generations to the used count and force a provider error), pressing 'Try the round again' keeps the failure banner and shows the 'used all its allowed AI generations' message.
  • Manually verify that after that refusal, raising Maximum AI generations in Chat Settings with the banner still on screen leaves the 'used all its allowed AI generations' message showing. It must not switch to 'the Game Master already wrote part of it'.
  • Manually verify that pressing Retry again after raising the limit runs the same round with everyone's actions kept.
  • Manually verify that an IPv6 guest still joins and polls normally on the room listener, and that two or three IPv6 guests on one LAN can play an active round without being rate-limited.

Agent-run checks (for reference; each regression was shown to fail without its fix):

  • node ./scripts/pnpm-runner.mjs build:shared: exit 0
  • node ./scripts/run-regressions.mjs --filter multiplayer- (after the banner fix): 16/16 passed, including multiplayer-game-projection, multiplayer-room and multiplayer-peer-server-security (18.4 s)
  • git stash push -- the 3 server source files; run the 3 touched regressions; git stash pop (first round): All 3 FAILED on the new assertions, and passed with the fix restored
  • (packages/server) node ../../scripts/pnpm-runner.mjs lint [tsc -b ../shared && tsc --noEmit && tsc -p character-activity]: exit 0
  • (packages/client) npx eslint src/features/multiplayer/MultiplayerHostControls.tsx: exit 0
  • (packages/client) npx tsc -b; npx tsc -p ../../scripts/regressions/tsconfig.client-lanes.json: both exit 0
  • prettier --write MultiplayerHostControls.tsx; prettier --check on all 8 files changed against origin/staging: All matched files use Prettier code style
  • node ./scripts/pnpm-runner.mjs localization:check: exit 0
  • Search the installed packages (worktree .pnpm virtual store) for jsdom, happy-dom, linkedom, react-test-renderer or react-reconciler: None installed, so a click-driven client regression for the banner would need a new dependency

Independent adversarial review: changes, 2 issue(s), all addressed in a fix-up pass.

Known limits and risks:

Low overall, with these known limits. (1) The pre-auth global request budget (requestsGlobal 300/min) is still spent before the method, path and bearer checks. Three or more /64s (one residential /56 or hosting /48) or three or more IPv4 addresses, each using its 120/min bucket, can still use it up and rate-limit admitted guests. This change only stops one host from multiplying its budget across its own /64. A follow-up is still needed: reserve part of the budget for approved session tokens. (2) IPv6 guests on one LAN all get addresses in its single /64 (SLAAC), and link-local fe80:: guests all map to fe80::/64. They now share one 120/min request bucket where each used to have its own, the same way they already shared the 16-socket limit. An idle guest polls about 3 times a minute, but every room change wakes every guest's poll and each guest may send up to 30 actions (service.ts:700). A busy table of IPv6 guests on one LAN could therefore reach the shared bucket. On the internet, several guests behind one IPv4 NAT already share a bucket, but on a LAN, IPv4 guests each have their own private address. (3) The banner's choice between retryLimitReached and retryRefused uses the snapshot at the moment Retry is pressed. Both server refusals return 'busy', so the error alone cannot tell them apart. The host snapshot refetches every 2 s and the failed round is already counted when the banner appears, so the value at press time is accurate. There is no automated test for this client wiring: the repo has no DOM library or non-DOM React renderer, so it is covered by manual verification. (4) At generations == 1000, the schema maximum, the limit cannot be raised, so the limit message cannot be acted on there. The reviewer judged this not worth blocking. (5) The peer-server regression leg shadows TLSSocket.prototype.remoteAddress (test-only, removed in finally). It relies on the https server reading request.socket.remoteAddress through the TLSSocket prototype chain, which held on Node 24.22.1. That regression took 18-25 s under load against its 30 s per-file limit, and the base version took about as long, so the timeout risk predates this change. (6) Not done here: the user's relayed request to make showing off an outfit to a love interest in Otome Hearth give +5 affection instead of +20. Otome Hearth (otome-forge) is a downloadable package owned by Pasta-Devs/Marinara-Agents, and this repository contains no otome-forge code. Under AGENTS.md routing, the orchestrator must carry it out in a separate Marinara-Agents step against that repo's staging branch so the request is not dropped.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README) as needed
  • Translated docs on the docs-i18n branch updated to match, or a [docs-i18n] follow-up issue opened (see CONTRIBUTING.md § Translated documentation)
  • Version/release files updated (only if this PR includes a version bump)

🤖 Generated with Claude Code


🔄 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/8784 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 11/3/2026 **Status:** ✅ Merged **Merged:** 11/3/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `fix/multiplayer-rolls-retry-limits` --- ### 📝 Commits (2) - [`a244a5c`](https://github.com/Pasta-Devs/Marinara-Engine/commit/a244a5c777de5cb24cdfbff53c779c1abcd0cb2a) fix(multiplayer): whispered own rolls, Retry at the generation limit, IPv6 request buckets - [`89b1509`](https://github.com/Pasta-Devs/Marinara-Engine/commit/89b15090934a96e042ec3404a1c24f48e1949df8) fix(client): keep the Retry limit message after the host raises the limit ### 📊 Changes **8 files changed** (+94 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `packages/client/src/features/multiplayer/MultiplayerHostControls.tsx` (+11 -2) 📝 `packages/client/src/localization/locales/en.json` (+1 -0) 📝 `packages/server/src/services/multiplayer/game-projection.ts` (+6 -1) 📝 `packages/server/src/services/multiplayer/peer-server.ts` (+2 -1) 📝 `packages/server/src/services/multiplayer/room-store.ts` (+7 -1) 📝 `scripts/regressions/multiplayer-game-projection.regression.ts` (+21 -0) 📝 `scripts/regressions/multiplayer-peer-server-security.regression.ts` (+36 -2) 📝 `scripts/regressions/multiplayer-room.regression.ts` (+10 -0) </details> ### 📄 Description > [!IMPORTANT] > Contributions target `staging`. Only `SpicyMarinara` may promote this repository's `staging` branch or a same-repository `hotfix/*` branch to `main`. ## Linked issue Closes #8783 ## Why this change A release-prep audit found three multiplayer defects, and two verifiers confirmed each one. (1) A player never saw the result of a check the Game Master whispered to them. ownRolls read an audience key that nothing writes, and the transcript strips the check tag. (2) When a failed round had used the room's last allowed generation, Retry reported success but left the room active and stuck. The failure banner and Retry button disappeared, and guests' actions were refused. (3) The room listener limited requests per full IPv6 address but sockets per /64. One IPv6 host could multiply its per-address request budget across the addresses in its /64 and use up the shared pre-auth budget that admitted guests also need. No linked issue exists; one should be opened before the PR is submitted. ## What changed - Retry now refuses with an error when the room is at its AI generation limit. Before, it seemed to work and left the room stuck. IPv6 guests on the same /64 (for example, everyone on one home LAN) now share one request budget, as they already shared the socket limit. Nothing else that worked before stops working. - Room Game: a skill check the Game Master whispers to a player now shows in that player's own check results. It stays out of other players' results and the public rolls. Older replies with no saved audience stay private. - Room Game: at the generation limit, Retry keeps the round paused with everyone's actions and tells the host to raise Maximum AI generations in Chat Settings, then try again. The message stays the same after the host raises the limit, so it never points them to Resume, which would drop the kept actions. - Room listener: request rate limits now group IPv6 addresses by /64, as the socket limit already did, so one IPv6 host can't multiply its per-address request budget across its /64. ## Validation <!-- These are human tasks. Never tick a box for a check that was not actually performed. --> - [ ] `pnpm check` passes locally - [ ] Container (Docker / Podman) built and ran without issue - [ ] Ran the app, clicked through the changes manually - [ ] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [ ] Above manual verification completed (describe below) - [ ] Read and followed `CONTRIBUTING.md` ### Manual verification notes - Manually verify in a two-Engine Room Game that when the GM whispers a skill check to the guest ([whisper:<guest persona>] ... [skill_check ...]), the result shows in the guest's own check results and not in the host's. - Manually verify that when a round fails on the room's last allowed generation (for example, set Maximum AI generations to the used count and force a provider error), pressing 'Try the round again' keeps the failure banner and shows the 'used all its allowed AI generations' message. - Manually verify that after that refusal, raising Maximum AI generations in Chat Settings with the banner still on screen leaves the 'used all its allowed AI generations' message showing. It must not switch to 'the Game Master already wrote part of it'. - Manually verify that pressing Retry again after raising the limit runs the same round with everyone's actions kept. - Manually verify that an IPv6 guest still joins and polls normally on the room listener, and that two or three IPv6 guests on one LAN can play an active round without being rate-limited. Agent-run checks (for reference; each regression was shown to fail without its fix): - `node ./scripts/pnpm-runner.mjs build:shared`: exit 0 - `node ./scripts/run-regressions.mjs --filter multiplayer- (after the banner fix)`: 16/16 passed, including multiplayer-game-projection, multiplayer-room and multiplayer-peer-server-security (18.4 s) - `git stash push -- the 3 server source files; run the 3 touched regressions; git stash pop (first round)`: All 3 FAILED on the new assertions, and passed with the fix restored - `(packages/server) node ../../scripts/pnpm-runner.mjs lint [tsc -b ../shared && tsc --noEmit && tsc -p character-activity]`: exit 0 - `(packages/client) npx eslint src/features/multiplayer/MultiplayerHostControls.tsx`: exit 0 - `(packages/client) npx tsc -b; npx tsc -p ../../scripts/regressions/tsconfig.client-lanes.json`: both exit 0 - `prettier --write MultiplayerHostControls.tsx; prettier --check on all 8 files changed against origin/staging`: All matched files use Prettier code style - `node ./scripts/pnpm-runner.mjs localization:check`: exit 0 - `Search the installed packages (worktree .pnpm virtual store) for jsdom, happy-dom, linkedom, react-test-renderer or react-reconciler`: None installed, so a click-driven client regression for the banner would need a new dependency Independent adversarial review: changes, 2 issue(s), all addressed in a fix-up pass. Known limits and risks: Low overall, with these known limits. (1) The pre-auth global request budget (requestsGlobal 300/min) is still spent before the method, path and bearer checks. Three or more /64s (one residential /56 or hosting /48) or three or more IPv4 addresses, each using its 120/min bucket, can still use it up and rate-limit admitted guests. This change only stops one host from multiplying its budget across its own /64. A follow-up is still needed: reserve part of the budget for approved session tokens. (2) IPv6 guests on one LAN all get addresses in its single /64 (SLAAC), and link-local fe80:: guests all map to fe80::/64. They now share one 120/min request bucket where each used to have its own, the same way they already shared the 16-socket limit. An idle guest polls about 3 times a minute, but every room change wakes every guest's poll and each guest may send up to 30 actions (service.ts:700). A busy table of IPv6 guests on one LAN could therefore reach the shared bucket. On the internet, several guests behind one IPv4 NAT already share a bucket, but on a LAN, IPv4 guests each have their own private address. (3) The banner's choice between retryLimitReached and retryRefused uses the snapshot at the moment Retry is pressed. Both server refusals return 'busy', so the error alone cannot tell them apart. The host snapshot refetches every 2 s and the failed round is already counted when the banner appears, so the value at press time is accurate. There is no automated test for this client wiring: the repo has no DOM library or non-DOM React renderer, so it is covered by manual verification. (4) At generations == 1000, the schema maximum, the limit cannot be raised, so the limit message cannot be acted on there. The reviewer judged this not worth blocking. (5) The peer-server regression leg shadows TLSSocket.prototype.remoteAddress (test-only, removed in finally). It relies on the https server reading request.socket.remoteAddress through the TLSSocket prototype chain, which held on Node 24.22.1. That regression took 18-25 s under load against its 30 s per-file limit, and the base version took about as long, so the timeout risk predates this change. (6) Not done here: the user's relayed request to make showing off an outfit to a love interest in Otome Hearth give +5 affection instead of +20. Otome Hearth (otome-forge) is a downloadable package owned by Pasta-Devs/Marinara-Agents, and this repository contains no otome-forge code. Under AGENTS.md routing, the orchestrator must carry it out in a separate Marinara-Agents step against that repo's staging branch so the request is not dropped. ## Docs and release impact - [ ] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README) as needed - [ ] Translated docs on the `docs-i18n` branch updated to match, or a `[docs-i18n]` follow-up issue opened (see CONTRIBUTING.md § Translated documentation) - [ ] Version/release files updated (only if this PR includes a version bump) 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <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:48 +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#8802
No description provided.