You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
test(e2e): keys typed into a new remote terminal before its first prompt reach the shell - #35312
Orca's managed-SSH end-to-end tests used to wait for the remote shell to print its first prompt before typing into a new terminal. The helper's comment said keys typed earlier "can be lost, as they would be for a user too." I checked: on current main, keys typed into a new remote terminal before the prompt all reach the shell. This PR adds a test that pins that guarantee and removes the wait, so those SSH tests now check it too.
What Changed
New spectests/e2e/headless-paired-remote-terminal-early-typing.spec.ts. A headless paired host runs bash, whose .bash_profile waits on a release file (bounded at about 30s). For each of 3 new remote terminals, the test:
waits for the pane to bind and asserts no prompt is drawn yet;
types echo EARLY_TYPING_n_$((40+2)) + Enter;
releases the shell, then requires the exact EARLY_TYPING_n_42 output line.
This is deterministic rather than timing-based: the keys always land while the rc file is still running. The release file starts present, because the host's own startup shell probe reads the same rc file.
HelperopenTerminalTab (tests/e2e/helpers/orcad-managed-workspace.ts) no longer waits for a prompt before returning.
Test-only change. No product code changes.
Why
The "keys typed before the first prompt lose a prefix" checklist item was reported for WSL and SSH. I traced it layer by layer on main:
Shell line discipline: I captured raw PTY transcripts of Debian bash 5.2 under Orca's real shell-ready rcfile, with keys sent from 20 ms to 2.5 s, both as a burst and one key per 10 ms. All 12 ran: the kernel echoes them during the rc file and readline replays them after the prompt. Nothing flushes stdin. The daemon's Session.write passes human input straight to the PTY; only Orca's own startup command waits for shell-ready.
Full remote path: renderer → remote-runtime transport → host daemon → PTY. With bash and zsh, a 1.5 s rc file, and keys typed right after bind or split across the bind, every valid round (26/26) ran the whole command.
CI history: every instance found predates fix(terminal): keep keys typed into a remounted remote pane before it re-attaches #34630. That PR showed the WSL "first terminal" in that test is really a remounted pane whose attach discarded held keys, and it fixed that. The SSH case is the same remount shape: it fails after switching back from the browser tab.
So I'm not adding a "hold input until the prompt" mechanism. It would delay every remote pane and fixes nothing that reproduces. Instead, this pins the guarantee in CI on Linux.
One deliberate drop remains and is out of scope: pre-bind typing is discarded in panes with startup work, or panes that may show an old terminal (the #10065 safety rule). That's tracked as a product question.
Flag-off: N/A. Test-only, with no feature flag and no product code change.
User risk: None. No shipped code changes. The risk is only CI flakiness, which the 5× Linux repeat below did not show.
Linked Issue
N/A. This is internal: the flag-on checklist item "keys typed after bind but before the remote shell's first prompt lose a prefix". Related: #34630.
Visual Proof
N/A. Test-only change.
Testing
Linux CI, repeated 5×. A single e2e.yml dispatch (run 40681220911) ran on a diag-only branch: this commit plus repeatEach: 5, with the WSL spec's non-terminal cases skipped to fit the job limit. All selected runs passed with no flakes:
changed-specs job: the WSL fake-transport terminal case 5/5, and this new spec 5/5;
managed-SSH Docker shards: ssh-orcad-terminal-browser-link 5/5, and ssh-orcad-terminal-journeys 15/15 (3 tests × 5), both using the helper without the prompt wait.
The diag branch has been deleted.
Locally on macOS (hidden, ORCA_BACKGROUND_LAUNCH=1, ORCA_E2E_WEB_CLIENT=1), the new spec passed 4/4.
pnpm tc and pnpm run typecheck:ci pass. So do oxlint on tests/e2e, the anti-slop lint, the ast-grep gates (flaky-test ratchet OK), check:process-host-imports and check:code-quality:changed.
AI Disclosure
Review
Agent skill upstream boundary
Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.
Notes
The other five ssh-orcad-* specs that use openTerminalTab (desktop-browser-bridge, terminal-reconnect-idle-frame, pairing-repair, sleep-disconnected, terminal-network-outage) were not in the 5× dispatch, so this PR's own CI covers them.
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)
…mpt reach the shell
Add a headless paired-host spec that types into each new remote terminal after
it binds while the host shell's rc file is still running, then requires the
whole command to run. Drop the managed-SSH helper's wait for a prompt before
typing, so those specs assert the same guarantee.
…an exactly once
The tty echo of the typed command must precede the rc file's own prompt, the
command's output must appear exactly once, and the rc wait outlasts the bind
wait. Throw if the host has no isolated HOME.
The terminal helper now proceeds after the terminal pane mounts, without waiting for a shell prompt. A new end-to-end test runs three rounds that submit a command while the shell is held in startup, then releases the shell and checks for the command output and echoed-command order.
Priority: Low
Merge Risk: Low · previous review 7f378
The test verifies input before the prompt, but a narrow timing window can leave the intended held-shell case unproven. This is a bounded test-coverage follow-up.
Pre-merge checks: 5
Check name
Status
Explanation
Title check
The title clearly identifies the main change: an end-to-end test for keys typed into a new remote terminal before its first prompt.
Description check
The description follows the repository template and explains the change, rationale, testing, scope, visual proof, and checklist status. It also references related issue #34630 and clearly identifies t…
Docstring Coverage
No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Description check
Explanation
The description follows the repository template and explains the change, rationale, testing, scope, visual proof, and checklist status. It also references related issue #34630 and clearly identifies this as an internal test-only change.
Full details: Docstring Coverage
Explanation
No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 2 files.
Finishing Touches
📝 Generate docstrings
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
105-110: Minor · Functional Correctness · Quick win
⚠️Unverified finding
Verification ran but could not confirm this finding. It is shown for review, not as a verified issue.
Assert the output in the rendered terminal.
paneText reads xterm's buffer, so this assertion can pass when the terminal does not render the output. Keep the exact-line buffer check if useful, but also assert the output through the terminal DOM or its accessibility tree. As per coding guidelines, “assert user-visible behavior through the DOM (getByRole, toBeVisible, toHaveText).” The repository has a terminal accessibility-text helper for that check. (raw.githubusercontent.com)
Source: Coding guidelines
Review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 9dcbbd7f-28f5-42ce-bbfa-1a95e46d59f0
Commits
Reviewing files that changed from the base of the PR and between 8866280 and 11d2775.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.
set -o pipefail
printf'%s\n''--- renderer runtime terminal path ---'
nl -ba src/renderer/src/runtime/web-runtime-terminal-creation.ts | sed -n '1,120p'
nl -ba src/renderer/src/runtime/web-runtime-terminal-create-operation.ts | sed -n '1,180p'printf'%s\n''--- local PTY launch plan ---'
nl -ba src/main/providers/local-pty-launch-plan.ts | sed -n '1,280p'printf'%s\n''--- shell launch plan ---'
nl -ba src/main/daemon/pty-subprocess/shell-launch-plan.ts | sed -n '1,150p'printf'%s\n''--- shell selection ---'
nl -ba src/main/daemon/shell-ready.ts | sed -n '1,150p'
Repository: stablyai/orca
Length of output: 38366
Script executed:
set -o pipefail
printf'%s\n''--- shell-ready bash branch and config ---'
nl -ba src/main/daemon/shell-ready.ts | sed -n '119,245p'printf'%s\n''--- daemon PTY subprocess launch ---'
nl -ba src/main/daemon/pty-subprocess.ts | sed -n '1,180p'printf'%s\n''--- local PTY spawn/readiness application ---'
nl -ba src/main/providers/local-pty-spawn.ts | sed -n '1,180p'
nl -ba src/main/providers/local-pty-shell-readiness-session.ts | sed -n '1,150p'
Repository: stablyai/orca
Length of output: 22742
Prove that the shell is still in the rc wait before typing.
paneIsBound only proves that the PTY is attached. The rc loop can finish after about 30 seconds, show PROMPT, and leave the release file absent. The test can then type the command, create the release file, and pass the output assertion without exercising pre-prompt input.
Emit a marker when the selected shell enters the wait, poll for that marker, and make the shell fail if the wait expires without the release file. The normal Unix path uses /bin/bash -l, so .bash_profile is normally read; the timeout remains a real detection gap.
Wait for a deterministic completion boundary before asserting one match.
The poll succeeds as soon as one output appears. The following paneText read does not wait for terminal output to settle. A duplicate execution whose output arrives later can therefore pass the test. Add a shell-side execution counter or another deterministic completion signal, then assert the exact count after that signal.
Review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: d628e401-7021-4e69-888e-1d2ccf7362f1
Commits
Reviewing files that changed from the base of the PR and between 11d2775 and 7f3784b.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review.
…d exactly-once proofs
The check that the typed line's tty echo precedes the rc file's prompt failed on
Linux CI 2 of 2 (run 40763469331): the pane began with the prompt and the typed
line followed it, while the command still ran exactly once. macOS echoes it during
the rc. Where the echo lands depends on when the host's line discipline sees the
bytes, which this test cannot pin; it is not evidence of loss. What the test keeps
proving: the keys were typed while the rc file still waited (release file absent),
the rc ran (its own PROMPT appears), and the command ran whole, exactly once.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ELI5
Orca's managed-SSH end-to-end tests used to wait for the remote shell to print its first prompt before typing into a new terminal. The helper's comment said keys typed earlier "can be lost, as they would be for a user too." I checked: on current main, keys typed into a new remote terminal before the prompt all reach the shell. This PR adds a test that pins that guarantee and removes the wait, so those SSH tests now check it too.
What Changed
New spec
tests/e2e/headless-paired-remote-terminal-early-typing.spec.ts. A headless paired host runs bash, whose.bash_profilewaits on a release file (bounded at about 30s). For each of 3 new remote terminals, the test:echo EARLY_TYPING_n_$((40+2))+ Enter;EARLY_TYPING_n_42output line.This is deterministic rather than timing-based: the keys always land while the rc file is still running. The release file starts present, because the host's own startup shell probe reads the same rc file.
Helper
openTerminalTab(tests/e2e/helpers/orcad-managed-workspace.ts) no longer waits for a prompt before returning.Test-only change. No product code changes.
Why
The "keys typed before the first prompt lose a prefix" checklist item was reported for WSL and SSH. I traced it layer by layer on main:
Session.writepasses human input straight to the PTY; only Orca's own startup command waits for shell-ready.So I'm not adding a "hold input until the prompt" mechanism. It would delay every remote pane and fixes nothing that reproduces. Instead, this pins the guarantee in CI on Linux.
One deliberate drop remains and is out of scope: pre-bind typing is discarded in panes with startup work, or panes that may show an old terminal (the #10065 safety rule). That's tracked as a product question.
Linked Issue
N/A. This is internal: the flag-on checklist item "keys typed after bind but before the remote shell's first prompt lose a prefix". Related: #34630.
Visual Proof
N/A. Test-only change.
Testing
Linux CI, repeated 5×. A single
e2e.ymldispatch (run 40681220911) ran on a diag-only branch: this commit plusrepeatEach: 5, with the WSL spec's non-terminal cases skipped to fit the job limit. All selected runs passed with no flakes:ssh-orcad-terminal-browser-link5/5, andssh-orcad-terminal-journeys15/15 (3 tests × 5), both using the helper without the prompt wait.The diag branch has been deleted.
Locally on macOS (hidden,
ORCA_BACKGROUND_LAUNCH=1,ORCA_E2E_WEB_CLIENT=1), the new spec passed 4/4.pnpm tcandpnpm run typecheck:cipass. So do oxlint ontests/e2e, the anti-slop lint, the ast-grep gates (flaky-test ratchet OK),check:process-host-importsandcheck:code-quality:changed.AI Disclosure
Review
Agent skill upstream boundary
Notes
The other five
ssh-orcad-*specs that useopenTerminalTab(desktop-browser-bridge, terminal-reconnect-idle-frame, pairing-repair, sleep-disconnected, terminal-network-outage) were not in the 5× dispatch, so this PR's own CI covers them.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)