Skip to content

test(e2e): stabilize terminal shortcut Kitty and Ctrl+C tests - #23472

Merged
Jinwoo-H merged 1 commit into
mainfrom
test/terminal-shortcuts-e2e-stability
Sep 27, 2026
Merged

Jinwoo-H merged 1 commit into
mainfrom
test/terminal-shortcuts-e2e-stability

Conversation

@Jinwoo-H

@Jinwoo-H Jinwoo-H commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​7 $\color{#cf222e}{\Huge{\mathbf{−}}}$​6 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1
Prod 0 0 0 0

ELI5

Two terminal keyboard tests were unreliable. One always failed, and because the file's tests run in order, that failure hid every test after it. This fixes both tests. No app code changes.

What Changed

  • Shift+Enter under the Kitty keyboard protocol: the test turned on the Kitty protocol with a command that exited immediately (printf '\033[>1u'). Since fix(terminal): ground a program that dies with input modes armed on the normal screen #22739, the terminal daemon resets input modes that a finished command leaves on, so the flags were back at 0 before the test could check them. The test now uses a command that stays alive while the test checks the Kitty encoding (printf '\033[>1u'; read -r _; printf '\033[<u'). Pressing Enter then ends the command, which turns the protocol off itself, and the test checks the plain encoding. This replaces the old manual line-clear and reset.
  • Plain Ctrl+C under the Kitty protocol: each test starts in a fresh tab. This test could send Ctrl+C before the new shell finished starting. An interrupt during shell startup kills the shell, so the tab closed and the test read no terminal. It now waits for a ready prompt (an echo round-trip) before sending Ctrl+C. Its assertions are unchanged.

Why

  • Shift+Enter: the test's premise stopped holding once the daemon started cleaning up after finished commands. A command that switches its own mode off tests the same encoding, without depending on that cleanup's timing.
  • Ctrl+C: waiting for the prompt is the same readiness idiom other terminal e2e specs use. It removes the startup race without changing what the test checks.

Linked Issue

N/A (maintainer test fix)

Visual Proof

N/A: tests only; no UI or behavior change.

Testing

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below

On macOS, hidden (ORCA_BACKGROUND_LAUNCH=1, electron-headless, one worker), tests/e2e/terminal-shortcuts.spec.ts:

  • Before (main's spec): fails on the first test, "Expected: 1, Received: 0" waiting for the Kitty flags, and every later test is skipped. The same failure shows in main's e2e shard runs.
  • After: the full spec passed 8 times in a row: 7 passed each run, plus 2 Windows-only tests skipped.

Linux and Windows are covered by CI.

Review

Agent skill upstream boundary

  • Not applicable, or this change follows docs/reference/agent-skill-sharing-upstream-boundary.md and copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Test-only change. No effect on security, platform behavior, SSH, mobile, compatibility, or performance.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

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 — test-only stabilization of tests/e2e/terminal-shortcuts.spec.ts (1 file, +7/−6).

  • Kitty Shift+Enter test — The arming command now stays alive and disarms itself (printf '\033[>1u'; read -r _; printf '\033[<u') instead of the old settled printf '\033[>1u' plus a separate \x15\x03 / printf '\033[=0u' reset; the disarm step sends \r to end read. Assertions (flags 1 → \x1b[13;2u; flags 0 → \x1b\r) are unchanged.
  • Plain Ctrl+C test — Adds a readiness barrier (echo "CTRL_C_""READY" + waitForTerminalOutput('CTRL_C_READY')) before the interrupt. The split-quote marker keeps the echoed command from satisfying the wait. Assertions unchanged.

Both changes keep the same assertions, and getKittyKeyboardFlags reads the xterm coreService.kittyKeyboard.flags state that the Shift+Enter policy itself consumes, so neither test was weakened into theatre. No production code touched.

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

@coderabbitai

coderabbitai Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 16b75418-511e-4e3c-8d3b-ee3e71e4a3d3

📥 Commits

Reviewing files that changed from the base of the PR and between e6cccfb27027bce57500e37c417d2bb37b4250e2 and 8e9aceb.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The Kitty keyboard-state test now releases its read with carriage return and resets reporting flags within the shell command. The Ctrl+C test now waits for a shell ready marker after it captures the active PTY ID.

Priority: ⬇️ Low

Merge Risk: 🟡 Moderate · up to e6ccc

The Ctrl+C end-to-end test may time out on Windows. Use a shell-neutral ready marker before merging.

Architecture Summary

Architecture risk: 🔵 Low · up to e6ccc

The change affects 1 system.

Changed systems: tests

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — tests (service) was modified; 1 changed file maps to changed impact.

Before / after behavior

  • observed — Modified behavior in tests/e2e/terminal-shortcuts.spec.ts: The Kitty-state test now runs a shell command that enables reporting, waits for input, and resets the flags; after verifying the encoded Shift+Enter write, it sends carriage return to release the read. This replaces the separate Ctrl+U/Ctrl+C cleanup and reset command.
  • observed — Modified behavior in tests/e2e/terminal-shortcuts.spec.ts: The Ctrl+C test now captures the active PTY ID, prints a ready marker, and waits for that output before continuing, replacing the prior PTY-ID-only wait.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes stabilizing the Kitty keyboard and Ctrl+C terminal end-to-end tests.
Description check ✅ Passed The description is complete and aligned with the template. It explains the failure causes, test changes, rationale, validation results, scope, and compatibility considerations. The maintainer exceptio…
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 428be441-2646-4fe6-a2f9-8a6f473d1fa5

📥 Commits

Reviewing files that changed from the base of the PR and between 838769d and e6cccfb27027bce57500e37c417d2bb37b4250e2.

📒 Files selected for processing (1)
  • tests/e2e/terminal-shortcuts.spec.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

await waitForActivePanePtyId(orcaPage)
const ptyId = await waitForActivePanePtyId(orcaPage)
// SIGINT during shell startup kills the shell, so interrupt only a ready prompt.
await execInTerminal(orcaPage, ptyId, 'echo "CTRL_C_""READY"')

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

rg -n -C 5 'CTRL_C_READY|execInTerminalImpl|powershell|pwsh|cmd.exe|shellPath|defaultShell' .

Repository: stablyai/orca

Length of output: 43452


🏁 Script executed:

set -eu
printf '%s\n' '--- changed file diff ---'
git diff --unified=25 ef987e42d77279aaf28e128159341b787c45645f e6cccfb27027bce57500e37c417d2bb37b4250e2 -- tests/e2e/terminal-shortcuts.spec.ts
printf '%s\n' '--- relevant symbols in changed file ---'
rg -n -C 12 'execInTerminalImpl|execInTerminal|waitForTerminalOutput|CTRL_C_READY|powershell|pwsh|cmd\.exe|shellPath|defaultShell' tests/e2e/terminal-shortcuts.spec.ts
printf '%s\n' '--- helper declarations/usages ---'
rg -n -C 8 'function execInTerminalImpl|const execInTerminalImpl|async function execInTerminalImpl|execInTerminalImpl\s*=|function waitForTerminalOutput|const waitForTerminalOutput|async function waitForTerminalOutput' tests src config --glob '!**/*.json' --glob '!**/*.jsonc'
printf '%s\n' '--- likely Windows terminal shell bindings ---'
rg -n -C 10 'defaultShell|shellPath|PowerShell|powershell\.exe|pwsh\.exe|cmd\.exe|Git Bash|bash\.exe' src/main src/renderer tests config --glob '*.{ts,tsx,js,mjs,json,jsonc}' | head -n 1200

Repository: stablyai/orca

Length of output: 41689


🏁 Script executed:

set -eu
git diff --unified=25 ef987e42d77279aaf28e128159341b787c45645f e6cccfb27027bce57500e37c417d2bb37b4250e2 -- tests/e2e/terminal-shortcuts.spec.ts
printf '%s\n' '--- test references ---'
rg -n -C 12 'execInTerminalImpl|execInTerminal|waitForTerminalOutput|CTRL_C_READY|powershell|pwsh|cmd\.exe|shellPath|defaultShell' tests/e2e/terminal-shortcuts.spec.ts
printf '%s\n' '--- helper declarations ---'
rg -n -C 8 'function execInTerminalImpl|const execInTerminalImpl|async function execInTerminalImpl|execInTerminalImpl\s*=|function waitForTerminalOutput|const waitForTerminalOutput|async function waitForTerminalOutput' tests src config --glob '!**/*.json' --glob '!**/*.jsonc'
printf '%s\n' '--- Windows shell bindings ---'
rg -n -C 10 'defaultShell|shellPath|PowerShell|powershell\.exe|pwsh\.exe|cmd\.exe|Git Bash|bash\.exe' src/main src/renderer tests config --glob '*.{ts,tsx,js,mjs,json,jsonc}' | head -n 1200

Repository: stablyai/orca

Length of output: 41420


🏁 Script executed:

set -eu
printf '%s\n' '--- execInTerminal bindings ---'
rg -n -C 20 'execInTerminal' tests/e2e --glob '*.{ts,tsx,js,mjs}'
printf '%s\n' '--- terminal helper files ---'
git ls-files 'tests/e2e/helpers/*terminal*' 'tests/e2e/*terminal*'
printf '%s\n' '--- shell selection in E2E fixtures ---'
rg -n -C 12 'defaultShell|shellPath|windows.*shell|PowerShell|pwsh|cmd\.exe|bash\.exe|WINDOWS_.*SHELL|terminalShell' tests/e2e src/main src/renderer/src --glob '*.{ts,tsx,js,mjs}'

Repository: stablyai/orca

Length of output: 45668


🏁 Script executed:

set -eu
printf '%s\n' '--- helper files containing execInTerminal ---'
rg -l 'execInTerminal' tests/e2e --glob '*.{ts,tsx,js,mjs}' | sort
printf '%s\n' '--- exact execInTerminal references ---'
rg -n -C 12 'execInTerminal' tests/e2e --glob '*.{ts,tsx,js,mjs}'
printf '%s\n' '--- Windows shell constants and consumers ---'
rg -n -C 12 'WINDOWS_.*SHELL|windows.*shell|defaultShell|shellPath|PowerShell|pwsh|cmd\.exe|bash\.exe' tests/e2e src/main src/renderer/src --glob '*.{ts,tsx,js,mjs}' | grep -E 'tests/e2e|windows-terminal-shell|terminal.*shell|shell.*terminal|defaultShell|shellPath|execInTerminal' | head -n 600

Repository: stablyai/orca

Length of output: 45665


🏁 Script executed:

set -eu
rg -l 'execInTerminal' tests/e2e --glob '*.{ts,tsx,js,mjs}' | sort
rg -n -C 12 'execInTerminal' tests/e2e --glob '*.{ts,tsx,js,mjs}'
rg -n -C 12 'WINDOWS_.*SHELL|windows.*shell|defaultShell|shellPath|PowerShell|pwsh|cmd\.exe|bash\.exe' tests/e2e src/main src/renderer/src --glob '*.{ts,tsx,js,mjs}' | grep -E 'tests/e2e|windows-terminal-shell|terminal.*shell|shell.*terminal|defaultShell|shellPath|execInTerminal' | head -n 600

Repository: stablyai/orca

Length of output: 45663


🏁 Script executed:

set -eu
printf '%s\n' '--- terminal helper exports and imports ---'
rg -n 'execInTerminal|terminal-pane-operations|createTerminal|terminalWindowsShell|defaultShell|shellPath' tests/e2e/helpers/terminal.ts tests/e2e/helpers/terminal-pane-operations.ts tests/e2e/helpers/orca-app.ts tests/e2e/helpers/*.ts
printf '%s\n' '--- terminal helper source ---'
sed -n '1,260p' tests/e2e/helpers/terminal.ts
printf '%s\n' '--- terminal pane operation source around exec ---'
rg -n -C 25 'execInTerminal|sendToTerminal' tests/e2e/helpers/terminal-pane-operations.ts

Repository: stablyai/orca

Length of output: 11709


🏁 Script executed:

set -eu
rg -n 'execInTerminal|terminal-pane-operations|createTerminal|terminalWindowsShell|defaultShell|shellPath' tests/e2e/helpers/terminal.ts tests/e2e/helpers/terminal-pane-operations.ts tests/e2e/helpers/orca-app.ts tests/e2e/helpers/*.ts
sed -n '1,260p' tests/e2e/helpers/terminal.ts
rg -n -C 25 'execInTerminal|sendToTerminal' tests/e2e/helpers/terminal-pane-operations.ts

Repository: stablyai/orca

Length of output: 11583


🏁 Script executed:

set -eu
printf '%s\n' '--- terminalWindowsShell declarations and defaults ---'
rg -n -C 8 'terminalWindowsShell' src/shared src/main src/renderer/src tests/e2e --glob '*.{ts,tsx,js,mjs}'
printf '%s\n' '--- Windows shell resolver ---'
rg -n -C 20 'resolveWindowsShell|BuiltInWindowsTerminalShell|WINDOWS_.*SHELL|powershell\.exe.*default|default.*powershell' src/shared src/main src/renderer/src tests/e2e --glob '*.{ts,tsx,js,mjs}'

Repository: stablyai/orca

Length of output: 45664


🌐 Web query:

official PowerShell about quoting rules adjacent double-quoted string literals echo "a""b"

💡 Result:

The official rule is that **two consecutive double quotes inside a double-quoted string represent one literal double quote**. So:

```powershell
echo "a""b"
```

outputs:

```text
a"b
```

Here `echo` is an alias for `Write-Output`; this is one string argument, not two adjacent strings being concatenated. Microsoft’s `about_Quoting_Rules` gives the same doubled-quote rule and an example. ([learn.microsoft.com](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_quoting_rules?trk=article-ssr-frontend-pulse_little-text-block&view=powershell-5.1&utm_source=openai))

Citations:

- 1: https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_quoting_rules?trk=article-ssr-frontend-pulse_little-text-block&view=powershell-5.1&utm_source=openai

Use a shell-neutral ready marker.

When the pane uses PowerShell, echo "CTRL_C_""READY" emits CTRL_C_"READY, not CTRL_C_READY. The following wait can therefore time out.

🐛 Suggested fix
-    await execInTerminal(orcaPage, ptyId, 'echo "CTRL_C_""READY"')
+    await execInTerminal(orcaPage, ptyId, 'echo CTRL_C_READY')
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
await execInTerminal(orcaPage, ptyId, 'echo "CTRL_C_""READY"')
await execInTerminal(orcaPage, ptyId, 'echo CTRL_C_READY')

Shift+Enter: the host now grounds keyboard modes a finished command left
armed, so the test's one-shot `printf '\033[>1u'` was reset to 0 before the
poll. Keep the command alive via `read` while asserting, then let it pop
its own flags on Enter.

Ctrl+C: each test opens a fresh tab, and SIGINT during shell startup can
kill the shell and close the tab. Wait for a ready prompt before
interrupting. The existing post-interrupt assertions are unchanged.
@Jinwoo-H
Jinwoo-H force-pushed the test/terminal-shortcuts-e2e-stability branch from e6cccfb to 8e9aceb Compare September 27, 2026 21:53
@Jinwoo-H
Jinwoo-H merged commit 10807d8 into main Sep 27, 2026
39 checks passed
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