Skip to content

fix(tui): ignore terminal status responses as input - #2445

Open
ousamabenyounes wants to merge 2 commits into
MoonshotAI:mainfrom
ousamabenyounes:fix/issue-2181
Open

fix(tui): ignore terminal status responses as input#2445
ousamabenyounes wants to merge 2 commits into
MoonshotAI:mainfrom
ousamabenyounes:fix/issue-2181

Conversation

@ousamabenyounes

Copy link
Copy Markdown

Related Issue

Resolve #2181

Problem

Terminal query replies such as cell-size, device-attribute, DCS, APC, and OSC reports were routed as keyboard input. During an active turn, those control responses could be interpreted as user activity and interrupt the turn.

What changed

  • consume non-OSC terminal status replies before application input listeners;
  • preserve OSC reports for protocol listeners such as live theme tracking, while preventing unhandled reports from reaching the focused component;
  • keep ordinary keyboard, SGR mouse, and Kitty keyboard input unchanged;
  • add patch changesets for pi-tui and kimi-code.

Test verification (RED → GREEN)

  • RED on the unpatched upstream path: exact cell-size (ESC[6;18;8t), OSC, and device-attribute (ESC[?1;2;4c) responses reached application/focused input handlers.
  • GREEN after the patch: four regression scenarios cover non-OSC filtering, listener-consumed OSC, unhandled OSC filtering, and preservation of keyboard/mouse/Kitty input.
  • Full local suite proof on Node 24.15.0:
    • clean pi-tui baseline: 715/715 passing;
    • patched pi-tui suite: 719/719 passing, 0 skipped, 0 failed;
    • patched kimi-code suite: 2,457 passing, 5 pre-existing skips, 0 failed across 187 files;
    • pi-tui typecheck/build, changed-file lint, sherif, changeset validation, and diff checks pass.

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue, or explained the problem above.
  • I have added tests that prove my feature works.
  • Ran gen-changesets skill, or this PR needs no changeset.
  • Ran gen-docs skill, or this PR needs no doc update.

@changeset-bot

changeset-bot Bot commented Jul 31, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 3275941

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@moonshot-ai/kimi-code Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c5726a329c

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread .changeset/calm-terminals-filter.md Outdated
@ousamabenyounes

Copy link
Copy Markdown
Author

The private pi-tui changeset was already removed in 3275941d6. The remaining changeset now targets only the publishable CLI package, as confirmed by changeset-bot. I have resolved the stale review thread.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Terminal escape sequences (CSI/OSC) leak into stdin and trigger false "Cancelled by user" abort

1 participant