Skip to content

fix(cli): a pi prerelease never passes the public version gate (F363) - #3798

Merged
lilyshen0722 merged 2 commits into
mainfrom
swe/f363-pi-prerelease
Nov 9, 2026
Merged

lilyshen0722 merged 2 commits into
mainfrom
swe/f363-pi-prerelease

Conversation

@lilyshen0722

Copy link
Copy Markdown
Contributor

A public pi seat runs only smoke-tested pi versions (TESTED_PI_VERSIONS, today 0.84.1). The version probe matched \b(\d+\.\d+\.\d+)\b, so a pi answering 0.84.1-rc.1 read as 0.84.1 and passed the gate, letting the public seat run a prerelease.

versionOf in cli/src/lib/adapters/pi.js now keeps the -prerelease suffix, so the gate refuses the prerelease before pi starts. This is the same fix #3430 makes in goose.js. The pi doc notes the prerelease case.

Test. A new case in adapters.pi.public.test.mjs runs a fake pi that answers the prerelease, and checks that the spawn is refused with the full version named and that pi never starts. It fails on the old code ("Received promise resolved instead of rejected"). The pi adapter suites pass 220/220, and eslint src is clean.

🤖 Generated with Claude Code

https://claude.ai/code/session_01N4VWLCRBDAw5irQCF9SYye

versionOf matched \b(\d+\.\d+\.\d+)\b, so a pi answering 0.84.1-rc.1 read
as the tested 0.84.1 and a public seat would run the prerelease. The
version now keeps its -prerelease suffix, so the gate refuses it before
pi starts. The same fix as goose.js in #3430. A probe test with a fake pi
answering the prerelease fails on the old code.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01N4VWLCRBDAw5irQCF9SYye
@coderabbitai

coderabbitai Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 32 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 0860278 and 5ad148b.

Files selected for processing: 3

  • cli/__tests__/adapters.pi.public.test.mjs
  • cli/src/lib/adapters/pi.js
  • docs/agents/pi-adapter.md
  • 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.

Share

…c1 stays unknown (F363, review)

The review of 96df619 found that dropping the old trailing \b widened the
gate: 0.84.1rc1, 0.84.1a and 0.84.1_x read as 0.84.1 and passed, where
main refused them as unknown. The boundary is back after the optional
prerelease group; hyphen prereleases are still read in full. A probe test
for 0.84.1rc1 fails without it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01N4VWLCRBDAw5irQCF9SYye

@lilyshen0722 lilyshen0722 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GATE: PASS @ 5ad148b: the pi public gate refuses hyphen prereleases, and the trailing word boundary is back, so versions run into letters stay unknown

Verdict

Approve. The one review held at 96df619 on one Important finding. Commit 5ad148b fixes exactly that finding, and I re-checked it below.

Important (fixed in 5ad148b)

  • cli/src/lib/adapters/pi.js:503: the new regex had dropped the old trailing \b, so 0.84.1a, 0.84.1alpha, 0.84.1rc1 and 0.84.1_x read as 0.84.1 and passed TESTED_PI_VERSIONS.includes (pi.js:798). On main, those same inputs read as unknown and were refused. The boundary is restored after the optional prerelease group.
    • Re-checked with node -e over the same inputs. Old main and the fixed regex now agree on all four: null, refused. 0.84.1-rc.1 is still read in full, and pi 0.84.1\n and 0.84.1 still read as 0.84.1.
    • Test: "a version run into letters is unknown, not the tested version" (adapters.pi.public.test.mjs). On 96df619 it fails, because that regex reads 0.84.1rc1 as the tested version.

Nits

  • pi.js:503: 0.84.1+build reads as 0.84.1. That is unchanged from main, and semver treats build metadata as the same version.

What I checked

  • Hyphen prereleases are refused in full: -rc.1, -beta, -0, --x, -rc.1+b, pi 0.84.1-rc.1\n, and an rc line followed by a plain line.
  • Every plain shape main accepted still passes: a bare version, trailing \n or \r\n, padded, pi 0.84.1, pi version 0.84.1, 0.84.1 (abc), @scope/[email protected], pi-coding-agent/0.84.1 darwin-arm64 node-v22.1.0.
  • v0.84.1 and ANSI-coloured output are refused before and after the change, so the gate still fails closed.
  • The prerelease test fails on main ("Received promise resolved instead of rejected"). jest adapters.pi passes 221/221 at 5ad148b, and eslint src is clean.
  • Not measured: a real pi prerelease binary's --version output. Every input above was synthetic.
  • The same boundary slip was in the goose fix on #3430. It is fixed there too, in d23057d, with the matching test.

What's good

  • Both tests assert the refusal text and that nothing was spawned. They check the effect, not only the parsed value.

Written by Claude (Opus 5.5), the review subagent for Lily Shen's session, re-checked by the author's session after the fix
GATE: PASS

@lilyshen0722
lilyshen0722 added this pull request to the merge queue Nov 9, 2026
Merged via the queue into main with commit 6010708 Nov 9, 2026
34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant