Skip to content

fix(terminal): avoid duplicate broadcast keypress text - #3292

Open
binaricat wants to merge 1 commit into
mainfrom
codex/smoke-broadcast-input
Open

fix(terminal): avoid duplicate broadcast keypress text#3292
binaricat wants to merge 1 commit into
mainfrom
codex/smoke-broadcast-input

Conversation

@binaricat

Copy link
Copy Markdown
Owner

Summary

Typing uppercase letters and spaces with cross-tab broadcast enabled could send some characters twice to recipient terminals while the source looked correct. Preserve the physical-key pairing when xterm emits its text on keypress, and prevent a trailing insertText marker from treating the next physical key as a second composition commit.

Type of Change

  • Bug fix
  • New feature
  • Refactor / code cleanup
  • Documentation update
  • Build / CI change
  • Other

Related Issue (optional)

Found while smoke testing #3275 in the development app. No separate issue.

Changes Made

  • Re-arm the existing legacy-data pairing on a matching keypress; retain the existing unmatched-event cleanup so later paste is not swallowed.
  • Give an identified physical-key payload precedence over a stale composition fallback marker. Actual composition/input handlers clear physical pairing before delivering committed text.
  • Add regression coverage that executes the actual registered key, input, and data callbacks with controlled event timing and the real recipient encoder, without constructing the unrelated renderer/addon stack.

Screenshots / Demo

Verified in the actual npm run dev Electron UI on macOS, with local zsh and a Linux SSH session:

  • Before: echo NETCATTY_SMOKE_BROADCAST_20260906_A looks correct on the source, but recipients repeat uppercase characters. Individual Shift+A/B/C produces ABBC at the recipient.
  • Captured event order: Space keypress emits data, followed by insertText; the next physical A arrives before the composition fallback timer expires and is broadcast again as text.
  • After: full uppercase test strings match exactly in both directions; individual Shift+A/B/C produces exactly ABC.
  • Disabling broadcast keeps a subsequent marker on the source only.
  • Pasting echo "中文 ABC paste" still reaches the recipient correctly and produces the expected text once.

Temporary diagnostic recording was removed before final verification.

Testing

  • Tested locally with npm run dev and Computer UI actions
  • npm run lint passes; final changed files also pass focused lint
  • npm test: 11,484 passed, 18 skipped, zero failures
  • Generated capability tool specs: not applicable
  • No new console errors or warnings — not asserted for all application flows

118 focused keyboard, broadcast, IME, and terminal tests pass. The baseline fails six delayed-keypress regression cases; the intermediate timing repair still fails the captured trailing-insertText case ( AABBCC instead of ABC). The final change passes all nine new cases, including keyless Chinese text and subsequent paste.

Checklist

  • Existing project style and input architecture followed
  • Behavior and validation documented above
  • No intentional breaking changes

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 6, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-06T08:55:24.841221Z f15508a Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@binaricat binaricat added the automation:codex-loop Own/bot PR waiting on Codex review↔fix loop label Sep 6, 2026
@binaricat
binaricat marked this pull request as draft September 6, 2026 08:52
@binaricat

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

Reviewed commit: f15508aaff

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@netcatty-bot
netcatty-bot marked this pull request as ready for review September 6, 2026 08:55
@netcatty-bot netcatty-bot added automation:bot-pr PR created or owned by Cursor automation automation:codex-clean Last Codex review reported clean and removed automation:codex-loop Own/bot PR waiting on Codex review↔fix loop labels Sep 6, 2026
@netcatty-bot

Copy link
Copy Markdown
Collaborator

Codex reported no major issues. This PR is marked ready for human review/merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automation:bot-pr PR created or owned by Cursor automation automation:codex-clean Last Codex review reported clean

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants