Skip to content

fix(runtime): settle DSH tui-idle on its hook-store done - #26481

Merged
Jinwoo-H merged 1 commit into
mainfrom
readiness/dsh-hook-trust
Oct 9, 2026
Merged

Jinwoo-H merged 1 commit into
mainfrom
readiness/dsh-hook-trust

Conversation

@Jinwoo-H

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

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​57 $\color{#cf222e}{\Huge{\mathbf{−}}}$​44 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​13
Prod 6 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​23 $\color{#cf222e}{\Huge{\mathbf{−}}}$​28 $\color{#cf222e}{\Huge{\mathbf{−}}}$​5

ELI5

DeepSeek Harness (DSH) tells Orca "I'm done" when it finishes a reply, but Orca was listening for that message in the wrong place. So Orca never believed a DSH pane was ready, and anything waiting on it (worker-start, terminal wait --for tui-idle) timed out. Orca now listens where DSH actually reports.

What Changed

  • Before: a ready DSH pane never settled tui-idle. Supervised DSH workers failed at agent_readiness with timeout, even after DSH's hook had posted Stop/done.
  • After: a fresh DSH done in the hook server's store settles the wait (about 2 s after the turn ends in a live run).

Mechanism:

  • DSH's hook posts to Orca's hook server over HTTP. The only DSH-specific "done" check read a different field, which is filled only by status escape codes in the terminal output. DSH never prints those, so the check could never fire.
  • The hook-server lane that does see DSH's rows is enabled per agent by its rule file (profile.hooks). DSH had no rule file, so it was treated as identity-only.
  • New agent-state-rules/dsh.json with profile.hooks: "turn-end": a hook done settles the wait, while a stale or working row leaves it to the other checks.
    • It is not authoritative: approval pauses, and possibly interrupts, post no hook, so a working row could otherwise hold the pane forever.
  • DSH's SessionStart row is now marked as a session boundary. DSH fires it on create, resume, clear and compact, and it must not count as a finished turn.
  • Removed the dead DSH-only branch in hasFreshDoneFirstPartyStatus. It now only handles the agent-agnostic session-boundary case.

Why

  • This uses the same per-agent rule-file hook authority every other hook-driven agent already uses, instead of a special case.
  • Alternative considered: have DSH's hook also print a status escape code. Rejected, because that adds a second channel for the same fact. Agent status belongs in the hook server's one store.

Linked Issue

Fixes #25257

Visual Proof

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

Testing

  • I manually tested these changes locally

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

  • Unit tests:

    • New tests: a turn-end hook lane suite for DSH, a hookAuthority('dsh') assertion, and a check that the rest signal agrees with the lanes.
    • All three new tests fail on the base commit and pass with the fix.
    • Stale rows, rows older than the last input, working rows, session-boundary rows and other agents' rows still don't settle.
  • Live, macOS, isolated background dev runtime, dsh 0.2.0-rc.2 / dsh-tui 0.12.0:

    • Base: after a real turn, with the hook's done received, a 10 s terminal wait --for tui-idle timed out.
    • With the fix: the same wait settled in 1.85 s, and worker-start --agent dsh delivered its task.
  • pnpm tc:node and check:code-quality:changed are clean.

  • Not exercised: Linux, Windows, SSH. The change is platform-neutral and the hook store already exists on remote hosts.

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

  • Mixed versions: sessionBoundary is an existing optional field on hook rows, so older clients are unaffected.
  • Cold start: an Orca-launched DSH still uses its existing composer-marker race. A pane started from an unrecognised wrapper command can still settle before its composer appears. That is a separate identity issue with its own PR.

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.
@coderabbitai

coderabbitai Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

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: 38ead308-df01-4ad0-874d-f9d75214da5d
📥 Commits

Reviewing files that changed from the base of the PR and between 07c2379 and 2e0c791.

📒 Files selected for processing (9)
  • src/main/runtime/agent-state-rules/agent-state-rules-catalog.ts
  • src/main/runtime/agent-state-rules/agent-state-rules-schema.ts
  • src/main/runtime/agent-state-rules/dsh.json
  • src/main/runtime/tui-idle-evidence.test.ts
  • src/main/runtime/tui-idle-evidence.ts
  • src/main/runtime/tui-idle-hook-lane.test.ts
  • src/shared/agent-hook-listener/providers/dsh-events.test.ts
  • src/shared/agent-hook-listener/providers/dsh-events.ts
  • src/shared/tui-agent-rest-signal.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

Walkthrough

The DSH configuration is added to the bundled agent-state rules with turn-end hook authority. DSH SessionStart payloads now mark a session boundary. First-party done evidence counts only when it marks a session boundary. DSH idle-evaluation tests cover fresh, stale, pre-input, working, session-boundary, and misattributed hook rows.

Priority: ➖ Normal

Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to 2e0c7

DSH post-turn idle readiness appears mergeable after normal checks; the remaining cold-start behavior is a separate issue.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 8 files. (1 skipped: 1… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: DSH now settles TUI idle from its hook-store done event.
Description check ✅ Passed The description is complete and focused. It includes the ELI5 summary, changes, rationale, linked issue, visual-proof justification, testing results, review notes, and checklist. It also clearly ident…
Linked Issues check ✅ Passed For issue [#25257], dsh.json enables profile.hooks: "turn-end", and the catalog includes the rule. The hook-lane tests verify that a fresh, correctly attributed DSH done row returns `ready-stron…
Out of Scope Changes check ✅ Passed The changes stay within issue [#25257]. The rule catalog update, hook-authority documentation, DSH event normalization, idle-evidence logic, and focused tests support the DSH readiness fix and its saf…
Full details: Docstring Coverage

Explanation

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

  • Fix all pre-merge checks with AI
✨ 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

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.

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.

[Bug]: DSH worker readiness times out despite native Stop/done (Orca 1.4.220, dsh-tui 0.13.0)

1 participant