Skip to content

Fix Codex held-key input batching#4732

Merged
Jinwoo-H merged 1 commit into
mainfrom
Jinwoo-H/codex-held-key-input-lag
Jun 6, 2026
Merged

Fix Codex held-key input batching#4732
Jinwoo-H merged 1 commit into
mainfrom
Jinwoo-H/codex-held-key-input-lag

Conversation

@Jinwoo-H
Copy link
Copy Markdown
Contributor

@Jinwoo-H Jinwoo-H commented Jun 6, 2026

Summary

  • shorten latency-sensitive synchronized-output coalescing to a single frame so held key repeats do not batch behind the fallback
  • add a scheduler regression test for repeated latency-sensitive synchronized Codex redraw frames

Repro / validation

  • Reproduced in packaged Orca with Codex TUI: held \x\ previously had steady PTY output but xterm writes batched two redraws and hit ~95ms gaps; Backspace stayed under ~66ms.
  • Fresh packaged build after fix: 46 held-key keydowns -> 46 xterm writes, no double-redraw writes, max xterm write gap ~62ms, no >80ms gaps.
  • pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/lib/pane-manager/pane-terminal-output-scheduler.test.ts
  • pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/components/terminal-pane/pty-connection.test.ts src/renderer/src/lib/pane-manager/windows-pty-compatibility.test.ts src/renderer/src/components/terminal-pane/terminal-conpty-device-attributes.test.ts src/renderer/src/lib/pane-manager/pane-terminal-output-scheduler.test.ts
  • pnpm exec oxlint src/renderer/src/lib/pane-manager/pane-terminal-output-scheduler.ts src/renderer/src/lib/pane-manager/pane-terminal-output-scheduler.test.ts --quiet
  • pnpm run typecheck:web
  • pnpm run build:electron-vite

Note: local electron-builder --dir produced dist-held-key-fix/win-unpacked and then hit the known Windows winCodeSign symlink extraction failure.

Copy link
Copy Markdown
Contributor

@pullfrog pullfrog Bot left a comment

Choose a reason for hiding this comment

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

✅ No new issues found.

Reviewed changes — this PR shortens the latency-sensitive foreground coalesce delay from 32ms to 16ms so held key repeats (ticking every 30–50ms) don't batch two redraw frames behind the fallback timer.

  • Reduce LATENCY_SENSITIVE_FOREGROUND_COALESCE_DELAY_MS from 32 to 16 — the new value is one frame at 60fps, shorter than the minimum key-repeat interval, so each repeat gets its own xterm.write instead of coalescing two into one batch.
  • Update two existing test time advances — 31ms assertions changed to 15ms to stay just below the new 16ms threshold.
  • Add regression test — "does not batch repeated latency-sensitive synchronized frames across key-repeat ticks" enqueues two Codex-style frame pairs and verifies two separate writes with the correct data.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@Jinwoo-H Jinwoo-H merged commit 2f7fe08 into main Jun 6, 2026
2 checks passed
@Jinwoo-H Jinwoo-H deleted the Jinwoo-H/codex-held-key-input-lag branch June 6, 2026 04:16
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.

1 participant