Repository navigation
fix(pi): a registry that fails keeps an installed Pi - #1330
Merged
Merged
Conversation
When npm view fails (E401, a blocked registry) and Pi is installed, install-pi.sh stopped. Nothing in that case needs npm. The installer now shows npm's message, keeps that Pi, and goes on. With no Pi, it still stops and changes nothing. The OpenCode installer (#1296) does the same; review round 3 there found it. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Vitaly Zabershinsky <[email protected]>
vz-ibm
commented
Nov 24, 2026
vz-ibm
left a comment
Collaborator
Author
There was a problem hiding this comment.
| Reviewer | Kind | Started by | Context | Review | Round | Head | Verdict |
|---|---|---|---|---|---|---|---|
| Reviewer 2 (claude, user of @vz-ibm) | Claude Code 2.1.325 | offload-review skill, @vz-ibm's session | fresh | 2 of 2 | 1 of 2 | 9d9ad16eca1a |
approve |
Verdict: approve
Findings
None.
Non-blocking
pi-package/scripts/test_install_pi.py:268: the new testtest_a_registry_that_fails_keeps_an_installed_pi_and_goes_onreadscodebut does not check it. Addself.assertEqual(code, 0). Then the test also proves that the whole install finishes, not only that it gets to the package step.pi-package/scripts/install_pi.py:197-208: whenpiis onPATHbutpi --versionprints text that is not a version,installedis that text. With a failing registry, the installer now keeps that Pi and goes on. With a working registry, the installer offers an update for this case. The laterpicalls stop with their own message, so the result is still safe. You can useversion_tuple(installed)in theif not installedcheck to make the two cases the same. This is optional.- The
removesuffix(' Nothing was changed.')call depends on the exact end of thelatest_pimessage (line 192). If someone changes that text, the user sees "Nothing was changed." and then the install goes on. The first new test does not check that this text is absent. AnassertNotIn("Nothing was changed.", printed)would hold the two in step.
What I checked
- I read the full diff (4 files, 1 commit) and the commit message.
ensure_pi(lines 195-224) andlatest_pi(lines 188-193): theStopis caught only aroundlatest_pi. With no Pi (installedisNoneor""), the code raises the sameStopas before. The old behavior for that case does not change.- With Pi installed, the method returns before any
npm install. No record change:pi_installedis not set, so uninstall does not remove a Pi that the installer did not install. - No later step needs npm:
install_package,connection,setupandfinishusepi, the plugin script and HTTP only. - The message keeps npm's stderr and the
CG_PI_NPM_REGISTRYhint. The new test checks both. str.removesuffixneeds Python 3.9. The file already uses it at line 289, so this adds no new need.- The fake shell change (
npm_view_error) is used only by the two new tests. The other tests keep the old default. - Docs: the how-to and the design doc (step 2 and the failure table) describe the new case. No other doc names the old "registry fails, nothing changed" rule for an installed Pi.
- Behavior change: the PR names it at the top, with who, old, new and how to turn it off, and a human's yes (Vitaly Zabershinsky, 2026-11-24). I did not check where that yes is recorded outside the PR text.
- Data dependence: none. The installer reads and stores nothing new.
- I did not run the tests. Live tests are not approved for this review.
vz-ibm
commented
Nov 24, 2026
vz-ibm
left a comment
Collaborator
Author
There was a problem hiding this comment.
| Reviewer | Kind | Started by | Context | Review | Round | Head | Verdict |
|---|---|---|---|---|---|---|---|
| Reviewer 1 (claude, user of @vz-ibm) | Claude Code 2.1.325 | offload-review skill, @vz-ibm's session | fresh | 1 of 2 | 1 of 2 | 9d9ad16eca1a |
approve |
Verdict: approve
Findings
None.
Non-blocking
test_install_pi.py:266— the testtest_a_registry_that_fails_keeps_an_installed_pi_and_goes_onsetscodeand does not use it. The run gives no answers, so it probably stops later at the connection step with code 1. The test proves "goes on" with thepi installcount, which is enough. You can write_, terminal = ...to make this clear, astest_current_pi_asks_nothing_about_pidoes.install_pi.py:205— the message depends on the exact suffix" Nothing was changed."inlatest_pi. If someone edits that text, the user sees "Nothing was changed." and then the install goes on. The text is correct today. A test assertion such asassertNotIn("Nothing was changed.", printed)in the first new test would guard it.
What I checked
- I read the full diff (4 files, 1 commit) and the commit message, which has the DCO sign-off and
Assisted-By. install_pi.py:195-224(ensure_pi) andlatest_pi(188-193):- Pi installed,
npm viewfails:latest_piraisesStop. The newexceptshows npm's stderr and theCG_PI_NPM_REGISTRYhint, shows "Pi stays.", and returns. Nonpm installruns.record["pi_installed"]stays unset, so uninstall (line 510) does not remove a Pi that the user owned. Correct. - No Pi (
whichis empty, orpi --versiongives empty stdout, soinstalledis""): theStopgoes up again, andinstall()returns 1 before any change. The behavior is the same as before. removesuffix(' Nothing was changed.')matches thelatest_pitext exactly (space included). The shown text ends at "set CG_PI_NPM_REGISTRY.", so it does not say "Nothing was changed." when the install goes on.ensure_pihas one caller (install, line 165). No other path callslatest_pi.
- Pi installed,
- Tests:
FakeShell.npm_view_errorreturns code 1 with stderr fornpm viewonly. Both new tests check the message, that nonpm installran, and if the package step ran or not. They cover the two branches of the new code. - Docs: the how-to line and the design doc (step 2 and the failure table) agree with the code. The "Pi stays" text matches the output.
- PR body: it names the behavior change at the top with who, old, new and how to turn it off, and it records a human's yes (Vitaly Zabershinsky, 2026-11-24). Data dependence: none, which is correct; the change adds no read or write of stored data.
- Fail open: this is the installer, not the request path. The change makes the installer less strict only when an installed Pi needs no npm.
- No binary or LFS file in the diff.
- I did not run the tests. Live tests are not approved, and this review reads the code only.
amiddavid
pushed a commit
that referenced
this pull request
Nov 24, 2026
#1326) fix(pi): the installer names its folders, asks about a moved Pi folder In a terminal left from a test, PI_CODING_AGENT_DIR and XDG_STATE_HOME pointed to test folders. The installer used them, said "Done. Start Pi with: pi", and the user's own Pi was not routed (#1319). Nothing told the user which folders it used. - Step 2 names Pi's settings folder and context-guru's data folder. - When PI_CODING_AGENT_DIR is set, it says so and asks "Use these folders? [y/N]" before any change. No stops, and says to open a new terminal or unset the variables. Uninstall asks the same, so a test-folder install can still be removed. - The last line names the pi it used, and says to open a new terminal if the terminal finds another one (bash caches paths). Only PI_CODING_AGENT_DIR triggers the question: many Linux users set the XDG variables on purpose; those folders are named anyway. Tested: 57 installer tests (5 new). The owner's case in a real pty with a local release: the folders are named, "n" stops, nothing is written. Behavior change: users who run the installer with PI_CODING_AGENT_DIR set. Old: it used that folder without a word. New: it asks first; the default is no. To keep the old behavior, answer y. Data dependence: none. Fixes #1319 fix(pi): the review notes on #1326 - PI_CODING_AGENT_DIR that names the default ~/.pi/agent asks no question ("in X, not in X" before). - The stop message says only "open a new terminal": a test can also put another pi first on PATH, which `unset` does not undo. - The last line drops the "(path)" when pi is not on PATH, so it no longer says "pi (pi)". - Tests: main() passes confirm_folders=True; the XDG_STATE_HOME text; the default folder; the last line without a path. Pi behavior change: the PR author (Vitaly) gave his yes on the PR; Pi changes are FYI to the owner (owner rule 2026-11-20). The owner (David Amid, 2026-11-24, integrator session) asked the integrator to merge the Pi set "as you see fit". Integrator check on current main + #1326 + #1330: the Pi unittest suites, the release tests and go test ./pi-package/... pass. Assisted-By: Claude Opus 5.5 Signed-off-by: Vitaly Zabershinsky <[email protected]>
This was referenced Nov 24, 2026
Collaborator
Author
|
Behavior change approved (owner): when npm cannot read the registry, the installer keeps the installed Pi and goes on. Posted by my assistant at my request. — Vitaly |
amiddavid
added a commit
that referenced
this pull request
Nov 24, 2026
chore(plugins): bump the plugin versions for v0.7.8 - Pi package: 0.1.6 -> 0.1.7 (#1326, #1330, #1335, #1342, #1344). - OpenCode plugin: pinned proxy version v0.7.7 -> v0.7.8. - Unchanged: Claude Code plugin 0.7.8 (test files only changed since v0.7.7), Codex 0.2.14, Bob 0.1.3. Release owner (David Amid, 2026-11-24, integrator session): cut v0.7.8 now. Version bumps are under the owner standing approval. Assisted-By: Claude Opus 5.5 Signed-off-by: DAVID AMID <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Behavior change (edge case), approved by Vitaly Zabershinsky (2026-11-24):
install-pi.shwith Pi installed, while npm cannot read the registry (for exampleE401from a company.npmrc, or a blocked network).CG_PI_NPM_REGISTRY, then run the installer again.Data dependence: none. No change to what the installer reads or stores.
Summary
At the Pi step, the installer asks npm for the latest Pi version before it looks at the installed Pi. When that npm call fails, the whole install stops, even though keeping the installed Pi needs no npm.
What changed
pi-package/scripts/install_pi.py:ensure_picatches the failednpm view. With Pi installed, it keeps that Pi and returns. With no Pi, it stops as before.test_install_pi.py: a failing registry with Pi installed (the install goes on to the package step), and with no Pi (it stops and changes nothing).docs/how-to/install-pi-package.mddescribe the new case.How it was tested
pi-package/scriptsandpi-package/releasetests pass.Technical notes
The OpenCode installer (#1296) has the same rule. Reviewer 1 found the problem there in review round 3.