[STG-1739] fix: browse-cli releases publish under alpha instead of latest#1934
Merged
[STG-1739] fix: browse-cli releases publish under alpha instead of latest#1934
Conversation
…e corruption
The changesets/action step corrupts git HEAD by checking out
changeset-release/main. This caused the browse-cli version check to
always fail (comparing wrong commits), so clean versions were never
published under `latest` — instead the canary step picked them up and
published under `alpha`.
Changes:
- Replace HEAD/HEAD^ with ${{ github.sha }} so the check is immune to
branch switches
- Add `git checkout ${{ github.sha }}` to restore working tree before
publish
- Add `--tag latest` to the browse-cli publish command
- Add a browse-cli canary step that publishes alpha-tagged pre-releases
on feature branch merges (matching stagehand's canary pattern)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
monadoid
approved these changes
Mar 31, 2026
Contributor
There was a problem hiding this comment.
1 issue found across 1 file
Confidence score: 3/5
- There is a concrete risk that later steps in the same job see a dirty workspace because the canary step modifies
package.jsonand never restores it in.github/workflows/release.yml. - This is a medium-severity CI/release flow issue (7/10) with high confidence, so the change has some user-impacting risk even if it doesn’t affect runtime behavior.
- Pay close attention to
.github/workflows/release.yml- ensure the canary step cleans up or restorespackage.jsonbefore subsequent steps.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name=".github/workflows/release.yml">
<violation number="1" location=".github/workflows/release.yml:132">
P1: The canary step updates `package.json` but never restores it, leaving the workspace dirty for later steps in the same job.</violation>
</file>
Architecture diagram
sequenceDiagram
participant Runner as GitHub Actions Runner
participant Git as Git (Local Repo)
participant CSA as Changesets Action
participant NPM as NPM Registry
Note over Runner,NPM: Trigger: Merge to main branch
Runner->>CSA: Run changesets/action
CSA->>Git: CHANGED: Checkout changeset-release/main
CSA-->>Runner: (Alters HEAD state)
Runner->>Git: NEW: git checkout ${{ github.sha }}
Note right of Git: Ensures HEAD points to the merge commit,<br/>ignoring Changeset's branch switch
Runner->>Git: CHANGED: git diff ${{ github.sha }}^ ${{ github.sha }} (package.json)
Git-->>Runner: Return diff result
alt Version Bump Detected (Clean Release)
Runner->>Runner: Extract OLD/NEW versions via git show ${{ github.sha }}
Runner->>Runner: pnpm pack
Runner->>NPM: CHANGED: npm publish --tag latest
Runner->>Git: git tag & push tag
else No Version Bump (Canary Path)
Runner->>Git: NEW: git diff --quiet ${{ github.sha }}^ ${{ github.sha }} (packages/cli/)
alt Files Changed
Runner->>Runner: NEW: Generate X.Y.Z-alpha-{shortSha}
Runner->>NPM: NEW: Check if version exists
opt Version does not exist
Runner->>Runner: NEW: Update package.json version
Runner->>Runner: pnpm pack
Runner->>NPM: NEW: npm publish --tag alpha
end
else No Changes
Runner->>Runner: Skip canary
end
end
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
monadoid
approved these changes
Mar 31, 2026
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.
Summary
changesets/actionstep corrupts git state by checking outchangeset-release/mainand creating a new commit. After it returns,HEADpoints to the wrong branch/commit. The browse-cli check step usesHEAD/HEAD^which are now wrong, so it always says "browse-cli version did not change" and skips the publish. Then the stagehand canary step (changeset publish --tag alpha) finds the unpublished version and publishes it underalphainstead oflatest.HEAD/HEAD^references with${{ github.sha }}/${{ github.sha }}^(the actual merge commit SHA, immune to branch switches). Addgit checkout ${{ github.sha }}to restore the working tree. Add explicit--tag latestto the publish command.X.Y.Z-alpha-{sha}versions under thealphatag on feature branch merges (matching stagehand's existing canary pattern).What was happening
changesets/actionruns, switches tochangeset-release/main, creates commitHEADnow points to the changeset PR commit, not the merge commitshould_publish=falsechangeset publish --tag alpha, which picks up the unpublished browse-cli and publishes it underalphanpm info @browserbasehq/browse-clishowslatest: 0.3.0,alpha: 0.4.0What this PR does
${{ github.sha }}(the actual merge commit) instead ofHEADfor all git comparisonsgit checkout ${{ github.sha }}to restore the working tree after changesets/action--tag latestto thenpm publishcommand for clean releasesX.Y.Z-alpha-{sha}underalphatag)Validation
HEADwas pointing tochangeset-release/mainafter the changesets stepnpm view @browserbasehq/browse-clishowslatest: 0.3.0whilealpha: 0.4.1(the bug in action)${{ github.sha }}is set by GitHub Actions to the merge commit SHA and is immutable throughout the runLinear
https://linear.app/browserbase/issue/STG-1739/fix-browse-cli-release-publishes-under-alpha-instead-of-latest
🤖 Generated with Claude Code
Summary by cubic
Fixes the release workflow so
@browserbasehq/browse-cliclean releases publish tolatest, and canaries publish toalpha. Addresses Linear STG-1739 by using the immutable merge SHA to avoidchangesets/actionHEAD switches.Bug Fixes
${{ github.sha }}/${{ github.sha }}^for diffs and version reads to avoid wrongHEAD.packages/cli/package.jsonafter canary publish.npm publish ... --tag latest.New Features
X.Y.Z-alpha-{shortSha}toalphawhen CLI files changed but no clean release occurred.Written for commit c075ece. Summary will update on new commits. Review in cubic