Skip to content

fix: publish releases even when release PR refresh fails - #39

Merged
ThomasK33 merged 2 commits into
mainfrom
fix/release-outputs-before-pr-refresh
Aug 18, 2026
Merged

fix: publish releases even when release PR refresh fails#39
ThomasK33 merged 2 commits into
mainfrom
fix/release-outputs-before-pr-refresh

Conversation

@ThomasK33

Copy link
Copy Markdown
Member

What happened to sandbox-v0.4.0

When release PR #34 merged (12:28 UTC today), the release-please run's attempt 1:

  1. Created the sandbox-v0.4.0 tag + GitHub release ✅ (12:29:05)
  2. Flipped PR chore(sandbox): release 0.4.0 #34's label to autorelease: tagged
  3. Crashed refreshing the sibling release PR branches — Error updating ref heads/release-please--branches--main--components--provider inside Manifest.createPullRequests()
  4. Never reached emitOutputs()packages/sandbox--release_created was never written → all publish jobs skipped

The manual re-run (attempt 2) saw the release as already tagged, emitted no outputs, and went green without publishing. Result: sandbox-v0.4.0 exists on GitHub but @coder/ai-sdk-sandbox@0.4.0 never reached npm. (provider@0.3.1 and agent@0.4.1 published fine in their own runs.)

Fix (three layers)

  1. cli.ts: emit the release outputs immediately after createReleases(), before any release-PR housekeeping. The PR refresh and check re-runs become non-fatal — surfaced as a ::warning:: annotation; the next push retries them anyway.
  2. Workflow: publish-job conditions add !cancelled() so outputs written before a later job failure still trigger the publishes.
  3. publish-recovery job (workflow_dispatch): republishes an already-tagged release whose npm publish never ran. OIDC trusted publishing accepts it because it lives in the same workflow file. Guards: tag must match the checked-out package.json version, and the version must not already be on npm.

Recovering sandbox-v0.4.0

After this merges:

gh workflow run release-please.yml --repo coder/ai-sdk -f release_tag=sandbox-v0.4.0

No need to delete/re-create the tag or GitHub release.

Testing

  • 4 new unit tests: outputs-before-refresh ordering, refresh failure, and manifest reload failure all still return the created releases
  • pnpm check (oxfmt, oxlint, typecheck) and actionlint pass

🤖 Generated with Claude Code

ThomasK33 and others added 2 commits August 18, 2026 15:29
The sandbox-v0.4.0 release was tagged on GitHub but never published to
npm: the release run crashed while refreshing sibling release PR
branches (a ref-update race), after createReleases() had tagged the
release but before the job emitted its release_created outputs. The
re-run then saw the release as already tagged, emitted no outputs, and
skipped every publish job — losing the npm publish permanently.

Three layers of fix:

- cli.ts now emits release outputs immediately after createReleases()
  and treats the release-PR refresh and check re-runs as non-fatal
  housekeeping, surfaced as a workflow warning annotation. The next
  push to main retries the refresh anyway.
- The publish jobs' conditions add !cancelled() so outputs written
  before a job failure still trigger the publishes.
- A workflow_dispatch publish-recovery job republishes an
  already-tagged release whose npm publish never ran (guarded against
  tag/manifest version mismatch and already-published versions), so
  this failure mode no longer requires deleting and recreating
  releases to recover.

Change-Id: I669756fe5585d45746fd00e1c6bf0fb86d5b98f2
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Thomas Kosiewski <tk@coder.com>
zizmor flags step-output expansion inside run blocks as template
injection; route it through an env var like the other workflows.

Change-Id: I7d395ab71db7a75fb7eccb9a191e96e75b32adca
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Thomas Kosiewski <tk@coder.com>
@ThomasK33
ThomasK33 marked this pull request as ready for review August 18, 2026 13:37
@ThomasK33
ThomasK33 added this pull request to the merge queue Aug 18, 2026
Merged via the queue into main with commit 0547847 Aug 18, 2026
6 checks passed
@ThomasK33
ThomasK33 deleted the fix/release-outputs-before-pr-refresh branch August 18, 2026 13:39
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