From bc3fda518d177d6435afb29b952b3baa13018602 Mon Sep 17 00:00:00 2001 From: Aliou Diallo Date: Sun, 1 Feb 2026 21:43:54 +0100 Subject: [PATCH] fix(coding-agent): only update extension in scope it's in update(source) unconditionally called updateSourceForScope for both user and project scopes, creating a local install even when the source was only registered globally. Unify into a single code path that iterates settings per scope, filtering by identity when a source is provided. --- packages/coding-agent/CHANGELOG.md | 1 + packages/coding-agent/src/core/package-manager.ts | 10 ++++------ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/packages/coding-agent/CHANGELOG.md b/packages/coding-agent/CHANGELOG.md index 788bc277..bf85b765 100644 --- a/packages/coding-agent/CHANGELOG.md +++ b/packages/coding-agent/CHANGELOG.md @@ -27,6 +27,7 @@ - Fixed tree selector losing focus state when navigating entries ([#1142](https://github.com/badlogic/pi-mono/pull/1142) by [@Perlence](https://github.com/Perlence)) - Fixed `cacheRetention` option not being passed through in `buildBaseOptions` ([#1154](https://github.com/badlogic/pi-mono/issues/1154)) - Fixed OAuth login/refresh not using HTTP proxy settings (`HTTP_PROXY`, `HTTPS_PROXY` env vars) ([#1132](https://github.com/badlogic/pi-mono/issues/1132)) +- Fixed `pi update ` installing packages locally when the source is only registered globally ([#1163](https://github.com/badlogic/pi-mono/pull/1163) by [@aliou](https://github.com/aliou)) ## [0.50.9] - 2026-02-01 diff --git a/packages/coding-agent/src/core/package-manager.ts b/packages/coding-agent/src/core/package-manager.ts index 513677a8..2047d027 100644 --- a/packages/coding-agent/src/core/package-manager.ts +++ b/packages/coding-agent/src/core/package-manager.ts @@ -742,20 +742,18 @@ export class DefaultPackageManager implements PackageManager { } async update(source?: string): Promise { - if (source) { - await this.updateSourceForScope(source, "user"); - await this.updateSourceForScope(source, "project"); - return; - } - const globalSettings = this.settingsManager.getGlobalSettings(); const projectSettings = this.settingsManager.getProjectSettings(); + const identity = source ? this.getPackageIdentity(source) : undefined; + for (const pkg of globalSettings.packages ?? []) { const sourceStr = typeof pkg === "string" ? pkg : pkg.source; + if (identity && this.getPackageIdentity(sourceStr) !== identity) continue; await this.updateSourceForScope(sourceStr, "user"); } for (const pkg of projectSettings.packages ?? []) { const sourceStr = typeof pkg === "string" ? pkg : pkg.source; + if (identity && this.getPackageIdentity(sourceStr) !== identity) continue; await this.updateSourceForScope(sourceStr, "project"); } }