[PR #7616] [MERGED] fix(game): wrap unbreakable runs in the session log and dialogue box #7838

Closed
opened 2026-10-24 04:08:00 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/7616
Author: @SpicyMarinara
Created: 10/14/2026
Status: ✅ Merged
Merged: 10/14/2026
Merged by: @SpicyMarinara

Base: staging ← Head: fix/7606-game-log-overflow


📝 Commits (4)

  • ab247e4 fix(game): wrap unbreakable runs in the session log and dialogue box
  • 50ba7a5 fix(game): wrap long runs in the note reader and the speaker name
  • afcc00b Merge remote-tracking branch 'origin/staging' into fix/7606-game-log-overflow
  • b9cb2cd Merge branch 'staging' into fix/7606-game-log-overflow

📊 Changes

4 files changed (+150 additions, -5 deletions)

View changed files

➕ e2e/game-log-overflow.e2e.ts (+143 -0)
📝 packages/client/src/components/game/GameNarration.tsx (+4 -4)
📝 packages/client/src/components/game/GameReadableDisplay.tsx (+1 -1)
📝 packages/client/src/styles/globals.css (+2 -0)

📄 Description

Important

Contributions target staging. Only SpicyMarinara may promote this repository's staging branch or a same-repository hotfix/* branch to main.
Outside and first-time contributors also require an approving review from SpicyMarinara.

Linked issue

Closes #7606

Why this change

  • In one Game chat, the Session Logs window scrolled sideways on a phone because one AI reply ran far past the edge of its box.
  • The reporter's screenshot shows the cause. The model's reasoning leaked into the reply and repeated the Game line format, including the long expression list neutral|happy|sad|angry|surprised|.... Chrome, Samsung Browser and Safari never wrap a run of words joined by |, / or , with no spaces, so the whole list stayed on one line. Long URLs and long snake_case tokens have the same effect.
  • Nothing in the Game log or dialogue box allowed such a run to break. The chat window already handles it, which is why only Game mode showed the problem.

What changed

  • The Session Logs window and the Stacked log card now break an over-long run inside the box instead of widening it (overflow-wrap: anywhere on both scroll containers in GameNarration.tsx).
  • The dialogue box, the narration box, the "You find a note..." box and the translation panel do the same. All four share the game-narration-prose class, which now sets overflow-wrap: anywhere in globals.css. Side remarks already did this.
  • The window that opens to read a Note or Book does the same (overflow-wrap: anywhere on its scroll box in GameReadableDisplay.tsx). It has its own formatter and box, so the shared class didn't reach it, and a [Note: …] holding the list made it scroll sideways.
  • A dialogue line whose speaker is the list itself, such as [neutral|happy|sad|…]: "…", no longer pushes the name past the dialogue box. The name row can now shrink (min-w-0) and the name wraps (overflow-wrap: anywhere) instead of being cut off at the panel's edge.
  • Ordinary text still wraps at spaces as before. Only a run that cannot fit on a line is broken mid-word.
  • New Playwright spec e2e/game-log-overflow.e2e.ts, which runs on the phone projects. It seeds a Game turn with leaked reasoning behind an unclosed <think> tag, the expression list, a long URL, a <pre> token and a pipe table row, followed by a dialogue line containing the same list, a dialogue line whose speaker is the list, and a [Note: …] holding the list. It checks that no box scrolls sideways, that the speaker name stays inside the dialogue box, that the Note reader doesn't scroll sideways, and that nothing sticks out past the log's right edge, in both Classic and Stacked display.
  • Not changed: model-written HTML such as <span class="whitespace-nowrap"> can still widen the log, because the Game formatter keeps the class attribute on spans. That was already the case before this bug and needs a separate decision about which classes to keep.
  • Not changed: the shared thinking-tag parser (extractLeadingThinkingBlocks). It keeps a reply visible when the opening tag is never closed, because hiding it could hide the whole reply. Its output was not the cause here: the overflow comes from the unwrapped run, whether or not a tag is present. The reporter's text also looks like reasoning written as plain output, with no tag to strip.

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

Commands run by the agent, with results:

  • playwright test e2e/game-log-overflow.e2e.ts --project=mobile-chromium --project=mobile-webkit on unchanged staging code: 4 failed. Each run reported the narration box, the dialogue box, the Session Logs / Stacked log and the log's right edge, for example flex-1 overflow-y-auto px-4 py-3 space-y-4: 1204 > 388.
  • Same command with this change: 4 passed.
  • After adding the Note reader and speaker-name checks, the same command with only the earlier log/dialogue fix (reader and name row unchanged): 4 failed, on speaker name past the dialogue box's edge (the name's DIV/SPAN past the panel) and note reader scrolls sideways (flex-1 overflow-y-auto px-6 py-4: 1014 > 361). With the full change: 4 passed.
  • playwright test e2e/game-log-overflow.e2e.ts e2e/game-widget-style.e2e.ts e2e/game-verb-only-turn.e2e.ts e2e/game-translation-edits.e2e.ts e2e/game-npc-portraits.e2e.ts e2e/chat-widget-dialogue-colors.e2e.ts (desktop-chromium, mobile-chromium, mobile-webkit): 54 passed, 6 skipped. The skips are the specs' own project gates.
  • playwright test e2e/chat-sweep.e2e.ts -g "Game translation follows changed narration" (opens and closes the Note reader; all three projects): 3 passed.
  • pnpm smoke:ui: 7 passed.
  • pnpm check (after merging current staging): passed. Its one lint warning is in HomeProfessorMariChat.tsx, which this PR does not touch, and was there before.
  • Local CodeRabbit (coderabbit review --agent --committed --base-commit <merge-base>): 0 findings.

Manual verification notes

  • Manually verify on an Android phone (Samsung Browser or Chrome) that a Game chat whose reply has a long a|b|c run, a long URL or a long unbroken word shows it wrapped in Session Logs, with no sideways scrolling.
  • Manually verify the same with the Stacked dialogue display, in the log card above the panel.
  • Manually verify that the dialogue box, the narration box, the "You find a note..." box and the translation panel wrap such a run.
  • Manually verify that a [Note: …] or [Book: …] with such a run opens a reader that wraps it, with no sideways scrolling.
  • Manually verify that a normal speaker name, with and without a whisper badge, still sits on one line, and that a very long name wraps inside the dialogue box.
  • Manually verify that ordinary Game text still wraps between words and is not broken mid-word when it fits, in light and dark mode.
  • Manually verify the Session Logs window on iPhone Safari.

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)

UI evidence (if applicable)

The before and after phone screenshots from the spec (mobile Chromium and mobile WebKit, Classic and Stacked) are kept locally and not uploaded. On staging, the expression list and the URL run off the right edge of Session Logs, and the window scrolls sideways. With this change, they wrap inside their cards.

Summary by CodeRabbit

  • Bug Fixes
    • Long unbroken text, including URLs, now wraps within Game narration, dialogue, note and book content, and session logs on mobile, preventing horizontal overflow across these views.

🔄 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/7616 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 10/14/2026 **Status:** ✅ Merged **Merged:** 10/14/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `fix/7606-game-log-overflow` --- ### 📝 Commits (4) - [`ab247e4`](https://github.com/Pasta-Devs/Marinara-Engine/commit/ab247e44d150e3d20d3b482326c0fd816f8fb0dd) fix(game): wrap unbreakable runs in the session log and dialogue box - [`50ba7a5`](https://github.com/Pasta-Devs/Marinara-Engine/commit/50ba7a55f2a9573f4e75c7011b1a559aa826a345) fix(game): wrap long runs in the note reader and the speaker name - [`afcc00b`](https://github.com/Pasta-Devs/Marinara-Engine/commit/afcc00b0a9a6df3fd6ba8701bf2c2569eb5c99d5) Merge remote-tracking branch 'origin/staging' into fix/7606-game-log-overflow - [`b9cb2cd`](https://github.com/Pasta-Devs/Marinara-Engine/commit/b9cb2cd4945d006a80c5c34a7f423405c57955ab) Merge branch 'staging' into fix/7606-game-log-overflow ### 📊 Changes **4 files changed** (+150 additions, -5 deletions) <details> <summary>View changed files</summary> ➕ `e2e/game-log-overflow.e2e.ts` (+143 -0) 📝 `packages/client/src/components/game/GameNarration.tsx` (+4 -4) 📝 `packages/client/src/components/game/GameReadableDisplay.tsx` (+1 -1) 📝 `packages/client/src/styles/globals.css` (+2 -0) </details> ### 📄 Description > [!IMPORTANT] > Contributions target `staging`. Only `SpicyMarinara` may promote this repository's `staging` branch or a same-repository `hotfix/*` branch to `main`. > Outside and first-time contributors also require an approving review from `SpicyMarinara`. <!-- See CONTRIBUTING.md § Branches. --> ## Linked issue Closes #7606 ## Why this change - In one Game chat, the Session Logs window scrolled sideways on a phone because one AI reply ran far past the edge of its box. - The reporter's screenshot shows the cause. The model's reasoning leaked into the reply and repeated the Game line format, including the long expression list `neutral|happy|sad|angry|surprised|...`. Chrome, Samsung Browser and Safari never wrap a run of words joined by `|`, `/` or `,` with no spaces, so the whole list stayed on one line. Long URLs and long `snake_case` tokens have the same effect. - Nothing in the Game log or dialogue box allowed such a run to break. The chat window already handles it, which is why only Game mode showed the problem. ## What changed - The Session Logs window and the Stacked log card now break an over-long run inside the box instead of widening it (`overflow-wrap: anywhere` on both scroll containers in `GameNarration.tsx`). - The dialogue box, the narration box, the "You find a note..." box and the translation panel do the same. All four share the `game-narration-prose` class, which now sets `overflow-wrap: anywhere` in `globals.css`. Side remarks already did this. - The window that opens to read a Note or Book does the same (`overflow-wrap: anywhere` on its scroll box in `GameReadableDisplay.tsx`). It has its own formatter and box, so the shared class didn't reach it, and a `[Note: …]` holding the list made it scroll sideways. - A dialogue line whose speaker is the list itself, such as `[neutral|happy|sad|…]: "…"`, no longer pushes the name past the dialogue box. The name row can now shrink (`min-w-0`) and the name wraps (`overflow-wrap: anywhere`) instead of being cut off at the panel's edge. - Ordinary text still wraps at spaces as before. Only a run that cannot fit on a line is broken mid-word. - New Playwright spec `e2e/game-log-overflow.e2e.ts`, which runs on the phone projects. It seeds a Game turn with leaked reasoning behind an unclosed `<think>` tag, the expression list, a long URL, a `<pre>` token and a pipe table row, followed by a dialogue line containing the same list, a dialogue line whose speaker is the list, and a `[Note: …]` holding the list. It checks that no box scrolls sideways, that the speaker name stays inside the dialogue box, that the Note reader doesn't scroll sideways, and that nothing sticks out past the log's right edge, in both Classic and Stacked display. - Not changed: model-written HTML such as `<span class="whitespace-nowrap">` can still widen the log, because the Game formatter keeps the `class` attribute on spans. That was already the case before this bug and needs a separate decision about which classes to keep. - Not changed: the shared thinking-tag parser (`extractLeadingThinkingBlocks`). It keeps a reply visible when the opening tag is never closed, because hiding it could hide the whole reply. Its output was not the cause here: the overflow comes from the unwrapped run, whether or not a tag is present. The reporter's text also looks like reasoning written as plain output, with no tag to strip. ## 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` Commands run by the agent, with results: - `playwright test e2e/game-log-overflow.e2e.ts --project=mobile-chromium --project=mobile-webkit` on unchanged staging code: **4 failed**. Each run reported the narration box, the dialogue box, the Session Logs / Stacked log and the log's right edge, for example `flex-1 overflow-y-auto px-4 py-3 space-y-4: 1204 > 388`. - Same command with this change: **4 passed**. - After adding the Note reader and speaker-name checks, the same command with only the earlier log/dialogue fix (reader and name row unchanged): **4 failed**, on `speaker name past the dialogue box's edge` (the name's `DIV`/`SPAN` past the panel) and `note reader scrolls sideways` (`flex-1 overflow-y-auto px-6 py-4: 1014 > 361`). With the full change: **4 passed**. - `playwright test e2e/game-log-overflow.e2e.ts e2e/game-widget-style.e2e.ts e2e/game-verb-only-turn.e2e.ts e2e/game-translation-edits.e2e.ts e2e/game-npc-portraits.e2e.ts e2e/chat-widget-dialogue-colors.e2e.ts` (desktop-chromium, mobile-chromium, mobile-webkit): **54 passed, 6 skipped**. The skips are the specs' own project gates. - `playwright test e2e/chat-sweep.e2e.ts -g "Game translation follows changed narration"` (opens and closes the Note reader; all three projects): **3 passed**. - `pnpm smoke:ui`: **7 passed**. - `pnpm check` (after merging current `staging`): **passed**. Its one lint warning is in `HomeProfessorMariChat.tsx`, which this PR does not touch, and was there before. - Local CodeRabbit (`coderabbit review --agent --committed --base-commit <merge-base>`): **0 findings**. ### Manual verification notes - Manually verify on an Android phone (Samsung Browser or Chrome) that a Game chat whose reply has a long `a|b|c` run, a long URL or a long unbroken word shows it wrapped in Session Logs, with no sideways scrolling. - Manually verify the same with the Stacked dialogue display, in the log card above the panel. - Manually verify that the dialogue box, the narration box, the "You find a note..." box and the translation panel wrap such a run. - Manually verify that a `[Note: …]` or `[Book: …]` with such a run opens a reader that wraps it, with no sideways scrolling. - Manually verify that a normal speaker name, with and without a whisper badge, still sits on one line, and that a very long name wraps inside the dialogue box. - Manually verify that ordinary Game text still wraps between words and is not broken mid-word when it fits, in light and dark mode. - Manually verify the Session Logs window on iPhone Safari. ## 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) ## UI evidence (if applicable) The before and after phone screenshots from the spec (mobile Chromium and mobile WebKit, Classic and Stacked) are kept locally and not uploaded. On staging, the expression list and the URL run off the right edge of Session Logs, and the window scrolls sideways. With this change, they wrap inside their cards. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Long unbroken text, including URLs, now wraps within Game narration, dialogue, note and book content, and session logs on mobile, preventing horizontal overflow across these views. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-24 04:08:00 +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#7838
No description provided.