[PR #4169] [MERGED] Reduce Roleplay composer input latency #6264

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/4169
Author: @SpicyMarinara
Created: 7/27/2026
Status: ✅ Merged
Merged: 7/27/2026
Merged by: @SpicyMarinara

Base: staging ← Head: agent/roleplay-direct-input-events


📝 Commits (1)

  • 4ddec1f Reduce Roleplay composer input latency

📊 Changes

2 files changed (+11 additions, -1 deletions)

View changed files

📝 packages/client/src/components/chat/ChatInput.tsx (+1 -1)
📝 scripts/regressions/roleplay-streaming.regression.ts (+10 -0)

📄 Description

Linked issue

Closes #4168

Why this change

  • Typing in Roleplay still had a small but measurable delay compared with Conversation, especially with a populated transcript.
  • The remaining mode-specific difference was Roleplay routing each keystroke through React's normalized change event while Conversation already used the direct input event path.

What changed

  • Route Roleplay composer typing through onInput, matching Conversation.
  • Add a Roleplay regression assertion so the textarea cannot silently drift back to onChange.

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

  • Ran a temporary Playwright input-event profiler against populated Conversation and Roleplay transcripts before and after the change.
  • Before: warmed Roleplay key-to-input delay averaged about 0.42 ms (0.7 ms p95), compared with Conversation at about 0.17 ms (0.3 ms p95).
  • After: warmed Roleplay averaged about 0.11 ms (0.2 ms p95), compared with Conversation at about 0.09 ms (0.2 ms p95).
  • Ran pnpm --filter @marinara-engine/server exec tsx ../../scripts/regressions/roleplay-streaming.regression.ts.
  • Ran pnpm check; it passed with the existing NoodleHome.tsx hook dependency warning.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) 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)

No visual UI changes. The interaction was verified with input-event timing measurements described above.

Summary by CodeRabbit

  • Bug Fixes

    • Improved chat text input responsiveness by handling typing through the browser’s direct input events.
  • Tests

    • Added regression coverage to verify consistent input handling across Roleplay and Conversation chat areas.

🔄 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/4169 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 7/27/2026 **Status:** ✅ Merged **Merged:** 7/27/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `agent/roleplay-direct-input-events` --- ### 📝 Commits (1) - [`4ddec1f`](https://github.com/Pasta-Devs/Marinara-Engine/commit/4ddec1f7b403fb559983ce6f13bb2c537cfce849) Reduce Roleplay composer input latency ### 📊 Changes **2 files changed** (+11 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `packages/client/src/components/chat/ChatInput.tsx` (+1 -1) 📝 `scripts/regressions/roleplay-streaming.regression.ts` (+10 -0) </details> ### 📄 Description ## Linked issue Closes #4168 ## Why this change - Typing in Roleplay still had a small but measurable delay compared with Conversation, especially with a populated transcript. - The remaining mode-specific difference was Roleplay routing each keystroke through React's normalized `change` event while Conversation already used the direct `input` event path. ## What changed - Route Roleplay composer typing through `onInput`, matching Conversation. - Add a Roleplay regression assertion so the textarea cannot silently drift back to `onChange`. ## 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 - Ran a temporary Playwright input-event profiler against populated Conversation and Roleplay transcripts before and after the change. - Before: warmed Roleplay key-to-input delay averaged about 0.42 ms (0.7 ms p95), compared with Conversation at about 0.17 ms (0.3 ms p95). - After: warmed Roleplay averaged about 0.11 ms (0.2 ms p95), compared with Conversation at about 0.09 ms (0.2 ms p95). - Ran `pnpm --filter @marinara-engine/server exec tsx ../../scripts/regressions/roleplay-streaming.regression.ts`. - Ran `pnpm check`; it passed with the existing `NoodleHome.tsx` hook dependency warning. ## Docs and release impact - [ ] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) 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) No visual UI changes. The interaction was verified with input-event timing measurements described above. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Improved chat text input responsiveness by handling typing through the browser’s direct input events. * **Tests** * Added regression coverage to verify consistent input handling across Roleplay and Conversation chat areas. <!-- 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-23 04:08:44 +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#6264
No description provided.