Repository navigation
Conversation
A fresh `--agent dsh --prompt` launch pasted the task into dsh-tui's launchpad and pressed Enter 50 ms later, but the launchpad draws its `❯` before the startup session opens: Enter in that window is refused with "still starting — press Enter once it is ready" and the draft stays. The launch still reported `handed-to-terminal`, so the task sat in the input box and no turn ever started. dsh now declares a submit-retry policy: after a fresh launch's Enter, wait for a turn start and repeat only Enter (never the paste) until the turn starts or the budget ends. Measured against dsh-tui 0.17.0 / dsh 0.2.1-rc.2: Enter at +50…800 ms after the glyph is dropped, +1000…1300 ms submits, so a fixed sleep would either miss slow starts or add latency to fast ones. The compacted autohand entry keeps tui-agent-config.ts inside the 300-line oxlint cap.
Review findings on the dsh submit retry: - The guard ahead of a retry Enter is async. Re-check cancellation, generation, binding and activity after it returns, and stop when a turn already started or a dialog is up, so an obsolete request cannot type into the pane. - The input-accepted checkpoint now counts every retry Enter, matching the final receipt's byte count. - Tests cover a cancellation and a turn start that land while the guard is pending, plus the checkpoint bytes.
A hook's working timestamp can arrive without a title working edge. Apply the verifier's full turn-start predicate after the retry guard, including explicitWorkingStartedAt and a status flip, and cover each evidence form plus the redraw case in a focused unit test.
|
No actionable comments were generated in the recent review.
|
|
@nwparker @brennanb2025 — would you be the right reviewers for this one? It touches the dsh readiness signal you added ( Short version: Two asks:
Happy to adjust the mechanism if you'd prefer this as a dsh-specific submit signal instead of a retry loop. |
|
Thanks @wuuli! Your diagnosis (dsh refusing Enter while its session starts) landed via #33316 (credited with Co-authored-by). It reuses the shared resubmit loop from #33295 instead of a second retry mechanism, and only re-presses while the launchpad still shows the prompt, so it never presses Enter into dsh's first-run guide. Closing as superseded. |
…he prompt (#33316) DSH: Orca re-presses Enter (up to a 30s launch budget) while dsh's launchpad still visibly holds the launch prompt — dsh refuses Enter while its session is starting — and stops as soon as the prompt leaves the screen, so no Enter reaches the first-run guide. The shared draft reader recognises dsh's boxed launchpad composer. Fixes #29131, #33227. Supersedes #33229. Co-authored-by: Xulin Wu <35489799+wuuli@users.noreply.github.com>
ELI5
When Orca starts a DeepSeek Harness (dsh) agent with a task, it types the task into the agent's opening screen and presses Enter about 50 ms later. But that opening screen is still booting its session at that moment, so it ignores the Enter and keeps the text. Nothing tells Orca that, so Orca says "task handed over" and walks away; the task waits in the box until a human presses Enter.
This PR makes Orca keep pressing Enter (only Enter — never paste the task again) until the agent actually starts working, for a bounded time.
What Changed
Before:
orca worktree create --agent dsh --prompt "<task>" --surface terminal(andorca agent launch --agent dsh --prompt ...) pasted the task into the dsh-tui launchpad and wrote one Enter 50 ms later. dsh-tui 0.17.0 draws its❯composer glyph ~1 s before its startup session is live, refuses Enter in that window with its own "still starting — press Enter to send once it is ready" notice, and keeps the draft. No DSH session, no turn, task stuck in the input box; the launch reply still saidhanded-to-terminal.After: a fresh dsh launch observes for a turn start after the first Enter; while none is observed it re-sends only
\r, up to a bounded budget, and stops the moment the turn starts (title working edge, hook working timestamp, or status flip), a permission dialog appears, or the pane generation/binding changes. The task is pasted exactly once.Mechanism:
TuiAgentConfig.submitRetryUntilTurnStart+dsh: { intervalMs: 500, attempts: 10 }(≈5.5 s budget, 2–3 Enters on a normal boot).launch-prompt-submit-retry.ts: the retry loop, the full turn-start predicate, and the per-agent policy lookup.terminal-agent-prompt.ts: wires it into thecomposerReady(fresh launch) path after the first Enter; retry Enters count insubmitsand therefore inbytesWritten/theinput_acceptedcheckpoint.verifyAgentPromptSubmissionlifecycle oracle the runtime already uses.tui-agent-config.ts: theautohandentry was compacted to one line to stay inside the repo's 300-line oxlint cap (no behavior change).Why
Root cause was measured, not guessed, against the installed
dsh-tui0.17.0 /dsh0.2.1-rc.2 with a real PTY running the exact launch write (bracketed paste, then Enter 50 ms later). Single-Enter thresholds after the❯glyph:❯The existing
dsh-composer-promptsignal is a paste-ready marker; there is no dsh byte-level submit-ready marker to wait for (its readiness is an in-process session open, surfaced only as UI text). A fixed sleep would either miss slow boots or delay fast ones, and re-pasting the task risks a duplicate turn. Retrying the one key dsh itself tells the user to press, and stopping on an observed turn start, is the smallest mechanism that is both adaptive and duplicate-free.submitPasteReadySignalwas evaluated and has no dsh equivalent; worker dispatch/reused-pane/desktop-draft paths have different readiness handling and are intentionally out of scope (see Notes).Linked Issue
Fixes #33227
Related: #29131 (same class — DSH input reported accepted before its composer is ready).
Visual Proof
N/A — no UI change. The behavior is a PTY timing fix; evidence is in the issue (real launch receipts plus a probe transcript).
Testing
src/main/runtime/terminal/input/dsh-launch-prompt-submit.test.tsdrives the real runtime writer/title parser: retries until turn start (3 Enters, 1 paste), stops at the budget, single Enter for an agent without the policy, long 40-line task pasted once, checkpoint bytes match the retry count, and no retry Enter when a cancellation or a turn start lands while the write guard is pending.launch-prompt-submit-retry.test.tscovers every turn-start evidence form (title edge, hook timestamp, status flip) and rejects redraws/already-working baselines.pnpm teston the touched suites: 47 tests pass (new DSH suites +agent-prompt-submission-runtime). Related suites (launched-agent-composer-readiness,terminal-prompt-delivery-receipt,draft-paste-ready-scanner) also pass.pnpm tc(typecheck),pnpm run check:code-quality:changed,oxlintandoxfmt --checkpass on the changed files.origin/main:src/main/runtime/rpc/methods/agent-launch-restart-replay.test.tshas 8 failing cases on a clean base (verified by stashing this change); unrelated to this PR.\rconstant, and the working-title evidence is transport-independent, but neither was run here.AI Disclosure
Implemented by an AI coding agent (DeepSeek Harness / dsh) in an Orca worktree. An independent read-only review was run in a separate Orca Pi session using Magpie
sg/codex/gpt-6-astra, reasoning high (verified from the Pi session record: providermagpie, modelsg/codex/gpt-6-astra, thinkinghigh).Review
Independent Pi review (GPT-6-Astra, high) — read-only, three rounds:
input_acceptedcheckpoint undercounted retry bytes.+ submitsaccounting, new guard-race tests). Re-review found one remaining case: a hook-only working timestamp could land without a title edge.workingSequence,explicitWorkingStartedAt, status flip) plus a focused predicate test. Final verdict: APPROVE — no remaining blockers.Reviewer notes carried into this PR: the retry budget bounds the wait (a startup slower than ~5.5 s can still leave the task in the launchpad), the launch receipt remains the honest write-level
handed-to-terminal(dsh has no settlement provider, so it still does not prove execution), and the consumer paths not gated oncomposerReady(reused terminal, worker dispatch, renderer draft paste) do not get this policy.Agent skill upstream boundary
Notes
composerReady) applies the retry. A reused dsh terminal, orchestration worker dispatch, and the renderer's direct draft paste use their own readiness waits and are unchanged; this PR does not claim they reproduce the same failure.handed-to-terminal(accurate about the write, not about execution). Extending the budget trades latency for coverage; 5.5 s covers the measured ~1 s window several times over.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred) —pnpm tc, the touched test suites,check:code-quality:changed, and oxlint/oxfmt on changed files pass locally; full-suitepnpm lint/pnpm test/pnpm buildwere not run. Workflow runs areaction_requiredpending maintainer approval for this fork PR.