-
-
Notifications
You must be signed in to change notification settings - Fork 576
fix(agents): pin pi-coding-agent to 0.80.7 for AuthStorage #366
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
rome-xi
wants to merge
1
commit into
Waishnav:main
Choose a base branch
from
rome-xi:fix/360-pi-authstorage-pin
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+139
−19
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,104 @@ | ||
| import assert from "node:assert/strict"; | ||
| import { readFileSync } from "node:fs"; | ||
| import test from "node:test"; | ||
| import { satisfies } from "semver"; | ||
| import { parse as parseYaml } from "yaml"; | ||
|
|
||
| // 0.80.8 dropped AuthStorage. pi-coding-agent@0.80.7 still exports it, but | ||
| // depends on its sibling packages with ^0.80.7. pnpm 11 ignores that | ||
| // package's npm-shrinkwrap and package.json overrides, so those ranges | ||
| // install 0.80.10 and AuthStorage fails to load (getOAuthApiKey was | ||
| // removed). The direct pin is for npm; pnpm-workspace.yaml overrides keep | ||
| // the frozen lockfile on 0.80.7. See Waishnav/devspace#360. | ||
| const PI_PACKAGE = "@earendil-works/pi-coding-agent"; | ||
| const PI_SIBLINGS = [ | ||
| "@earendil-works/pi-agent-core", | ||
| "@earendil-works/pi-ai", | ||
| "@earendil-works/pi-tui", | ||
| ] as const; | ||
| const AUTOSTORAGE_PIN = "0.80.7"; | ||
| const AUTOSTORAGE_REMOVED_VERSIONS = ["0.80.8", "0.80.9", "0.80.10"] as const; | ||
|
|
||
| type PackageManifest = { | ||
| dependencies?: Record<string, string>; | ||
| overrides?: Record<string, string>; | ||
| }; | ||
|
|
||
| const packageJson = JSON.parse( | ||
| readFileSync(new URL("../package.json", import.meta.url), "utf8"), | ||
| ) as PackageManifest; | ||
|
|
||
| function declaredSpecifier(): string { | ||
| const specifier = packageJson.dependencies?.[PI_PACKAGE]; | ||
| if (typeof specifier !== "string") { | ||
| assert.fail(`${PI_PACKAGE} must be a direct dependency`); | ||
| } | ||
| return specifier; | ||
| } | ||
|
|
||
| test("pi-coding-agent cannot resolve to an AuthStorage-less release", () => { | ||
| const specifier = declaredSpecifier(); | ||
| for (const version of AUTOSTORAGE_REMOVED_VERSIONS) { | ||
| assert.equal( | ||
| satisfies(version, specifier), | ||
| false, | ||
| `declared ${PI_PACKAGE}@${specifier} satisfies ${version}, which dropped AuthStorage (issue #360). Pin exact ${AUTOSTORAGE_PIN}.`, | ||
| ); | ||
| } | ||
| assert.equal( | ||
| specifier, | ||
| AUTOSTORAGE_PIN, | ||
| `${PI_PACKAGE} must be the exact pin ${AUTOSTORAGE_PIN}, the last release that still exports AuthStorage`, | ||
| ); | ||
| }); | ||
|
|
||
| test("pi sibling packages stay on the AuthStorage pin", () => { | ||
| const npmOverrides = packageJson.overrides ?? {}; | ||
| const workspace = parseYaml( | ||
| readFileSync(new URL("../pnpm-workspace.yaml", import.meta.url), "utf8"), | ||
| ) as { overrides?: Record<string, string> }; | ||
| const pnpmOverrides = workspace.overrides ?? {}; | ||
| for (const name of PI_SIBLINGS) { | ||
| assert.equal( | ||
| npmOverrides[name], | ||
| AUTOSTORAGE_PIN, | ||
| `${name} must be overridden in package.json to exact ${AUTOSTORAGE_PIN} so a fresh npm install cannot float onto an AuthStorage-less release`, | ||
| ); | ||
| assert.equal( | ||
| pnpmOverrides[name], | ||
| AUTOSTORAGE_PIN, | ||
| `${name} must be overridden in pnpm-workspace.yaml to exact ${AUTOSTORAGE_PIN}; pnpm 11 does not apply package.json overrides`, | ||
| ); | ||
| } | ||
| }); | ||
|
|
||
| test("lockfile freezes the AuthStorage pin for the whole pi family", () => { | ||
| const lockText = readFileSync(new URL("../pnpm-lock.yaml", import.meta.url), "utf8"); | ||
| const match = lockText.match( | ||
| /'@earendil-works\/pi-coding-agent':\r?\n\s+specifier: ([^\r\n]+)\r?\n\s+version: ([^\s(]+)/, | ||
| ); | ||
| assert.ok(match, "pnpm-lock.yaml importer must record @earendil-works/pi-coding-agent"); | ||
| assert.equal(match[1], declaredSpecifier()); | ||
| assert.equal(match[1], AUTOSTORAGE_PIN); | ||
| assert.equal(match[2], AUTOSTORAGE_PIN); | ||
|
|
||
| for (const name of [PI_PACKAGE, ...PI_SIBLINGS]) { | ||
| const escaped = name.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); | ||
| const versions = [...lockText.matchAll(new RegExp(`${escaped}@(\\d+\\.\\d+\\.\\d+)`, "g"))].map((found) => found[1]); | ||
| assert.ok(versions.length > 0, `pnpm-lock.yaml must record ${name}`); | ||
| for (const version of versions) { | ||
| assert.equal( | ||
| version, | ||
| AUTOSTORAGE_PIN, | ||
| `${name}@${version} is locked; only ${AUTOSTORAGE_PIN} still matches the AuthStorage session factory`, | ||
| ); | ||
| } | ||
| } | ||
| }); | ||
|
|
||
| test("pi session factory still constructs AuthStorage", () => { | ||
| const source = readFileSync(new URL("./local-agent-pi.ts", import.meta.url), "utf8"); | ||
| assert.match(source, /AuthStorage,\s*\n\s*ModelRegistry,/); | ||
| assert.match(source, /AuthStorage\.create\(/); | ||
| assert.match(source, /ModelRegistry\.create\(/); | ||
| }); | ||
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These assertions only compare override text in repository manifests; they never install DevSpace from a separate consumer project or inspect the resolved Pi dependency tree. A fresh consumer installation can resolve the Pi siblings to 0.80.10 while this predicate still passes, so the test provides false confidence that published dependency resolution remains pinned. This is non-blocking, but it leaves consumer dependency-resolution regressions undetected.
Artifacts
Evidence from the check
Command output from the check