Skip to content

fix(terminal): keep keys typed into a starting agent pane as an unsubmitted draft - #33315

Merged
nwparker merged 5 commits into
mainfrom
nwparker/agent-pane-pre-ready-draft
Oct 25, 2026
Merged

nwparker merged 5 commits into
mainfrom
nwparker/agent-pane-pre-ready-draft

Conversation

@nwparker

@nwparker nwparker commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​520 $\color{#cf222e}{\Huge{\mathbf{−}}}$​4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​516
Prod 8 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​247 $\color{#cf222e}{\Huge{\mathbf{−}}}$​33 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​214

ELI5

If you type into an agent pane while the agent is still starting, Orca now keeps what you typed. Once the agent is ready, the text appears in its input box as a draft, not sent. Before this change, those keys were thrown away.

What Changed

Before: in an agent pane (Claude, Codex and similar), keys typed before the terminal existed were dropped. In one captured run, the first agent spawn after a reload took 30 s. Everything typed in that window was lost.

After:

  • Keys typed into an agent pane before its terminal binds are kept as a draft.
  • Once the agent reports ready, the draft is pasted into its composer, unsubmitted. The user reviews it and presses Enter themselves.
  • What's kept: printable text. Backspace deletes the last character.
  • What's dropped: Enter, Tab, Ctrl+C, Esc, arrow keys and other control keys, so nothing submits, interrupts or edits on the user's behalf.
  • Agent never ready: if the agent doesn't report ready within its usual draft-paste timeout, the text is dropped. The existing "wasn't sent — paste it once the agent is ready" notice appears.
  • Pane closed: the draft is discarded.
  • The first bind isn't a fresh spawn: the draft is dropped with the notice instead of pasted. An attach can land on a shell before main types the agent's launch line, and pasting there would put the draft in front of that command.
  • The first bind is a reattach result: the draft is discarded. A cold restore can reach a bare shell that --resume is typed into next.
  • Only keys typed before the first bind are held. The first bind ends capture for good. If the pane later becomes unbound (the process exits or hibernates, or a paired server re-attaches), keys go down today's path, where the host may hold and deliver them itself.
  • Pastes: a pasted chunk keeps its line breaks as single spaces.
  • Keys typed after the terminal binds always go live, exactly as today. They are never added to the draft, so the user can always answer a trust or permission prompt that's on screen.
  • When the draft is dropped instead of pasted: if the user has typed anything since the bind, or the agent-status store (owned by the hook server) shows the pane blocked or waiting, the draft is dropped with the notice. That way it's never pasted over a screen the user is driving or a prompt waiting for an answer.

Things that stay the same:

  • Startup-command panes that don't run an agent (setup scripts, issue commands) keep today's behaviour: keys typed before the terminal exists are dropped.

Mechanism:

  • Capture: new agent-pre-ready-typed-draft.ts. forwardPtyInput hands it user keystrokes before they reach the transport.
  • Delivery: reuses the existing agent draft path:
    • waitForAgentDraftInputReady, with each agent's ready signal and timeout;
    • sendAgentDraftPasteContent for the bracketed paste;
    • createPasteReadinessTimeoutNotice for the drop notice.
  • When it applies: the same startup-work check fix(terminal): keep keys typed before a pane's terminal exists #33281 uses, which covers a startup command, a sleeping or live-entry resume, or a main-owned start. The agent comes from the pane's launch agent or the resume source.
  • Start: delivery starts from the existing bind chokepoint (bindActivePanePty).
  • Launch drafts: if the pane also has a launch-time draft that hasn't been pasted yet, the typed text is appended to it, so both arrive as one draft in typing order.

Split-handoff race (follow-up from #33281): a deferred split with startup work used to hold keys in the transport. The transport would flush them at bind, which is ahead of the startup command. Now:

  • a deferred split with startup work no longer arms the transport hold;
  • the handed-off keys no longer reach the transport as a seed, because a seed alone arms the hold;
  • for an agent split, the handed-off keys become the draft instead;
  • the flush-time recheck from fix(terminal): keep keys typed before a pane's terminal exists #33281 now applies to deferred splits as well, so a split's held keys are dropped if startup work appears before the bind;
  • a deferred split without known startup work still holds keys under the layout-owner build, as on main.

No current path creates a split with both an inherited working directory and startup work, so this race is closed rather than one that was firing.

Why

Reusing the launch-draft readiness and paste path means typed text uses the same ready signals, timeouts, paste chunking and notice that launch drafts already rely on. Delivering keys raw after readiness would let a stray Enter submit a half-typed prompt. Dropping everything silently is today's bug. An unsubmitted draft keeps what the user typed and leaves the decision to send with them.

Linked Issue

N/A (internal). Follow-up to #33281, which is merged.

Visual Proof

Screenshots from the manual run, described in Testing. Not attached here.

Testing

  • New agent-pre-ready-typed-draft.test.ts covers:

    • the text filter (control keys, Backspace, the size limit);
    • the draft pasted unsubmitted once the agent is ready;
    • the draft dropped with a notice when the agent never reports ready;
    • live input left alone when nothing was held;
    • keys typed after the bind going live, with the draft dropped;
    • a trust prompt during startup: the pane is blocked, the user's 1 and Enter go live, and the draft is never pasted;
    • the draft dropped when the agent is waiting on a prompt at ready time;
    • after a bind with nothing typed and then an unbind, typed keys reach sendInput and a later bind pastes nothing;
    • a reattach-result first bind discards the draft, and a later fresh spawn doesn't receive it;
    • a first bind that isn't a fresh spawn drops the draft with the notice;
    • line breaks inside a pasted chunk become single spaces;
    • a paired-server agent pane resuming a live entry delivers keys typed before reattach through its own transport, Ctrl+C included;
    • the draft discarded on close;
    • keys handed off to a remounted agent split becoming the draft;
    • a non-agent startup pane unchanged.

    The three core capture tests fail when the capture is disabled. The three post-bind tests fail if keys typed after the bind are added to the draft.

  • Manual run (hidden dev build, ORCA_BACKGROUND_LAUNCH=1, CDP, isolated profile). To make the spawn slow, I paused this test instance's own terminal host process for a few seconds:

    • Codex: I typed fix the flaky test + Enter while the tab had no terminal. The text showed up in Codex's composer, not submitted.
    • Claude: draft before bind showed up in Claude's composer, not submitted.
    • Claude, typing after the bind: I typed prebind before the bind and LIVE right after it. LIVE reached Claude's composer, and the held text was not pasted.
    • Not covered manually: I couldn't bring up a real trust prompt; Claude runs with bypass permissions here, so it doesn't show one. That case is covered by the unit test. I also didn't see the toast in the screenshot, which was taken about 12 s later.
  • pty-connection-preconnect-input.test.ts:

    • a deferred split with startup work no longer holds keys in the transport;
    • a deferred split without it still holds keys under the layout-owner build.
  • pnpm tc, check:code-quality:changed and the full terminal-pane suite pass. One load-sensitive file timed out in the full run and passes on its own.

  • Also moved two grid readers from pty-input-forward.ts to read-pane-size.ts, with no logic change, to keep the file under its line limit.

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

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

  • Ordering: live keys typed after the bind can arrive before the draft would have. That's why the draft is dropped, not pasted, once the user has typed live.
  • Not covered: pastes made before the bind go through the paste writer, not keystroke forwarding, so they are still dropped as today.
  • Paired-server panes are excluded. Their own transport already holds type-ahead during reattach and delivers it, Ctrl+C included, so their behaviour is unchanged. SSH panes use the local transport and are covered.

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)

@coderabbitai

coderabbitai Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Walkthrough

The change adds pre-bind typed-draft capture for eligible agent panes. The session filters and bounds captured text, then delivers or discards it after PTY binding based on readiness and session state. Transport options use startup-work detection to determine whether input is held before connection. Tests cover draft handling and deferred-split input behavior.

Priority: Normal

Merge Risk: Moderate · up to 113a0

Handed-off text can disappear during startup or remount. Preserve it without sending it ahead of startup work before merging.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 42.11% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 19 functions across 15 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the primary change: preserving keys typed into a starting agent pane as an unsubmitted draft.
Description check Passed The description is detailed and covers the user impact, implementation, rationale, linked follow-up issue, testing, limitations, and compatibility considerations. Visual attachments and some checklist…
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.
Full details: Description check

Explanation

The description is detailed and covers the user impact, implementation, rationale, linked follow-up issue, testing, limitations, and compatibility considerations. Visual attachments and some checklist items are incomplete, but the required information is otherwise mostly present.

Finishing Touches: 💡 1
📝 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.

❤️ Share

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

@nwparker
nwparker force-pushed the nwparker/agent-pane-pre-ready-draft branch from dcd3566 to f8a7e67 Compare October 25, 2026 00:25

@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: 2


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: 56595639-b356-4c83-852d-6bd5bd1482ee
Commits

Reviewing files that changed from the base of the PR and between c4c41ac and dcd3566b27b8fae9a685c4a1e77fee80f5af240c.

Files selected for processing: 13
  • src/renderer/src/components/terminal-pane/agent-pre-ready-typed-draft.test.ts
  • src/renderer/src/components/terminal-pane/pty-connection-preconnect-input.test.ts
  • src/renderer/src/components/terminal-pane/pty-connection/agent-pre-ready-typed-draft.ts
  • src/renderer/src/components/terminal-pane/pty-connection/cold-restore-resume-startup.ts
  • src/renderer/src/components/terminal-pane/pty-connection/connect-pane-pty.ts
  • src/renderer/src/components/terminal-pane/pty-connection/pane-pty-visibility-bind.ts
  • src/renderer/src/components/terminal-pane/pty-connection/pane-transport-options.ts
  • src/renderer/src/components/terminal-pane/pty-connection/pty-input-forward.ts
  • src/renderer/src/components/terminal-pane/pty-connection/read-pane-size.ts
  • src/renderer/src/components/terminal-pane/pty-connection/run-deferred-connect.ts
  • src/renderer/src/components/terminal-pane/pty-connection/session-reconcile-dispose.ts
  • src/renderer/src/components/terminal-pane/pty-transport-input-write.test.ts
  • src/renderer/src/components/terminal-pane/pty-transport-types.ts

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

Comment on lines +89 to +91
if (wasUserInput) {
draft = appendTypedDraftText(draft, data, PTY_PRECONNECT_INPUT_MAX_CODE_UNITS)
}

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.

Minor · Data Integrity & Integration · Quick win

🔎 Supported by static analysis

Script executed:

#!/bin/bash
# Find producers and consumers of the remount handoff.
rg -nP -C4 'onPreconnectInput|PtyPreconnectInputEntry' src/renderer/src --type=ts -g '!**/*.test.ts'

Repository: stablyai/orca

Length of output: 23043


Script executed:

set -o pipefail
printf '%s\n' '--- agent-pre-ready-typed-draft.ts ---'
nl -ba src/renderer/src/components/terminal-pane/pty-connection/agent-pre-ready-typed-draft.ts
printf '%s\n' '--- terminal-pane-pane-created.ts relevant block ---'
nl -ba src/renderer/src/components/terminal-pane/terminal-pane-pane-created.ts | sed -n '130,225p'
printf '%s\n' '--- pane-transport-options.ts ---'
nl -ba src/renderer/src/components/terminal-pane/pty-connection/pane-transport-options.ts | sed -n '1,80p'
printf '%s\n' '--- deferred-split-pane-handoff.ts ---'
nl -ba src/renderer/src/components/terminal-pane/deferred-split-pane-handoff.ts | sed -n '1,240p'
printf '%s\n' '--- draft installation and disposal references ---'
rg -n -F --glob '*.ts' -e 'installAgentPreReadyTypedDraft' -e 'discardAgentPreReadyDraft' -e 'captureAgentPreReadyInput' -e 'dispose()' src/renderer/src/components/terminal-pane/pty-connection src/renderer/src/components/terminal-pane | head -200

Repository: stablyai/orca

Length of output: 41236


Script executed:

set -o pipefail
printf '%s\n' '--- session-reconcile-dispose.ts ---'
nl -ba src/renderer/src/components/terminal-pane/pty-connection/session-reconcile-dispose.ts | sed -n '135,165p'
printf '%s\n' '--- deferred-split-pane-handoff.ts append/claim/release ---'
nl -ba src/renderer/src/components/terminal-pane/deferred-split-pane-handoff.ts | sed -n '90,230p'
printf '%s\n' '--- handoff creation/claim references ---'
rg -n -C5 -F --glob '*.ts' -e 'beginDeferredSplitPaneHandoff' -e 'claimDeferredSplitPaneHandoff' -e 'handoffForInput' src/renderer/src/components/terminal-pane

Repository: stablyai/orca

Length of output: 43555


Script executed:

set -o pipefail
printf '%s\n' '--- deferred-split-pane-handoff.ts lifecycle ---'
nl -ba src/renderer/src/components/terminal-pane/deferred-split-pane-handoff.ts | sed -n '77,240p'
printf '%s\n' '--- all deferred handoff lifecycle references ---'
rg -n -C6 -F --glob '*.ts' -e 'beginDeferredSplitPaneHandoff' -e 'claimDeferredSplitPaneHandoff' -e 'appendDeferredSplitPaneInput' -e 'clearDeferredSplitPaneHandoff' -e 'releaseDeferredSplitPaneHandoff' src/renderer/src/components/terminal-pane

Repository: stablyai/orca

Length of output: 41735


Forward captured agent draft input to the deferred split handoff.

For a deferred agent split, captureAgentPreReadyInput consumes user input and stores it only in the session closure. A whole-tab remount releases the handoff, but disposal clears the closure-local draft. The next session can restore only entries recorded through onPreconnectInput.

Suggested fix
--- "a/src/renderer/src/components/terminal-pane/pty-connection/agent-pre-ready-typed-draft.ts"
+++ "b/src/renderer/src/components/terminal-pane/pty-connection/agent-pre-ready-typed-draft.ts"
@@ -86,9 +86,10 @@
     if (phase !== 'capturing') {
       return false
     }
     if (wasUserInput) {
       draft = appendTypedDraftText(draft, data, PTY_PRECONNECT_INPUT_MAX_CODE_UNITS)
+      session.deps.onPreconnectInput?.({ data, kind: 'ordinary', inputKind: 'driving' })
     }
     // Pre-bind focus reports have no terminal to reach.
     return true
   }

Comment on lines +146 to +150
if (!freshSpawn) {
// A reattached agent is already running; its composer takes the draft now.
void pasteDraft(ptyId, draftAgent)
return
}

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.

Minor · Functional Correctness · Quick win

🔎 Supported by static analysis

Script executed:

#!/bin/bash
# Find every caller of bindActivePanePty and every writer of spawnedFreshPtyId.
rg -nP -C4 '\bbindActivePanePty\s*\(' src/renderer/src/components/terminal-pane --type=ts -g '!**/*.test.ts'
rg -nP -C3 'spawnedFreshPtyId' src/renderer/src/components/terminal-pane --type=ts -g '!**/*.test.ts'
# Check how the cold-restore path binds and whether it uses onPtySpawn.
rg -nP -C4 'buildColdRestoreAgentResumeStartup|coldRestore' src/renderer/src/components/terminal-pane/pty-connection --type=ts -g '!**/*.test.ts'

Repository: stablyai/orca

Length of output: 41326


Script executed:

set -eu
printf '%s\n' '--- draft flow ---'
sed -n '1,240p' src/renderer/src/components/terminal-pane/pty-connection/agent-pre-ready-typed-draft.ts
printf '%s\n' '--- bind implementation and interface references ---'
rg -n -F --glob '*.ts' -e 'bindActivePanePty:' -e 'bindActivePanePty =' -e 'bindActivePanePty(' -e 'onAgentPreReadyDraftPtyBound' src/renderer/src/components/terminal-pane/pty-connection
printf '%s\n' '--- cold restore startup and bind-related flow ---'
sed -n '220,330p' src/renderer/src/components/terminal-pane/pty-connection/apply-reattach-payload.ts
sed -n '1,180p' src/renderer/src/components/terminal-pane/pty-connection/cold-restore-resume-startup.ts
sed -n '1,240p' src/renderer/src/components/terminal-pane/pty-connection/reattach-result-handler.ts
printf '%s\n' '--- transport bind callbacks ---'
rg -n -P -C6 'onPtySpawn|onPtyReady|bindActivePanePty|coldRestore' src/renderer/src/components/terminal-pane/pty-connection/pty-transport.ts src/renderer/src/components/terminal-pane/pty-connection/deferred-session-reattach-connect.ts

Repository: stablyai/orca

Length of output: 40011


Script executed:

set -eu
printf '%s\n' '--- reattach result continuation ---'
sed -n '220,520p' src/renderer/src/components/terminal-pane/pty-connection/reattach-result-handler.ts
printf '%s\n' '--- transport files and bind callbacks ---'
rg --files src/renderer/src/components/terminal-pane | rg 'pty-transport|transport'
rg -n -P -C8 'onPtySpawn|bindActivePanePty|callbacks.*spawn|spawn.*callback' src/renderer/src/components/terminal-pane --glob '*.ts' --glob '!*.test.ts'
printf '%s\n' '--- startup delivery symbols ---'
rg -n -P -C8 'applyColdRestoreAgentResumeStartup|schedulePendingStartupCommandDelivery|pendingStartupCommand|startupCommand' src/renderer/src/components/terminal-pane/pty-connection --glob '*.ts' --glob '!*.test.ts'

Repository: stablyai/orca

Length of output: 42331


Script executed:

set -eu
printf '%s\n' '--- pane bind implementation ---'
sed -n '1,210p' src/renderer/src/components/terminal-pane/pty-connection/pane-pty-visibility-bind.ts
printf '%s\n' '--- renderer transport connect contract ---'
sed -n '1,300p' src/renderer/src/components/terminal-pane/pty-transport.ts
printf '%s\n' '--- connect option types and IPC implementation references ---'
rg -n -P -C8 'interface.*Connect|type.*Connect|connect\(|command\??:|startupCommandDelivery|coldRestore' src/renderer/src/components/terminal-pane/pty-transport-types.ts src/main src/renderer/src/components/terminal-pane --glob '*.ts' --glob '!*.test.ts' | head -n 500

Repository: stablyai/orca

Length of output: 41527


Script executed:

set -eu
printf '%s\n' '--- IPC connect implementation ---'
sed -n '1,360p' src/renderer/src/components/terminal-pane/ipc-pty-connect.ts
printf '%s\n' '--- connect option declarations ---'
sed -n '1,260p' src/renderer/src/components/terminal-pane/pty-transport-types.ts
printf '%s\n' '--- direct connect call sites ---'
rg -n -P -C10 'connectIpcPty\(|coldRestore:|onPtySpawn\?\.' src/renderer/src/components/terminal-pane src/main/ipc --glob '*.ts' --glob '!*.test.ts'

Repository: stablyai/orca

Length of output: 42795


Script executed:

set -eu
printf '%s\n' '--- fresh-spawn bind caller ---'
sed -n '180,260p' src/renderer/src/components/terminal-pane/pty-connection/fresh-spawn-start.ts
printf '%s\n' '--- deferred reattach-choice bind callers ---'
sed -n '90,220p' src/renderer/src/components/terminal-pane/pty-connection/deferred-session-reattach-choice.ts
printf '%s\n' '--- cold-restore reattach binding block ---'
sed -n '210,300p' src/renderer/src/components/terminal-pane/pty-connection/reattach-result-handler.ts

Repository: stablyai/orca

Length of output: 14644


Script executed:

set -eu
printf '%s\n' '--- fresh spawn startup construction ---'
sed -n '1,230p' src/renderer/src/components/terminal-pane/pty-connection/fresh-spawn-start.ts
printf '%s\n' '--- spawn request construction ---'
sed -n '1,300p' src/renderer/src/components/terminal-pane/ipc-pty-spawn-request.ts
printf '%s\n' '--- host spawn API consumers ---'
rg -n -P -C10 'spawnPty|coldRestore|commandDelivery|startupCommandDelivery|resumeProviderSession' src/main/ipc src/main --glob '*.ts' | head -n 500

Repository: stablyai/orca

Length of output: 42161


Script executed:

set -eu
printf '%s\n' '--- command delivery and cold-restore host paths ---'
rg -l -P 'commandDelivery|startupCommandDelivery|coldRestore' src/main/ipc src/main/pty src/main/runtime src/main --glob '*.ts' --glob '!*.test.ts' | sort -u | head -n 120
printf '%s\n' '--- focused definitions and handlers ---'
rg -n -P -C12 'commandDelivery|startupCommandDelivery|coldRestore' src/main/ipc/pty src/main/ipc src/main/runtime --glob '*.ts' --glob '!*.test.ts' | head -n 800

Repository: stablyai/orca

Length of output: 42376


Wait for agent readiness after a cold restore.

A cold-restore result skips onPtySpawn, then the fallback bind calls bindActivePanePty. This sets freshSpawn to false, so pasteDraft runs without waitForAgentDraftInputReady.

Treat a cold-restore bind with resume startup as a fresh startup for draft delivery. The resume command is passed to the spawn request before the bind, so the issue is not proven to be draft text preceding the command itself. The draft can still be sent while the resumed agent is initializing.

@nwparker
nwparker force-pushed the nwparker/agent-pane-pre-ready-draft branch from f8a7e67 to d520406 Compare October 25, 2026 01:33

@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
  • 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: 6bb68d01-9942-4d99-a713-ccda5af6f7e4
Commits

Reviewing files that changed from the base of the PR and between d520406 and 113a0c2.

Files selected for processing: 6
  • src/renderer/src/components/terminal-pane/agent-pre-ready-typed-draft.test.ts
  • src/renderer/src/components/terminal-pane/pty-connection-preconnect-input.test.ts
  • src/renderer/src/components/terminal-pane/pty-connection/agent-pre-ready-typed-draft.ts
  • src/renderer/src/components/terminal-pane/pty-connection/pane-pty-visibility-bind.ts
  • src/renderer/src/components/terminal-pane/pty-connection/pane-transport-options.ts
  • src/renderer/src/components/terminal-pane/pty-connection/reattach-result-handler.ts

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

if (isDeferredSplitInputHold(session)) {
return true
// Why not mainStartsPane: a deferred split keeps holding under the layout-owner build, as before.
return !paneHasKnownStartupWork(session)

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.

Major · Data Integrity & Integration · Heavy lift

🔎 Supported by static analysis

Script executed:

sed -n '1,115p' src/renderer/src/components/terminal-pane/pty-connection/pane-transport-options.ts
rg -n 'preconnectInput|paneHasStartupWork|onPreconnectInput' src/renderer/src/components/terminal-pane/pty-connection src/renderer/src/components/terminal-pane/pty-connection-preconnect-input.test.ts

Repository: stablyai/orca

Length of output: 8063


Script executed:

sed -n '1,140p' src/renderer/src/components/terminal-pane/pty-connection/agent-pre-ready-typed-draft.ts
echo '--- preconnect consumers ---'
rg -n -F --glob '*.ts' -e 'onPreconnectInput' -e 'preconnectInput' -e 'bufferInputUntilConnect' -e 'releasePreconnectInput' src/renderer/src src/shared src/main || test "$?" -eq 1

Repository: stablyai/orca

Length of output: 20643


Keep handed-off input for non-agent startup splits.

Restoring the hold for this case would send the seed to the shell before its startup command, so the seed needs a different delivery path. For a deferred split with a non-agent paneStartup and a non-empty preconnectInput, holdsInputUntilConnect returns false. buildPaneTransportOptions then omits preconnectInput. No other code reads session.deps.preconnectInput for this case, so the handed-off text is dropped without a notice. Before this change, deferred splits held this input and flushed it at bind.

Do not restore the hold as-is. The held seed would flush before the non-agent startup work, which is the ordering problem the comment at pane-transport-options.ts lines 26-30 describes. Deliver the seed through a path that runs after the startup work, or preserve it some other way that keeps the launch order.

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