Repository navigation
fix(agent-launch): re-press Enter while dsh's launchpad still holds the prompt - #33316
Conversation
86c4ebb to
ceb8940
Compare
…he prompt dsh-tui 0.17 paints its launchpad composer before its session opens and refuses Enter until then, keeping the draft, so a launch prompt sat in the launchpad after Orca's single Enter (#33227). Reuse the held-prompt resubmit loop instead of a parallel retry: dsh gets a 1 s cadence and a 30 s launch budget, and the draft reader now knows its boxed composer, so Enter repeats only while the launchpad visibly shows this prompt and never lands in the first-run guide that covers it once the session is ready. The input_accepted checkpoint now counts every Enter written. Co-authored-by: Xulin Wu <[email protected]>
ceb8940 to
de8c0f9
Compare
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 26 seconds. View limit details
Walkthrough
Priority: Severity of issue fixed: Medium Merge Risk:
|
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

Minor · Prevent the initial dsh Enter from reaching the first-run guide. · terminal-agent-prompt.ts:170
src/main/runtime/terminal/input/terminal-agent-prompt.ts:170
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winPrevent the initial dsh Enter from reaching the first-run guide.
agentPromptSubmitJoinsPasteFramereturns true only foromp, so dsh writes the paste and the initialAGENT_PROMPT_SUBMITseparately. The guide test feeds the guide screen during the paste callback, then expects one Enter. That Enter can therefore reach the visible guide.Use a guide-specific check before the initial dsh Enter. Do not treat a missing draft alone as proof that the guide is visible, because the blind initial submit remains necessary when the composer has not repainted. Change the guide test to expect zero Enters.

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:
a42fa57d-ef1b-4dea-b607-82d9f878e3ee
Files selected for processing: 13-
src/main/runtime/__fixtures__/dsh-tui-0.17/first-run-guide.meta.jsonsrc/main/runtime/__fixtures__/dsh-tui-0.17/first-run-guide.txtsrc/main/runtime/__fixtures__/dsh-tui-0.17/launchpad-draft-starting.meta.jsonsrc/main/runtime/__fixtures__/dsh-tui-0.17/launchpad-draft-starting.txtsrc/main/runtime/__fixtures__/dsh-tui-0.17/launchpad-empty.meta.jsonsrc/main/runtime/__fixtures__/dsh-tui-0.17/launchpad-empty.txtsrc/main/runtime/dsh-launch-prompt-resubmit.test.tssrc/main/runtime/terminal/input/terminal-agent-prompt-resubmit.tssrc/main/runtime/terminal/input/terminal-agent-prompt.tssrc/shared/agent-prompt-injection.tssrc/shared/terminal-composer-draft.tssrc/shared/tui-agent-config-types.tssrc/shared/tui-agent-config.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.
-
| return 0 | ||
| } | ||
| const config = TUI_AGENT_CONFIG[agent] | ||
| const launchMs = composerReady ? (config.submitRetryBudgetMs ?? 0) : 0 |
There was a problem hiding this comment.
🔎 Supported by static analysis
-
Script executed:
set -o pipefail printf '%s\n' '--- changed file diff ---' git diff --unified=80 75855c7ccd937b881de1cae37fb592873e20daad de8c0f95fbaeb245c6656820ffcf5ff190ec6a76 -- src/shared/agent-prompt-injection.ts printf '%s\n' '--- relevant symbols and callers ---' rg -n -F --glob '*.{ts,tsx}' -e 'getAgentPromptHeldSubmitBudgetMs' -e 'writeTerminalAgentPrompt' -e 'composerReady' src | head -240 printf '%s\n' '--- target file ---' nl -ba src/shared/agent-prompt-injection.ts | sed -n '1,240p'
Repository: stablyai/orca
Length of output: 28208
Script executed:
printf '%s\n' '--- prompt writer ---' nl -ba src/main/runtime/terminal/input/terminal-agent-prompt.ts | sed -n '1,240p' printf '%s\n' '--- dsh config and readiness ---' nl -ba src/shared/tui-agent-config.ts | sed -n '70,145p' nl -ba src/main/runtime/launched-agent-composer-readiness.ts | sed -n '1,100p' printf '%s\n' '--- launch method ---' nl -ba src/main/runtime/rpc/methods/agent-launch-terminal-prompt.ts | sed -n '120,210p' printf '%s\n' '--- dsh resubmit test ---' nl -ba src/main/runtime/dsh-launch-prompt-resubmit.test.ts | sed -n '1,220p' printf '%s\n' '--- prompt writer tests ---' rg -n -F --glob '*.{test,spec}.ts' -e 'heldSubmitBudget' -e 'composerReady: false' -e 'submitRetryBudgetMs' src/main src/shared
Repository: stablyai/orca
Length of output: 27703
Script executed:
printf '%s\n' '--- all sendTerminalAgentPrompt call sites ---' rg -n -F --glob '*.ts' -e 'sendTerminalAgentPrompt(' -e 'sendTerminalAgentPrompt:' src/main src/shared printf '%s\n' '--- dsh configuration ---' rg -n -C 12 -F --glob '*.ts' -e "dsh:" -e "'dsh'" src/shared/tui-agent-config.ts src/main printf '%s\n' '--- freshLaunch plumbing ---' rg -n -C 8 -F --glob '*.ts' -e 'freshLaunch' src/main/runtime src/main | head -260 printf '%s\n' '--- worker prompt contract ---' nl -ba src/main/runtime/rpc/methods/orchestration/worker/worker-start-prompt-contract.test.ts | sed -n '1,130p'
Repository: stablyai/orca
Length of output: 42153
Script executed:
printf '%s\n' '--- resubmit loop ---' nl -ba src/main/runtime/terminal/input/terminal-agent-prompt-resubmit.ts | sed -n '1,180p' printf '%s\n' '--- blocking wait ---' nl -ba src/main/runtime/rpc/methods/agent-launch-terminal-prompt.ts | sed -n '55,115p' printf '%s\n' '--- retry budget config entries ---' rg -n -C 4 -F --glob '*.ts' -e 'submitRetryBudgetMs' -e 'submitRetryDelayMs' src/shared/tui-agent-config.ts
Repository: stablyai/orca
Length of output: 10230
Keep dsh’s retry budget on reused launches.
The reused-terminal path passes freshLaunch: false, so writeTerminalAgentPrompt receives composerReady: false. With dsh, the zero budget makes resubmitHeldAgentPrompt return before it checks the held draft. A refused Enter can therefore leave the prompt unsent.
A fresh-launch readiness timeout returns before the writer, so this issue applies to reused launches rather than that timeout path.
Suggested fix
-
--- "a/src/shared/agent-prompt-injection.ts" +++ "b/src/shared/agent-prompt-injection.ts" @@ -87,7 +87,8 @@ return 0 } const config = TUI_AGENT_CONFIG[agent] - const launchMs = composerReady ? (config.submitRetryBudgetMs ?? 0) : 0 + const launchMs = + composerReady || agent === 'dsh' ? (config.submitRetryBudgetMs ?? 0) : 0 const pasteBurstMs = platform === 'win32' && config.windowsInputRecordPasteNewline ? pastePayload.length * WINDOWS_INPUT_RECORD_PASTE_MS_PER_CHAR
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 changeconst launchMs = composerReady ? (config.submitRetryBudgetMs ?? 0) : 0 const launchMs = composerReady || agent === 'dsh' ? (config.submitRetryBudgetMs ?? 0) : 0
…cad bundle Box-drawing characters in regex literals reached the minified orcad entry, which must stay ASCII; build them with String.raw \u escapes instead.
…ker's first dispatch (#33499) dsh worker dispatches (and other dsh agent-prompt sends) now get #33316's bounded Enter retry: dsh paints its launchpad before its session opens and refuses the first Enter with "still starting", so a fresh worker's task sat unsent. The retry only re-presses while the launchpad still holds the same prompt and stops once a turn starts. Fixes #30778 Co-authored-by: Jinwoo Hong <[email protected]>
ELI5
When Orca starts DeepSeek Harness (dsh) with a task, it pastes the task into dsh's opening screen (the "launchpad") and presses Enter. dsh draws that screen before its session has opened. Until the session opens it ignores Enter, shows "still starting — press Enter to send once it is ready", and leaves the text where it is. So the task just sat there.
Now Orca checks again about once a second. While the launchpad still shows this task and no turn has started, it presses Enter again. It never pastes twice, and it stops as soon as dsh starts the turn. It also stops when the launchpad is no longer on screen, for example when dsh's first-run guide covers it.
Stacked on #33295. This PR reuses #33295's held-prompt resubmit loop instead of adding a second retry mechanism. Merge #33295 first; GitHub then retargets this PR to
main.Root cause (upstream refs)
@deepseek-harness-tui/dsh-tui0.17.0 (npm tarball):lib/types/screens/Chat.js:2509-2514refusedAtStartup: whilechannel.ready === false, a plain-text submit gets thestartup-not-readynotice and is refused.lib/types/i18n.js:375is the notice text ("… is still starting — press Enter to send once it is ready").lib/types/screens/Chat.js:601-605: the first-run guide (onboardingOnBoot) is held untilreadyand then opens over the launchpad.lib/types/onboardingPrefs.js:105offers the guide whenever~/.dsh-tui/onboarding.jsonis missing.lib/types/screens/Launchpad.js:834-842: the launchpad composer is aborderStyle: "round"box with a❯prefix. Its placeholder (launchpad-placeholder) sits right of the caret. Orca's generic draft reader did not recognize that boxed shape.The
dsh-composer-promptsignal means the composer is ready for a paste. It does not mean dsh will accept Enter yet. dsh exposes no byte-level signal for submit-ready. Its only turn-start evidence is the title andOSC 7501;state=working:app=dsh-tui.Review of #33229 (why this replaces it)
#33229 (by @wuuli) found the right root cause, and its idea of re-pressing only Enter is correct. Two problems remain:
submitRetryUntilTurnStartand its own loop next tosubmitRetryDelayMs/resubmitAgentPromptAfterRetryDelay, which fix(agent-prompt): press Enter again while a Windows Codex composer still holds a dispatch #33295 rewrites intoresubmitHeldAgentPrompt. The two PRs conflict on the same lines and would leave two parallel Enter-retry policies.What changed
tui-agent-config: dsh getssubmitRetryDelayMs: 1000plus a newsubmitRetryBudgetMs: 30_000, which only applies to a launch into a composer Orca just saw ready.getAgentPromptHeldSubmitBudgetMs: returns the larger of the Windows paste-burst budget and the launch budget, still capped atAGENT_PROMPT_EFFECT_TIMEOUT_MS.terminal-composer-draft: recognizes a boxed single-line❯composer (╭─╮above│ ❯ text │). The draft is the text left of the cursor, so the empty launchpad's placeholder does not count. As a result,#33295'sisHeldAgentPromptDraftgate also works for dsh.resubmitHeldAgentPrompt: for dsh there is no blind first retry, because the draft reader can see its launchpad. If the draft is gone, it stops right away instead of waiting out the budget, because dsh paints its draft immediately.input_acceptedcheckpointbytesWrittennow counts every Enter (from fix(agent-launch): submit dsh launch prompts once its launchpad is live #33229).autohandconfig compacted to one line to stay under the 300-line cap (as fix(agent-launch): submit dsh launch prompts once its launchpad is live #33229 did).How verified
OrcaRuntimeService+ node-pty runningdsh-tui .0.17.0 / dsh 0.2.1-rc.2, isolated HOME/DSH_HOME, macOS arm64):Enter #1→resolved accepted=true→enters=1 turnStarted=false(task left in launchpad).Enter #2about 1 s later, thenOSC state=working, and no further Enter.enters=1; the guide is up and no Enter reached it.dsh-launch-prompt-resubmit.test.tsreplays three real dsh-tui 0.17 captures (launchpad holding the draft while starting, first-run guide, empty launchpad) through the real runtime. The first test fails on fix(agent-prompt): press Enter again while a Windows Codex composer still holds a dispatch #33295 alone.pnpm tc,pnpm run check:code-quality:changed, and 128 related test files (2418 tests, incl. serializer transcript replay, composer-draft, prompt-submission, launch-prompt specs) pass.Risk
╭───╮directly above│ ❯ textwith a visible cursor. If it does, that text is a typed draft anyway. The empty and placeholder cases return null, so the IME placeholder mask is unchanged.❯with the text indraft, as other agents' drafts already do.input_accepted.\rand the draft reader are transport-independent.acceptedwhile the guide is up, and the reuse timeout) is not addressed here.Fixes #33227
Related: #29131, supersedes #33229
Co-authored-by: Xulin Wu (@wuuli)