fix(release): unbreak deploy step for 1.118 release#6
Merged
Conversation
added 3 commits
May 25, 2026 03:56
sign.ts in the cloned cortexide IDE source gates main() behind `if (import.meta.main)`. That property is only defined on Node 23+ (behind a flag) and Node 24+ (unflagged). The macOS release workflow runs on actions/setup-node@v4 with node-version 22.15.1, so the guard is undefined → falsy → main() never runs → sign() is never called. The signing step completes in ~150ms (no actual work), the resulting CortexIDE.app is unsigned, and the subsequent `codesign --verify` fails with: CortexIDE.app: code object is not signed at all Repro: stable-macos run 26356902456 (both x64 and arm64 jobs). We can't edit the cloned IDE source from this repo and we don't want to drop another patch into patches/osx/ that will go stale every time upstream touches sign.ts (the existing fix-codesign.patch is already showing "corrupt patch" errors). Instead, sed the guard in place right before invoking node — it's a single-line, well-targeted swap and the patch is a no-op once we upgrade past Node 22. We always invoke this file directly via `node sign.ts <pwd>` and never import it as a module, so unconditionally running main() is safe. Confidence: HIGH — the unsigned-app symptom matches exactly what `import.meta.main === undefined` would produce.
When RELEASE_GITHUB_TOKEN is missing/expired/lacks scope, the existing
flow fails very slowly:
1. `gh release view ... 2>&1` returns HTTP 401 body, but the regex
match against "release not found" is false, so we skip release
creation.
2. The upload loop runs and gets 401 on the first asset, then sleeps
15s/30s/45s/.../150s between 10 retries against the same dead
token before giving up.
3. Final error message is buried under thousands of lines.
Repro: stable-linux 26356903381 (50min wasted), stable-windows
26356902896 (1h34min wasted) — both ultimately HTTP 401 Bad credentials
calling cortexide-binaries.
Add an explicit auth/permission probe at the top of release.sh:
- If the token can't authenticate at all, emit an actionable
`::error::` message naming the secret to rotate and exit 1.
- If the token authenticates but lacks push on the binaries repo,
say so explicitly and exit 1.
This converts a 50-90min silent failure into a 5-second hard fail
with the operator-facing remediation steps right next to it.
Confidence: HIGH — purely additive probe, can only fail-fast paths
that would already have failed slowly.
update_version.sh runs as a separate workflow step from release.sh (both guarded by SHOULD_DEPLOY=yes) and writes to cortexide-versions. The same expired-PAT failure mode applies: the existing flow would die deep inside `git clone` or `git push` with a cryptic message after attempting the network round-trip. Mirror the release.sh probe so both steps surface the same actionable error pointing at the same secret to rotate. Confidence: HIGH — additive, fail-fast, no behavior change on the happy path.
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
All three release workflows for the 1.118 release failed on the
workflow_dispatchretrigger today (2026-05-24). Same commits succeeded yesterday on push, but yesterdaycheck_cron_or_pr.shforcedSHOULD_DEPLOY=no, so the deploy code paths never ran. OnceSHOULD_DEPLOY=yeskicked in, two distinct latent bugs surfaced.Nothing was published — there is no
1.118.10001tag oncortexide-binaries(latest is still1.106.00910from 2025-12-29), so there is no tag collision to clean up.sign.tsimport.meta.mainisundefinedon Node 22 → main() never runs → .app is unsigned →codesign --verifyfails withcode object is not signed at allgh release upload ...returnsHTTP 401: Bad credentialsagainstcortexide-binaries. TheRELEASE_GITHUB_TOKENPAT (last updated 2025-11-05) has expired or been revoked.HTTP 401: Bad credentialsagainstcortexide-binaries.4 of 6 failed jobs are the same expired-PAT issue. 2 of 6 are the macOS signing bug.
Fixes in this PR
1.
fix(macos-sign)—prepare_assets.sh(commit12e770f) — confidence: HIGHThe cortexide IDE's
vscode/build/darwin/sign.tsgatesmain()behindif (import.meta.main). That property exists on Node 23+ behind a flag and Node 24+ unflagged — but the workflow usesactions/setup-node@v4withnode-version: '22.15.1', where it isundefined. Result: main() never runs, the app is never signed, verification fails.We can't easily patch the cloned IDE source (
vscode/is gitignored here and the existingpatches/osx/fix-codesign.patchis already silently failing — see "corrupt patch at brand.patch:254" red-herring in the mac log). The minimal robust fix is tosedthe guard totrueinprepare_assets.shimmediately before invoking node. This script only ever calls sign.ts as a CLI, never imports it as a module, so unconditionally enteringmain()is safe. The patch is a no-op once we upgrade past Node 22.This was introduced by commit
3d35f14 fix(ci): macOS sign.ts extension; ppc64le node URL via unofficial-builds— switching fromsign.js(CommonJSrequire.main === module) tosign.ts(ESMimport.meta.main) without verifying the new guard works on the runner's Node version.2.
fix(release)—release.sh(commit7aaca14) — confidence: HIGHOn 401,
gh release viewbody does not contain "release not found", so the regex falls through, we skip release creation, then the upload loop hits 401 on every retry — 10 retries × increasing sleep × per-asset × ~6 asset types per arch = ~50min on Linux and ~1h34min on Windows before exit 1.Added an explicit auth/permission probe at the top of
release.shthat fails fast in seconds with an actionable::error::message naming the secret to rotate.3.
fix(release)—update_version.sh(commitf215da0) — confidence: HIGHSame probe pattern, applied to the versions-repo write step. Catches the same expired-PAT failure before the script hits a deep
git push.REQUIRED MANUAL STEP BEFORE MERGE / RE-DISPATCH
The macOS fix alone won't ship the release — the Linux + Windows failures are a credential problem only the org admin can fix.
You must rotate
RELEASE_GITHUB_TOKENin this repo's Secrets (Settings → Secrets and variables → Actions → Repository secrets → RELEASE_GITHUB_TOKEN).Required scopes on the new PAT:
repo(full control) — needed for cross-repo release upload andgit pushto the versions repo.Contents: Read and writeANDMetadata: Read-only, scoped to:OpenCortexIDE/cortexide-binariesOpenCortexIDE/cortexide-versionsCurrent secret state (from
gh secret list -R OpenCortexIDE/cortexide-builder):RELEASE_GITHUB_TOKEN— last updated 2025-11-05 (~6.5 months ago — likely hit its expiry)STRONGER_GITHUB_TOKENsecret exists (commented-out references instable-linux.ymlare dead refs).Things intentionally NOT fixed in this PR
patches/osx/fix-codesign.patch— it targets an old upstream sign.ts shape and emits a "corrupt patch" warning. It is a red herring for today's failure (build script explicitly treats patch failures as non-fatal). Fixing the patch is a separate cleanup.STRONGER_GITHUB_TOKENreferences in.github/workflows/stable-linux.ymllines 399, 491, 584, 621 — they're either inside commented blocks or only reachable on a code path that isn't broken. Best handled in a separate, dedicated cleanup PR.notarytoolandxcrun staplerpaths in prepare_assets.sh — not exercised in today's failure (signing died before notarization). They may have latent issues, but we won't know until signing works.Test plan
RELEASE_GITHUB_TOKENper the manual step above.gh secret list -R OpenCortexIDE/cortexide-buildershould show a recentUpdatedtimestamp).+ token OKand the signing step now produces a verified signature.Hard constraints honored
gh run view/gh api/gh release list/gh secret listcalls.cortexide-binaries(none needed deletion — no1.118.10001tag exists).cortexide-builder. The IDE repo (cortexide) and website repo are untouched.--no-verifycommits, no secrets in source, no PAT provisioning attempted.🤖 Generated with Claude Code