Skip to content

fix(dsh): show DSH hooks as partial when a profile is missing the hooks package - #37446

Merged
AmoabaKelvin merged 3 commits into
mainfrom
dsh-hooks-missing-executor
Nov 3, 2026
Merged

AmoabaKelvin merged 3 commits into
mainfrom
dsh-hooks-missing-executor

Conversation

@AmoabaKelvin

@AmoabaKelvin AmoabaKelvin commented Nov 2, 2026 •

Copy link
Copy Markdown
Collaborator
Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​29 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​29
Prod 4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​60 $\color{#cf222e}{\Huge{\mathbf{−}}}$​6 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​54

ELI5

Orca adds a line to DeepSeek Harness (DSH) config asking it to load a hooks package. Orca never installs that package, so DSH can't load it. Orca still said the DSH hooks were "installed", even though no DSH events were reaching it. Orca now checks each DSH profile for the package. If a profile doesn't have it, Orca says the integration isn't working and tells you how to fix it.

What Changed

  • Before: orca agent hooks status (and the install result) said dsh: installed whenever Orca's own files were in place. Meanwhile DSH printed failed to import: ERR_MODULE_NOT_FOUND ... @deepseek-ai/dsh-hooks-claude-code on every start, and Orca received no DSH session events.
  • After: once Orca's own files are complete, DshHookService also checks every $DSH_HOME/profiles/<name> that has a package.json. Each one must have both @deepseek-ai/dsh-hooks-claude-code and its peer @deepseek-ai/dsh-hook-protocol in the profile's own node_modules. If either is missing, the status is partial and the detail names each broken profile, the packages it lacks, and the pnpm add <pkg>@<dsh version> fix. If the profiles directory exists but can't be read, the status is also partial, with a detail saying so.
  • No profiles yet: if DSH hasn't created any profiles, the status stays installed, because there is nothing to check yet.
  • CLI: the text output of orca agent hooks status/on/off now prints the detail for partial and error statuses, for every agent. Before, the reason only appeared in --json.
  • The package name in the patch row and in the new check now comes from one shared constant.

Why

The root cause: DshHookService.getStatus decided "installed" from Orca's own patch and hook files only. It never checked whether DSH could load the package the row names.

I checked where DSH actually loads the package from, using a real DSH 0.2.1-rc.5 install in a scratch DSH_HOME:

  • With no packages, DSH fails on the executor.
  • With only the executor installed, it fails on @deepseek-ai/dsh-hook-protocol. The DSH engine ships every other peer of the executor, but not that one.
  • With both in the profile's node_modules, the row loads.
  • A copy in $DSH_HOME/node_modules does not work, because it can't reach the engine's peers.

So the check looks at exactly what DSH needs: both packages, in each profile's own node_modules.

Alternatives I didn't take:

  • Running dsh to probe the profile: slow, needs credentials, and the status check is synchronous.
  • Following Node's parent-directory lookup: it would report installed in the $DSH_HOME/node_modules case, which DSH rejects.

Having Orca install the packages itself was left out on purpose. That would mean running pnpm inside the user's DSH profiles and picking the release channel that matches the installed DSH (npm latest is the old, incompatible 0.0.1 line). That is a separate product decision.

Linked Issue

Fixes #30272

Linear: STA-11034

Visual Proof

N/A. Nothing in the app UI changes. The change shows up in orca agent hooks status output and the hook status detail. Real output against a DSH 0.2.1-rc.5 profile with no packages:

partial These DSH profiles cannot load Orca's hooks, so their sessions send no events to Orca: /tmp/dsh-repro-sta11034/home/profiles/headless (missing @deepseek-ai/dsh-hooks-claude-code, @deepseek-ai/dsh-hook-protocol). Run `pnpm add @deepseek-ai/dsh-hooks-claude-code@<dsh version> @deepseek-ai/dsh-hook-protocol@<dsh version>` in each profile directory (npm latest is an older, incompatible line).

Testing

  • macOS, using a real DSH install (@deepseek-ai/[email protected]) in a scratch DSH_HOME with a scratch HOME. I compared DshHookService.getStatus() with DSH's own startup warning in each package state:

    Packages in the profile DSH Orca
    none Cannot find package '@deepseek-ai/dsh-hooks-claude-code' partial, both packages named
    executor only Cannot find package '@deepseek-ai/dsh-hook-protocol' partial, protocol named
    both (pnpm add) row activates installed
  • New regression test in src/main/dsh/hook-service.test.ts. It fails on main and passes with the fix.

  • Ran the DSH tests, the dependent tests, pnpm check:code-quality:changed, pnpm check:react-doctor:changed and pnpm check:changed.

  • Windows was not run by hand. The paths go through path.join, and I confirmed that path.win32.join turns the scoped package name into backslash segments.

  • I manually tested these changes locally

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

Risk

Low. Users whose DSH profiles lack the packages now see dsh: partial instead of installed. Today that is every DSH user who hasn't added the packages by hand. Nothing reads the state to retry or reinstall. The only consumers are the CLI output and the install result, and telemetry is only recorded on thrown errors. Orca writes nothing new to disk. The check is one readdirSync plus up to three existsSync calls per profile, and runs only at startup reconcile, on settings toggles and from CLI commands. Revert the PR to back it out.

Level: Low

AI Disclosure

Review

Codex and a Claude reviewer each ran one round. Codex found nothing. Claude raised three P3s, all fixed:

  • the detail claimed "no DSH events" even when only some profiles were broken;
  • an unreadable profiles directory was treated as "no profiles";
  • skip details made the CLI output noisy.

A simplify pass moved the check into buildStatus's installed branch.

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

  • Remote SSH and WSL: installRemote still returns installed. Its result is only logged, and nothing displays remote hook state, so a remote check would be code nobody reads.

  • Mobile and folder workspaces: not affected.

  • Security: reads only file existence under the user's own DSH_HOME, and runs no subprocess.

  • Waiting for blessing (new status copy, and CLI text now prints the detail for partial/error statuses for every agent). To try it from worktree /Users/kelvinamoaba/orca/workspaces/orca/dsh-hooks-missing-executor:

    1. mkdir -p /tmp/dsh-try/profiles/web && echo '{}' > /tmp/dsh-try/profiles/web/package.json
    2. HOME=/tmp/dsh-try-home DSH_HOME=/tmp/dsh-try npx tsx -e "import { DshHookService } from './src/main/dsh/hook-service'; console.log(new DshHookService().install())" prints state: 'partial' with the missing packages for web
    3. Add node_modules/@deepseek-ai/{dsh-hooks-claude-code,dsh-hook-protocol}/package.json under that profile and run it again: installed.

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)
  • I stated the risk: what could break, for whom, and how to back it out
  • 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 Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Recent 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: 5dd5c58c-a01d-435a-8615-6afd0adc2664
Commits

Reviewing files that changed from the base of the PR and between 1ce7960 and c28deec.

Files selected for processing: 5
  • src/cli/handlers/agent-hooks.ts
  • src/main/dsh/dsh-home-patch.ts
  • src/main/dsh/dsh-hook-packages.ts
  • src/main/dsh/hook-service.test.ts
  • src/main/dsh/hook-service.ts

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

Walkthrough

The DSH hook package names are centralized, and DSH profiles are checked for the required packages. Hook status reports missing packages as partial, and the CLI formatter displays details for partial and error statuses. A test covers missing and installed package states.

Severity of issue fixed: Medium

Merge Risk: Low · up to c28de

The suggested package-install command requires users to replace its version placeholders before it will work. This is a bounded issue to fix or accept 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 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta… 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 main change: reporting DSH hooks as partial when a profile lacks the required hooks package.
Linked Issues check Passed Issue #30272 requires Orca to expose the silent DSH hook failure. describeDshProfilesMissingHookPackages checks each profile with package.json for both required packages in that profile's own `nod…
Out of Scope Changes check Passed The changed production files all support issue #30272. They implement package validation, status propagation, shared package naming, and user-visible CLI details. The test change verifies the required…
Description check Passed The pull request description is complete and follows the repository template. It explains the user impact, implementation, rationale, linked issue, testing, visual proof, risks, compatibility consider…
Full details: Linked Issues check

Explanation

Issue #30272 requires Orca to expose the silent DSH hook failure. describeDshProfilesMissingHookPackages checks each profile with package.json for both required packages in that profile's own node_modules, reports missing packages or an unreadable profiles directory, and preserves installed when no profiles exist or all checks pass. DshHookService maps these findings to partial. The CLI now prints details for partial and error states. The shared executor constant keeps the patch row and validation target consistent. The added regression test covers partial and installed states. Package installation remains outside this status-detection objective.

Full details: Out of Scope Changes check

Explanation

The changed production files all support issue #30272. They implement package validation, status propagation, shared package naming, and user-visible CLI details. The test change verifies the required behavior. No unrelated product behavior or package installation change is included.

Full details: Description check

Explanation

The pull request description is complete and follows the repository template. It explains the user impact, implementation, rationale, linked issue, testing, visual proof, risks, compatibility considerations, AI review, and rollback. The standard command checklist is not fully checked, but the description documents the validation commands that were run and states that CI may cover the remaining commands.

Full details: Docstring Coverage

Explanation

Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 2 functions across 5 files.

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches
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 on lines +19 to +21
return isDefinitiveAbsence(error)
? null
: `Could not read the DSH profiles directory ${profilesDir}`

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

Report a non-directory profiles path as partial.

If profiles exists as a regular file, readdirSync fails with ENOTDIR. isDefinitiveAbsence classifies that error as absence, so this function returns null and DshHookService reports installed. Treat only a missing profiles path as “no profiles to check”; report ENOTDIR as a directory error. (raw.githubusercontent.com)

Comment on lines +24 to +31
.map((profile) => join(profilesDir, profile))
.filter((profileDir) => existsSync(join(profileDir, 'package.json')))
.map((profileDir) => ({
profileDir,
// DSH resolves the row only from the profile's own node_modules; a parent copy cannot reach engine peers.
missing: DSH_HOOK_PACKAGES.filter(
(pkg) => !existsSync(join(profileDir, 'node_modules', pkg, 'package.json'))
)

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:

nl -ba src/main/dsh/dsh-hook-packages.ts
sed -n '120,180p' src/main/dsh/hook-service.ts

Repository: stablyai/orca

Length of output: 4528


Script executed:

set -o pipefail
printf '%s\n' '--- focused diff ---'
git diff --no-ext-diff 1ce79608a43ebff41db690108bad8275597ad654 c28deec94c861c4a37d9fb11bbf0ea722889b5b4 -- src/main/dsh/dsh-hook-packages.ts src/main/dsh/hook-service.ts src/main/dsh/hook-service.test.ts
printf '%s\n' '--- related declarations and references ---'
rg -n -F --glob 'src/main/dsh/**' -e 'describeDshProfilesMissingHookPackages' -e 'AgentHookInstallStatus' -e 'getStatus()' -e 'profiles' src/main/dsh || test "$?" -eq 1
printf '%s\n' '--- status declaration ---'
rg -n -F --glob 'src/**' -e 'type AgentHookInstallStatus' -e 'interface AgentHookInstallStatus' -e 'status(configPath' src
printf '%s\n' '--- focused tests ---'
rg -n -F --glob 'src/main/dsh/*.test.ts' -e 'installed' -e 'partial' -e 'profiles' -e 'package.json' -e 'EACCES' src/main/dsh || test "$?" -eq 1

Repository: stablyai/orca

Length of output: 12086


Web query:

Node.js fs.existsSync behavior when permission denied or path is not traversable current user, applicable Node.js documentation

Result:

Sources consulted:
- File system | Node.js v26.13.0 Documentation — https://nodejs.org/api/fs.html
- node/doc/api/fs.md at main · nodejs/node · GitHub — https://github.com/nodejs/node/blob/main/doc/api/fs.md?plain=1
- Permissions | Node.js 26.13.0 Documentation — https://beta.docs.nodejs.org/permissions
- File system | Node.js v26.5.1 Documentation — https://nodejs.org/download/release/v26.5.1/docs/api/fs.html
- …and 21 more

Report inaccessible profiles as incomplete.

When a listed profile cannot be traversed, existsSync(join(profileDir, 'package.json')) treats the access failure like absence and filters the profile out. broken can then be empty, causing buildStatus to report installed without checking that profile. Distinguish definitive absence from other statSync errors and return a non-null detail for inaccessible profiles.

Suggested fix
-import { existsSync, readdirSync } from 'node:fs'
+import { existsSync, readdirSync, statSync } from 'node:fs'
 import { join } from 'node:path'
@@
-  const broken = entries
-    .map((profile) => join(profilesDir, profile))
-    .filter((profileDir) => existsSync(join(profileDir, 'package.json')))
+  const profileDirs: string[] = []
+  for (const profile of entries) {
+    const profileDir = join(profilesDir, profile)
+    try {
+      statSync(join(profileDir, 'package.json'))
+    } catch (error) {
+      if (isDefinitiveAbsence(error)) continue
+      return `Could not read the DSH profile ${profileDir}`
+    }
+    profileDirs.push(profileDir)
+  }
+  const broken = profileDirs
     .map((profileDir) => ({
       profileDir,

Comment on lines +40 to +41
const install = DSH_HOOK_PACKAGES.map((pkg) => `${pkg}@<dsh version>`).join(' ')
return `These DSH profiles cannot load Orca's hooks, so their sessions send no events to Orca: ${list}. Run \`pnpm add ${install}\` in each profile directory (npm latest is an older, incompatible line).`

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:

sed -n '37,42p' src/main/dsh/dsh-hook-packages.ts
rg -n 'dsh version|dsh --version|hooks-claude-code' src/main/dsh src/cli

Repository: stablyai/orca

Length of output: 1373


Script executed:

set +e
printf '%s\n' '--- placeholder references ---'
rg -n -F --glob '!node_modules/**' -e '<dsh version>' -e 'supported shell' -e 'shells' src docs .github package.json 2>/dev/null
printf '%s\n' '--- relevant source ---'
nl -ba src/main/dsh/dsh-hook-packages.ts | sed -n '1,48p'
printf '%s\n' '--- parser availability ---'
for shell in sh bash zsh fish pwsh; do
  command -v "$shell" 2>/dev/null || true
done
printf '%s\n' '--- POSIX shell parse ---'
cmd='pnpm add @deepseek-ai/dsh-hooks-claude-code@<dsh version> @deepseek-ai/dsh-hook-protocol@<dsh version>'
printf '%s\n' "$cmd"
printf '%s\n' "$cmd" | sh -n
printf 'sh -n exit=%s\n' "$?"
printf '%s\n' '--- bash parse ---'
printf '%s\n' "$cmd" | bash -n
printf 'bash -n exit=%s\n' "$?"

Repository: stablyai/orca

Length of output: 41134


Explain the DSH version placeholder.

The displayed command is not executable as written. Copying it into sh or bash produces a shell parse error before pnpm runs. State that users must replace <dsh version> with the installed DSH version.

Suggested fix
-  return `These DSH profiles cannot load Orca's hooks, so their sessions send no events to Orca: ${list}. Run \`pnpm add ${install}\` in each profile directory (npm latest is an older, incompatible line).`
+  return `These DSH profiles cannot load Orca's hooks, so their sessions send no events to Orca: ${list}. Run \`pnpm add ${install}\` in each profile directory, replacing \`<dsh version>\` with the installed DSH version (npm latest is an older, incompatible line).`
Committable suggestion

IMPORTANT
Review the replacement and indentation, then test before committing.

Suggested change
const install = DSH_HOOK_PACKAGES.map((pkg) => `${pkg}@<dsh version>`).join(' ')
return `These DSH profiles cannot load Orca's hooks, so their sessions send no events to Orca: ${list}. Run \`pnpm add ${install}\` in each profile directory (npm latest is an older, incompatible line).`
const install = DSH_HOOK_PACKAGES.map((pkg) => `${pkg}@<dsh version>`).join(' ')
return `These DSH profiles cannot load Orca's hooks, so their sessions send no events to Orca: ${list}. Run \`pnpm add ${install}\` in each profile directory, replacing \`<dsh version>\` with the installed DSH version (npm latest is an older, incompatible line).`

@AmoabaKelvin
AmoabaKelvin merged commit f4d89b9 into main Nov 3, 2026
45 checks passed
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 hooks 集成注入了配置但未安装执行器,导致集成静默失效(ERR_MODULE_NOT_FOUND)

1 participant