pi-mono/packages/coding-agent/src
robopipi[bot] 0d23d53457
fix(coding-agent): warn when an npm package update leaves the installed version unchanged (#11571)
## What was wrong

`pi update --extensions` first looks up the newest version of each npm
package with `npm view`. If that version is newer than the installed
one, pi runs `npm install <name>@latest`. The two commands read
different registry documents, and each is cached separately. Shortly
after a publish, `npm view` can already report the new version while
`npm install` still resolves the old one. npm then exits successfully,
pi prints "Updated packages", and the startup banner lists the same
package again on the next launch. The user can't tell that nothing was
actually updated.

## What the change does

- `shouldUpdateNpmSource` now returns the installed version and the
registry version along with its decision. Both are carried on
`NpmUpdateTarget`.
- After `npm install`, `updateNpmBatch` re-reads each package's
installed version. If the registry lookup succeeded and the version did
not change, it emits a `progress` event with the message: `<source> is
still X (registry reports Y); npm registry metadata may be stale, try
again in a few minutes`.
- The package CLI now prints `progress` events in yellow. Until now
nothing emitted them.

Install behavior is unchanged: pi still installs `@latest`.

## Testing

- New test in `test/package-manager.test.ts`: two packages are flagged
for update and only one is actually upgraded. The warning is emitted
only for the unchanged one. The test fails without the change.
- `test/package-manager.test.ts` passes (129 tests), and `npm run check`
passes.
- Ran the built CLI with an `npmCommand` stub whose `view` reports
`1.0.1` and whose `install` changes nothing:
  ```
  Updating npm:demo-pkg...
npm:demo-pkg is still 1.0.0 (registry reports 1.0.1); npm registry
metadata may be stale, try again in a few minutes
  Updated packages
  ```

Fixes #11536

Requested by @davidbrai

Co-authored-by: triagent <triagent@localhost>
2026-10-29 15:39:48 +01:00
..
bun feat(coding-agent): codemode and MCP 2026-09-29 09:12:50 +02:00
cli docs: fix provider checklist, MCP anchors, and missing commands/settings (#11338) 2026-10-23 17:02:41 +02:00
core fix(coding-agent): warn when an npm package update leaves the installed version unchanged (#11571) 2026-10-29 15:39:48 +01:00
experimental feat(coding-agent): remove the experimental server stack and the client, protocol, and server packages 2026-10-12 10:41:59 +00:00
extensions fix(tui,coding-agent): handle selection page keys in all scrolling lists 2026-10-28 19:05:21 +01:00
modes fix(coding-agent): label skill diagnostics as [Skill warnings] (#11566) 2026-10-29 14:25:50 +01:00
utils fix(coding-agent): strip private-parameter CSI sequences in stripAnsi 2026-10-28 20:14:09 +01:00
cli.ts fix(coding-agent): keep remote harness dependencies development-only 2026-09-05 12:45:04 +02:00
config.ts fix(coding-agent): keep codemode working after the install is updated or removed 2026-10-04 22:49:20 +02:00
index.ts fix(coding-agent): start when a configured package fails to install (#11304) 2026-10-23 12:27:45 +02:00
main.ts fix(coding-agent): report a deleted working directory instead of crashing on startup (#11511) 2026-10-28 09:51:39 +01:00
migrations.ts fix(coding-agent): update repository links to "earendil-works/pi" (#9278) 2026-09-07 14:09:39 +02:00
package-manager-cli.ts fix(coding-agent): warn when an npm package update leaves the installed version unchanged (#11571) 2026-10-29 15:39:48 +01:00
rpc-entry.ts feat(coding-agent): set AI_AGENT environment variable (#7493) 2026-08-03 13:45:32 +02:00