Skip to content

fix(runtime): settle a cold-started DSH pane on its idle composer - #26691

Closed
Jinwoo-H wants to merge 5 commits into
mainfrom
readiness/dsh-cold-start
Closed

Jinwoo-H wants to merge 5 commits into
mainfrom
readiness/dsh-cold-start

Conversation

@Jinwoo-H

@Jinwoo-H Jinwoo-H commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 22 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​219 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​219
Prod 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​83 $\color{#cf222e}{\Huge{\mathbf{−}}}$​9 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​74

ELI5

When you open a fresh DeepSeek Harness (DSH) terminal, Orca had no way to tell that DSH's input box was ready. DSH only says "done" after it finishes a reply, and a brand-new session hasn't replied to anything yet. So terminal wait --for tui-idle on a fresh DSH pane waited until it timed out. Orca now recognises DSH's ready input box on screen.

What Changed

  • Before: a cold-started DSH pane never settled tui-idle. It timed out at 60 s with the composer up and idle.
  • After: it settles once the composer is on screen: 2.3 s on dsh-tui 0.12 and 6.4 s on 0.13 in live runs. The prompt sent next was delivered.

Mechanism: DSH's rules file gets screen rules, the same way other screen-ruled agents (Antigravity, Cline, Prime Agent) are handled. All rules are written against new PTY captures of dsh-tui 0.12.0 and 0.13.0.

  • chat_composer_ready: the empty chat composer with the model footer as the bottom row.
    • It doesn't wait for the screen to go quiet, because DSH's whale animation repaints behind the composer forever.
    • A turn breaks the match in two ways. It paints esc to interrupt under the footer, and before that its spinner row (· total Ns / 总Ns) appears, which the rule refuses.
  • launchpad_composer_ready: 0.13's launchpad composer, in English or Chinese.
  • composer_not_shown: any other readable screen holds. That covers the first-run guide, menus, approvals and busy turns.
  • The hook "done" lane from fix(runtime): settle DSH tui-idle on its hook-store done #26481 still decides after a turn.
  • The transcript suite gains a repaintsAtRest option for agents whose idle screen never goes quiet.

Why

  • Per-agent screen rules written against captured transcripts are the established way Orca reads an agent's ready screen. No evaluator branches, no timing waits.
  • Alternative considered: treat DSH's startup hook event as "ready". Rejected, because DSH posts it on create, resume, clear and compact, and it doesn't prove the composer accepts input.

Linked Issue

Related: #25257. It covers the cold first-dispatch readiness that #26481 leaves out.

Stacked on #26481, which creates agent-state-rules/dsh.json.

Visual Proof

N/A: no UI change. This changes when a readiness wait settles; live timings are under Testing.

Testing

  • I manually tested these changes locally

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

  • Transcript tests, against 10 new scrubbed captures:

    • dsh-tui 0.12.0 and 0.13.0: cold starts at 120x40, in Chinese, and at 80x24, plus one real turn each.
    • Also captured: the 0.12 slash menu and the 0.13 first-run guide.
    • Results: a cold start stays pending until the composer appears. Every mid-turn frame reads not ready, and the composer after a turn reads ready. With the base dsh.json, 32 of these tests fail.
  • Live, macOS, isolated background dev runtime:

  • pnpm tc:node, 150 related test files (1899 tests) and check:code-quality:changed are clean. All captures pass the transcript secret scan.

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

  • Layouts not captured (0.14, the vim-mode badge, the setting that hides ⛶, the opt-in shortcut-hint row): with these, DSH reads as not ready, which fails safe and is never falsely ready.
  • Main risk: a future DSH that changes its busy row could let the composer rule match mid-turn. That's because the no-quiet screen rule ranks above a hook "working" row.
  • Rule live-updates: DSH stays out of them, because a published DSH rules file would reach older apps without fix(runtime): settle DSH tui-idle on its hook-store done #26481.
  • No wire change.

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)

DSH's managed hook posts to the hook server and never emits OSC 9999, so the
dsh-only first-party done lane never fired and tui-idle waits ran to timeout.
Give DSH turn-end hook authority through an agent-state-rules file, mark its
SessionStart as a session boundary, and drop the dead dsh special case.
DSH posts only SessionStart at boot, which is no turn end, and its hook
`done` was its only rest signal, so `terminal wait --for tui-idle` on a
fresh pane ran to timeout with the composer up. Add screen rules read from
captured dsh-tui 0.12.0 and 0.13.0 transcripts: the empty chat composer over
its footer, and 0.13's launchpad placeholder composer. They settle without
quiet because the whale intro repaints at rest; a turn's `esc to interrupt`
row under the footer and its elapsed-time spinner row refuse them, and any
other readable screen holds.
# Conflicts:
#	src/main/runtime/agent-state-rules/dsh.json
@Jinwoo-H
Jinwoo-H requested a review from brennanb2025 as a code owner October 9, 2026 00:13
@Jinwoo-H
Jinwoo-H changed the base branch from readiness/dsh-hook-trust to main October 9, 2026 00:13
@coderabbitai

coderabbitai Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Important

Review skipped

We couldn't safely recover the incremental review. No full review was started, and the last reviewed checkpoint was preserved. Retry later, or explicitly request a full review by commenting @coderabbitai full review.

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

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b0cc2b8d-3646-4868-a423-b669d693f2aa
📥 Commits

Reviewing files that changed from the base of the PR and between dec18a8 and b26ca14.

📒 Files selected for processing (24)
  • src/main/native-chat/agent-session-wire/structured-agent-session-queued-mutations.ts
  • src/main/runtime/__fixtures__/dsh-tui-0-12-0-cold-start-80x24.meta.json
  • src/main/runtime/__fixtures__/dsh-tui-0-12-0-cold-start-80x24.txt
  • src/main/runtime/__fixtures__/dsh-tui-0-12-0-cold-start-zh.meta.json
  • src/main/runtime/__fixtures__/dsh-tui-0-12-0-cold-start-zh.txt
  • src/main/runtime/__fixtures__/dsh-tui-0-12-0-cold-start.meta.json
  • src/main/runtime/__fixtures__/dsh-tui-0-12-0-cold-start.txt
  • src/main/runtime/__fixtures__/dsh-tui-0-12-0-slash-menu.meta.json
  • src/main/runtime/__fixtures__/dsh-tui-0-12-0-slash-menu.txt
  • src/main/runtime/__fixtures__/dsh-tui-0-12-0-turn.meta.json
  • src/main/runtime/__fixtures__/dsh-tui-0-12-0-turn.txt
  • src/main/runtime/__fixtures__/dsh-tui-0-13-0-cold-start-80x24.meta.json
  • src/main/runtime/__fixtures__/dsh-tui-0-13-0-cold-start-80x24.txt
  • src/main/runtime/__fixtures__/dsh-tui-0-13-0-cold-start-zh.meta.json
  • src/main/runtime/__fixtures__/dsh-tui-0-13-0-cold-start-zh.txt
  • src/main/runtime/__fixtures__/dsh-tui-0-13-0-cold-start.meta.json
  • src/main/runtime/__fixtures__/dsh-tui-0-13-0-cold-start.txt
  • src/main/runtime/__fixtures__/dsh-tui-0-13-0-turn.meta.json
  • src/main/runtime/__fixtures__/dsh-tui-0-13-0-turn.txt
  • src/main/runtime/__fixtures__/dsh-tui-0-13-0-welcome-guide.meta.json
  • src/main/runtime/__fixtures__/dsh-tui-0-13-0-welcome-guide.txt
  • src/main/runtime/agent-state-rules/dsh.json
  • src/main/runtime/dsh-screen-readiness-transcripts.test.ts
  • src/main/runtime/screen-ruled-agent-transcript-suite.ts
💤 Files with no reviewable changes (1)
  • src/main/native-chat/agent-session-wire/structured-agent-session-queued-mutations.ts

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

📝 Walkthrough

The DSH profile adds screen rules for two idle composer states and a fallback hold state. New terminal captures and tests cover DSH 0.12 and 0.13 screens. The transcript suite adds checks for agents whose ready screens continue to repaint. A separate change removes a blank line and does not change behavior.

Priority: ➖ Normal

Merge Risk: ⚪ Minimal · up to b26ca

The new cold-start readiness rules do not block post-turn readiness. The change is mergeable after normal checks.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 2 files. (21 skipped: 2… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
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.
Title check Passed The title clearly and concisely describes the main runtime fix: allowing a cold-started DSH pane to settle when its idle composer is ready.
Description check Passed The description is complete and directly matches the implementation. It includes the user impact, mechanism, rationale, linked issues, visual-proof rationale, testing evidence, risks, and checklist st…
Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 2 files. (21 skipped: 21 unsupported.)

✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

… the new dsh-tui captures

The serialize round-trip test replays every runtime fixture, so the new dsh-tui 0.12/0.13
readiness captures hit the same pre-existing row-0 true-colour background leak already
baselined for dsh-tui-ready-no-key. No serializer code changes in this PR.
@nwparker

Copy link
Copy Markdown
Contributor

Thanks for the cold-start analysis — it led to #33499 (merged, you're credited). dsh-tui 0.17 reports OSC 7501 idle at boot, which tui-idle already honours, and these rules matched only the 0.12/0.13 layouts; the remaining failure (first Enter refused before dsh's session opens) is fixed in #33499. Closing as superseded.

@nwparker nwparker closed this Oct 25, 2026
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.

2 participants