Repository navigation
fix: resolve Pi npm installs for account imports - #592
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
No actionable comments were generated in the recent review.
|
| 层 / 文件 | 摘要 |
|---|---|
包目录与 CLI 入口发现 packages/adapters/pi/src/command.ts, packages/adapters/pi/test/command.test.ts |
新增从可执行文件目录向上查找 Pi 包的函数,以及读取并校验包内 CLI 入口的函数。测试覆盖包目录发现、入口查找、越界入口拒绝和无关包名排除。 |
安装定位与 CLI 调用 packages/adapters/pi/src/pi-credential-imports.ts |
安装定位使用新函数查找 Pi 包和 CLI 入口;未找到任一项时仍抛出原有的不支持安装错误。离线模型列表命令改为执行发现的 CLI 入口。 |
Priority:
Estimated code review effort: 2 (Simple) | ~15 minutes
Change: Bug fix
Sequence Diagram(s)
sequenceDiagram
participant Installation as 安装定位
participant PackageFinder as findPiPackageDirectory
participant EntryFinder as findPiCliEntry
participant ProviderNames as configuredProviderNames
participant PiCLI as Pi CLI
Installation->>PackageFinder: 根据可执行文件查找 Pi 包目录
PackageFinder-->>Installation: 返回包目录
Installation->>EntryFinder: 根据包目录查找 CLI 入口
EntryFinder-->>Installation: 返回 CLI 入口
ProviderNames->>PiCLI: 执行离线模型列表命令
Possibly related PRs
- BytePioneer-AI/codex-host#575:修改相同的 Pi 安装与 Provider 冲突检查路径;本 PR 改为使用发现的 Pi CLI 入口执行离线 Provider 列表命令。
Suggested labels: 范围:适配器
Merge Risk: 
Minimal · up to 8690b
-
The Pi install-discovery change is mergeable after normal checks; no actionable risk remains identified.
Pre-merge checks: 
4
Finishing Touches
-
📝 Generate docstrings
-
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
-
- 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.
Comment @coderabbitai help to get the list of available commands.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8690b97557
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| export function findPiPackageDirectory(executable: string): string | undefined { | ||
| let directory = path.dirname(executable); | ||
| while (true) { | ||
| for (const candidate of [directory, path.join(directory, PI_PACKAGE_PATH)]) { |
There was a problem hiding this comment.
Verify that the discovered package backs the executable
When the selected executable is a wrapper or non-npm Pi binary beneath any directory containing a separate node_modules/@earendil-works/pi-coding-agent—for example, a custom wrapper inside a project with a stale Pi dependency—this loop accepts that unrelated package from any ancestor without establishing that the executable points to it. installation() then imports authentication modules, performs collision checks, and generates extension paths using a different Pi installation, contradicting its guarantee to reject unrelated installs; restrict the fallback to a verified npm shim layout or validate the shim's target.
Useful? React with 👍 / 👎.
Summary
Validation
RUN v4.1.10 D:/work/code/codex-host
Test Files 2 passed (2)
Tests 19 passed (19)
Start at 13:10:57
Duration 817ms (transform 231ms, setup 0ms, import 731ms, tests 189ms, environment 0ms) (19 passed)