Skip to content

Fix Codex terminal Ctrl+C and background recovery - #3941

Merged
AmethystLiang merged 1 commit into
mainfrom
fix-ctrl-c-exit-on-codex
May 30, 2026
Merged

AmethystLiang merged 1 commit into
mainfrom
fix-ctrl-c-exit-on-codex

Conversation

@AmethystLiang

@AmethystLiang AmethystLiang commented May 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • intercept plain Ctrl+C before xterm's Kitty CSI-u encoder, send ETX through the terminal input path, suppress the matching release/modifier events, and clear stale renderer-side Kitty flags after SIGINT
  • add Kitty/focus/cursor reset separation for replay/reattach paths while preserving live hidden-output snapshot recovery
  • detect ANSI background SGR output, including split PTY chunks, and move those terminal panes to the DOM renderer so Codex box/background drawing does not lose background blocks

Fixes #378.

Tests

  • pnpm run typecheck
  • pnpm run lint
  • git diff --check
  • pnpm vitest run --config config/vitest.config.ts src/renderer/src/components/terminal-pane/pty-connection.test.ts src/renderer/src/components/terminal-pane/xterm-bypass-policy.test.ts src/renderer/src/components/terminal-pane/xterm-bypass-policy-interrupt.test.ts src/renderer/src/components/terminal-pane/xterm-bypass-policy-non-mac.test.ts src/renderer/src/components/terminal-pane/terminal-replay-cursor-state.test.ts src/renderer/src/lib/pane-manager/terminal-complex-script.test.ts
  • pnpm exec playwright test tests/e2e/terminal-shortcuts.spec.ts --config tests/playwright.config.ts --project electron-headless -g "plain Ctrl\\+C sends ETX"
  • Live Electron smoke on exact PR worktree via CDP: verified window.api.app.getIdentity() reports fix-ctrl-c-exit-on-codex, used demo-project, created disposable workspaces, enabled Kitty keyboard reporting, pressed/released Control, pressed Ctrl+C, and verified the terminal showed only ^C before a clean echo ORCA_AFTER_CTRL_C_CLEAN command
  • SKIP_BUILD=1 pnpm exec playwright test tests/e2e/terminal-shortcuts.spec.ts --config tests/playwright.config.ts --project electron-headful -g "Codex-like background" skipped locally because WebGL was not active in this environment

Notes

  • No live SSH pass was run; this changes renderer/xterm and transport-agnostic PTY input/replay behavior, not SSH or relay-specific code.

Risk: medium

Risk assessment: Medium. The validation is broad, including live Electron smoke, but this changes terminal Ctrl+C handling, Kitty keyboard reporting, replay reset behavior, and renderer fallback for Codex-like background output.

@nwparker nwparker added the risk:medium Medium risk change label May 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk:medium Medium risk change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Built in browser support

2 participants