Skip to content

fix(deepseek): discover user-installed DSH from desktop launches - #1116

Merged
iruriQ merged 1 commit into
BytePioneer-AI:mainfrom
zxd-666:fix/deepseek-desktop-cli-discovery
Nov 24, 2026
Merged

iruriQ merged 1 commit into
BytePioneer-AI:mainfrom
zxd-666:fix/deepseek-desktop-cli-discovery

Conversation

@zxd-666

@zxd-666 zxd-666 commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

Summary

macOS 从 Finder 启动时,CodexHost 可能只拿到系统默认的 PATH。即使 dsh 已安装在用户目录,已有的 DeepSeek 会话也可能在恢复时显示 External Harness is unavailable。

dsh 查找顺序   PATH → Node 版本管理器 → POSIX 常见安装目录
Node 选择      符号链接目标旁的 Node → 原有 PATH 补全逻辑

沿用 #1091 的发现和启动逻辑。新增 POSIX 常见安装目录作为回退。若 dsh 链接到另一套安装且目标旁有可执行的 Node,优先使用该 Node。显式命令仍只解析指定路径,离线 npx 保留为最终回退。

Related issues

Related to #1091.

UI Demo

N/A(启动逻辑变更)。

Test plan

Validated commit: 338ce03

  • 在基线 5f71c6af0 上新增的两项回归测试均失败,分别覆盖用户目录中的 dsh 发现和符号链接目标的 Node 优先级。
  • 在本提交上用 vitest run --config tests/vitest.config.js 执行 DeepSeek 的 executable、generation-selector、installation、adapter 和 remote-connection 测试,共 218 项通过。适配器的 tsc -b 与改动文件的 Prettier 检查通过。
  • 本提交构建出的 Adapter Bundle 在 macOS 27.0.1 arm64、Host Node 24.22.3 和系统默认 PATH 下连接真实 DSH 0.2.2-rc.5,状态为 ready。
  • Codex Desktop 冷启动和既有 8 轮会话的历史恢复已在 v0.25.1 的原始本地修复上实测。本 PR 提交的实机验证覆盖 Adapter Bundle 启动。

Merge Danger

改动范围是 DeepSeek CLI 发现及其子进程的 PATH。可以通过普通 revert 恢复原行为。

@coderabbitai

coderabbitai Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • 功能改进
    • 自动查找 DeepSeek Harness 命令时,新增对常见用户级及系统安装目录的搜索,并优先使用 PATH 中找到的命令。
    • 显式指定命令时仅检查该命令;未找到时返回未发现状态,不再回退到其他命令。
    • 在 POSIX 系统上,若命令符号链接目标目录包含可执行的 Node.js,启动时会优先使用该运行时。

DeepSeek Harness 扩展了 POSIX 系统中的 dsh 自动查找目录。对于符合条件的符号链接命令,子进程 PATH 会优先包含链接目标目录中的 Node 运行时目录。相关测试和架构文档也已更新。

Changes: DeepSeek Harness 可执行文件发现与运行环境

Layer / File(s) Summary
扩展 dsh 自动查找目录
packages/adapters/deepseek-harness/src/executable.ts, packages/adapters/deepseek-harness/test/executable.test.ts, docs/architecture/harness-executable-discovery.md
POSIX 自动查找目录新增 ~/.local/bin、~/.npm-global/bin、/opt/homebrew/bin 和 /usr/local/bin。测试覆盖 macOS GUI PATH 下的用户目录和系统路径解析。架构文档说明查找顺序及相关环境行为。
调整符号链接目标 Node 的 PATH
packages/adapters/deepseek-harness/src/executable.ts, packages/adapters/deepseek-harness/test/executable.test.ts
对于 POSIX 绝对命令路径,若符号链接目标目录包含可执行的 node,则将该目录置于子进程 PATH 首位,并从原 PATH 条目中去重。测试验证输入环境对象保持不变。

Estimated code review effort: 2 (Simple) | ~12 minutes

Change: Bug fix

Possibly related PRs

  • BytePioneer-AI/codex-host#1091:该 PR 也修改 Harness 可执行文件发现,处理 macOS GUI 启动时从 Node 版本管理器目录查找 dsh 的行为。

Suggested reviewers: liuxxxu, bytepioneer-ai

Merge Risk: Minimal · up to 338ce

This change lets the DeepSeek CLI be found when the app is launched from Finder with the system-default PATH. Reported tests and a device check cover the new behavior, and the change is easy to revert. No merge-blocking risk was identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed 标题“fix(deepseek): discover user-installed DSH from desktop launches”与变更集直接相关。变更新增 POSIX 常见安装目录(如 ~/.local/bin、/opt/homebrew/bin)用于发现 dsh,并新增用户目录 dsh 发现的测试,目标是修复 macOS 从 Finder 启动时找不到已安装 DSH 的问题。标题简洁、具…
Description check Passed 描述与变更集相关。描述说明了 macOS 从 Finder 启动时 PATH 不完整的问题、dsh 的查找顺序、符号链接目标旁 Node 的优先选择、显式命令与离线 npx 回退的行为,并列出了测试计划。这些内容与 executable.ts、文档和测试文件中的改动一致。
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.
Full details: Title check

Explanation

标题“fix(deepseek): discover user-installed DSH from desktop launches”与变更集直接相关。变更新增 POSIX 常见安装目录(如 ~/.local/bin、/opt/homebrew/bin)用于发现 dsh,并新增用户目录 dsh 发现的测试,目标是修复 macOS 从 Finder 启动时找不到已安装 DSH 的问题。标题简洁、具体,描述了主要变更。

Finishing Touches

Generate unit tests (beta)

  • 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

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 5f71c6a and 338ce03.

Files selected for processing: 3

  • docs/architecture/harness-executable-discovery.md
  • packages/adapters/deepseek-harness/src/executable.ts
  • packages/adapters/deepseek-harness/test/executable.test.ts

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

Recent review details

Context from checks skipped due to timeout: 8

  • GitHub Check: CodeRabbit
  • GitHub Check: Check Linux ARM64
  • GitHub Check: Web Host tests
  • GitHub Check: Check ubuntu-22.04
  • GitHub Check: Vitest
  • GitHub Check: Check windows-latest
  • GitHub Check: Check macos-26
  • GitHub Check: Static checks
Additional context used

Code guidelines: 1

AGENTS.md — auto-discovered
Path-based instructions: 2

Source excerpt: Harness-specific protocol details must remain inside the corresponding Adapter.

CodeRabbit inference engine (AGENTS.md)

Files:

  • packages/adapters/deepseek-harness/src/executable.ts
  • packages/adapters/deepseek-harness/test/executable.test.ts
Source excerpt: Use package public exports for cross-package dependencies.

CodeRabbit inference engine (AGENTS.md)

Files:

  • packages/adapters/deepseek-harness/src/executable.ts
  • packages/adapters/deepseek-harness/test/executable.test.ts
LanguageTool

docs/architecture/harness-executable-discovery.md

[uncategorized] ~121-~121: 您的意思是“"不"齐”?
Context: ...ne --no-install @deepseek-ai/dsh`` 回退。启动时补齐所选命令目录与 Host Node 目录。POSIX 下,如果 dsh` 指...

(BU)

[uncategorized] ~121-~121: 数词与名词之间一般应存在量词,可能缺少量词。
Context: ...选命令目录与 Host Node 目录。POSIX 下,如果 dsh 指向另一目录里的符号链接目标,而且目标旁有可执行的 node,子进程优先使用该 Node...

(wa5)

@iruriQ
iruriQ merged commit d1d00e7 into BytePioneer-AI:main Nov 24, 2026
8 checks passed
@iruriQ

iruriQ commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator

感谢贡献!改动极简且完全收口在 DeepSeek Adapter 内,解决 macOS GUI 启动 PATH 发现 dsh 与符号链接旁 Node 优先问题,CI 全绿,已合入 main。

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