Skip to content

ci: build rolling unsigned macOS arm64 app on main pushes - #5

Merged
SynurDevelopers merged 7 commits into
mainfrom
ci/mac-main-builds
Dec 3, 2026
Merged

SynurDevelopers merged 7 commits into
mainfrom
ci/mac-main-builds

Conversation

@SynurDevelopers

Copy link
Copy Markdown
Collaborator

What this PR does

This PR adds a lightweight way to keep a local Apple Silicon macOS install of M3 Code up to date after every merge to main without needing an Apple Developer ID signing certificate.

Why

Electron's built-in macOS auto-updater (Squirrel.Mac) refuses to self-update unsigned apps. Until we set up Apple Developer ID signing and notarization, this workflow builds an unsigned arm64 bundle on every main push and pairs it with a small local updater script.

What changed

  • .github/workflows/mac-main-build.yml: On every push to main (or manual dispatch), builds an unsigned macOS arm64 .zip via vp run dist:desktop:dmg:arm64 and uploads M3-Code-arm64.zip + latest-main.json (commit SHA, version, timestamp) to the rolling main-latest prerelease on Synur-Tech/m3code.
  • scripts/update-local-mac-app.sh: Downloads latest-main.json via gh, compares the remote SHA to ~/.m3-local-installed-sha, and when newer, downloads M3-Code-arm64.zip, replaces /Applications/M3 Code (Beta).app using ditto, and clears com.apple.quarantine. Supports --skip-if-running (for background launchd polling), --relaunch, and --force.

How we tested it

  • Verified bash -n scripts/update-local-mac-app.sh, vp fmt, and vp lint.
  • Verified vp run dist:desktop:dmg:arm64 produces M3-Code-1.1.0-arm64.zip and extracts cleanly to /Applications/M3 Code (Beta).app.

Prepared with Antigravity (Gemini 4 Neon).

@github-actions

github-actions Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

Thread transfer impact

✅ Thread transfer remains within every enforced ceiling.

Provider Metric Main baseline This PR Impact PR ceiling
Codex Total thread wire 5.0 KiB 5.0 KiB 0 B (0.0%) 6.8 KiB ✅
Codex Thread snapshot wire 3.8 KiB 3.8 KiB 0 B (0.0%) 4.9 KiB ✅
Codex Live turn WebSocket wire 1.2 KiB 1.2 KiB 0 B (0.0%) 2.0 KiB ✅
Codex Live turn WebSocket decoded 21.5 KiB 21.5 KiB 0 B (0.0%) 24.4 KiB ✅
Codex Live turn messages 1 1 0 (0.0%) 8 ✅
Claude Total thread wire 5.0 KiB 5.0 KiB 0 B (0.0%) 6.8 KiB ✅
Claude Thread snapshot wire 3.8 KiB 3.8 KiB 0 B (0.0%) 4.9 KiB ✅
Claude Live turn WebSocket wire 1.2 KiB 1.2 KiB 0 B (0.0%) 2.0 KiB ✅
Claude Live turn WebSocket decoded 21.9 KiB 21.9 KiB 0 B (0.0%) 24.4 KiB ✅
Claude Live turn messages 1 1 0 (0.0%) 8 ✅

Other scenarios

All 64 scenario measurements match main.

All 64 scenario measurements
Provider Scenario Metric Main baseline This PR Impact PR ceiling
Codex short turn resume WebSocket decoded 10.5 KiB 10.5 KiB 0 B (0.0%) 12.7 KiB ✅
Codex short turn resume WebSocket messages 2 2 0 (0.0%) 2 ✅
Codex long turn running, cold open HTTP decoded 281.7 KiB 281.7 KiB 0 B (0.0%) 302.7 KiB ✅
Codex long turn running, cold open rows 75 75 0 (0.0%) 75 ✅
Codex long turn running, history page HTTP decoded 92.4 KiB 92.4 KiB 0 B (0.0%) 107.4 KiB ✅
Codex long turn running, history page rows 75 75 0 (0.0%) 75 ✅
Codex long turn finished, cold open HTTP decoded 381.5 KiB 381.5 KiB 0 B (0.0%) 410.2 KiB ✅
Codex long turn finished, cold open rows 151 151 0 (0.0%) 151 ✅
Codex long turn finished, socket cold open WebSocket decoded 381.6 KiB 381.6 KiB 0 B (0.0%) 410.2 KiB ✅
Codex long turn finished, socket cold open WebSocket messages 2 2 0 (0.0%) 2 ✅
Codex long turn finished, socket cold open rows 151 151 0 (0.0%) 151 ✅
Codex long turn finished, work page HTTP decoded 186.2 KiB 186.2 KiB 0 B (0.0%) 200.2 KiB ✅
Codex long turn finished, work page rows 150 150 0 (0.0%) 150 ✅
Codex idle thread resume WebSocket decoded 65 B 65 B 0 B (0.0%) 200 B ✅
Codex idle thread resume WebSocket messages 1 1 0 (0.0%) 1 ✅
Codex fleet shell snapshot HTTP decoded 42.4 KiB 42.4 KiB 0 B (0.0%) 53.7 KiB ✅
Codex fleet shell snapshot rows 27 27 0 (0.0%) 27 ✅
Codex fleet shell subscribe WebSocket decoded 65 B 65 B 0 B (0.0%) 200 B ✅
Codex fleet shell subscribe WebSocket messages 1 1 0 (0.0%) 1 ✅
Codex fleet shell resume check HTTP decoded 18 B 18 B 0 B (0.0%) 100 B ✅
Codex fleet shell resume check rows 0 0 0 0 ✅
Codex stale shell reload HTTP decoded 42.4 KiB 42.4 KiB 0 B (0.0%) 53.7 KiB ✅
Codex stale shell reload rows 27 27 0 (0.0%) 27 ✅
Codex stale shell resume WebSocket decoded 140 B 140 B 0 B (0.0%) 400 B ✅
Codex stale shell resume WebSocket messages 2 2 0 (0.0%) 2 ✅
Codex stale todo list cold open HTTP decoded 72.4 KiB 72.4 KiB 0 B (0.0%) 83.0 KiB ✅
Codex stale todo list cold open rows 75 75 0 (0.0%) 75 ✅
Codex stale todo list cold open nodes 2 2 0 (0.0%) 4 ✅
Codex stale todo list cold open subagents 2 2 0 (0.0%) 4 ✅
Codex stale todo list cold open plans 1 1 0 (0.0%) 2 ✅
Codex stale todo list cold open providerTurns 1 1 0 (0.0%) 2 ✅
Codex stale todo list cold open checkpoints 1 1 0 (0.0%) 2 ✅
Claude short turn resume WebSocket decoded 10.6 KiB 10.6 KiB 0 B (0.0%) 12.7 KiB ✅
Claude short turn resume WebSocket messages 2 2 0 (0.0%) 2 ✅
Claude long turn running, cold open HTTP decoded 283.3 KiB 283.3 KiB 0 B (0.0%) 302.7 KiB ✅
Claude long turn running, cold open rows 75 75 0 (0.0%) 75 ✅
Claude long turn running, history page HTTP decoded 93.4 KiB 93.4 KiB 0 B (0.0%) 107.4 KiB ✅
Claude long turn running, history page rows 75 75 0 (0.0%) 75 ✅
Claude long turn finished, cold open HTTP decoded 384.2 KiB 384.2 KiB 0 B (0.0%) 410.2 KiB ✅
Claude long turn finished, cold open rows 151 151 0 (0.0%) 151 ✅
Claude long turn finished, socket cold open WebSocket decoded 384.3 KiB 384.3 KiB 0 B (0.0%) 410.2 KiB ✅
Claude long turn finished, socket cold open WebSocket messages 2 2 0 (0.0%) 2 ✅
Claude long turn finished, socket cold open rows 151 151 0 (0.0%) 151 ✅
Claude long turn finished, work page HTTP decoded 188.1 KiB 188.1 KiB 0 B (0.0%) 200.2 KiB ✅
Claude long turn finished, work page rows 150 150 0 (0.0%) 150 ✅
Claude idle thread resume WebSocket decoded 66 B 66 B 0 B (0.0%) 200 B ✅
Claude idle thread resume WebSocket messages 1 1 0 (0.0%) 1 ✅
Claude fleet shell snapshot HTTP decoded 43.0 KiB 43.0 KiB 0 B (0.0%) 53.7 KiB ✅
Claude fleet shell snapshot rows 27 27 0 (0.0%) 27 ✅
Claude fleet shell subscribe WebSocket decoded 66 B 66 B 0 B (0.0%) 200 B ✅
Claude fleet shell subscribe WebSocket messages 1 1 0 (0.0%) 1 ✅
Claude fleet shell resume check HTTP decoded 18 B 18 B 0 B (0.0%) 100 B ✅
Claude fleet shell resume check rows 0 0 0 0 ✅
Claude stale shell reload HTTP decoded 43.0 KiB 43.0 KiB 0 B (0.0%) 53.7 KiB ✅
Claude stale shell reload rows 27 27 0 (0.0%) 27 ✅
Claude stale shell resume WebSocket decoded 140 B 140 B 0 B (0.0%) 400 B ✅
Claude stale shell resume WebSocket messages 2 2 0 (0.0%) 2 ✅
Claude stale todo list cold open HTTP decoded 73.4 KiB 73.4 KiB 0 B (0.0%) 83.0 KiB ✅
Claude stale todo list cold open rows 75 75 0 (0.0%) 75 ✅
Claude stale todo list cold open nodes 2 2 0 (0.0%) 4 ✅
Claude stale todo list cold open subagents 2 2 0 (0.0%) 4 ✅
Claude stale todo list cold open plans 1 1 0 (0.0%) 2 ✅
Claude stale todo list cold open providerTurns 1 1 0 (0.0%) 2 ✅
Claude stale todo list cold open checkpoints 1 1 0 (0.0%) 2 ✅

Baseline: cf72dc7 · PR result: 5ee4e2d · Source CI: success

Scenario and decoded snapshot size

10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.

  • Codex decoded thread snapshot: 108.5 KiB
  • Claude decoded thread snapshot: 108.8 KiB

Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

@SynurDevelopers

Copy link
Copy Markdown
Collaborator Author

Produced by a read-only local run of grok-4.6 with no GitHub token; posted by the orchestrator.

I'll review PR #5 from the local diff and the two changed files only, looking for blocking correctness or security issues.

Next I’ll read the security-review lens, then the PR diff and the two changed files.

I'll inspect referenced build config, package scripts, and related workflow/release patterns next.

I'll trace the desktop artifact build and existing macOS publish workflows to confirm ZIP output and release-upload patterns.

I'll check where electron-builder writes the ZIP and how gh --jq is used elsewhere in the repo.

The publish step will fail on every run that reaches it: gh release view --jq does not take jq’s --arg, so rolling uploads and ZIP retention never complete.

.github/workflows/mac-main-build.yml:68 and :84

gh release view --json … --jq takes one jq expression. --arg is a jq CLI flag, not a gh flag. Both of these invocations fail (typically flag needs an argument: --jq or unknown flag: --arg):

            existing_zip="$(gh release view "$TAG" --json assets --jq \
              --arg name "$ASSET_NAME" '[.assets[] | select(.name == $name)] | length')"
          stale_assets="$(gh release view "$TAG" --json assets --jq \
            --arg current "$ASSET_NAME" \
            '[.assets[] | select(.name != $current and (.name | test("^M3-Code-arm64-[0-9a-f]+\\.zip$")))] | sort_by(.updatedAt) | reverse | .[3:] | .[].name')"

This repo’s other workflows pass a single expression, e.g. --jq '.assets[].name'.

What goes wrong: First push to main creates the main-latest prerelease (ZIP + latest-main.json), then dies on the stale-asset listing. The Actions job is red. Every later push or rerun takes the “release exists” branch and dies on the existing_zip check before uploading a new ZIP or clobbering the manifest. The rolling feed stays stuck on that first commit. Same-commit ZIP reuse and “keep 3 prior ZIPs” never run.

This workflow does not run on the PR (push to main / workflow_dispatch with github.ref == refs/heads/main only), so PR CI will not catch it.

Suggested fix: Use gojq’s env ( ASSET_NAME is already in the step env) or pipe to jq --arg:

existing_zip="$(gh release view "$TAG" --json assets --jq \
  '[.assets[] | select(.name == env.ASSET_NAME)] | length')"

stale_assets="$(gh release view "$TAG" --json assets --jq \
  '[.assets[] | select(.name != env.ASSET_NAME and (.name | test("^M3-Code-arm64-[0-9a-f]+\\.zip$")))] | sort_by(.updatedAt) | reverse | .[3:] | .[].name')"

The updater script’s lock, escaped pgrep, pre-swap recheck / 15s --relaunch wait, same-volume staging, and trap restore are consistent with the stated intent.

VERDICT: REQUEST_CHANGES

@SynurDevelopers

Copy link
Copy Markdown
Collaborator Author

Produced by a read-only local run of gpt-6.2-sol with no GitHub token; posted by the orchestrator.

  1. The publish workflow fails on every subsequent build. gh release view supports --jq but has no --arg option. Once main-latest exists, the ZIP lookup exits before either asset can be uploaded. The same error breaks retention after the first release is created. Pipe gh release view --json assets into standalone jq --arg for both queries. .github/workflows/mac-main-build.yml:69, .github/workflows/mac-main-build.yml:85

  2. An interrupted publish can take the update feed offline. --clobber deletes the current latest-main.json before uploading its replacement. If a new push cancels the job between those operations and its build then fails, the updater cannot find the manifest until another publish succeeds. Upload a versioned manifest alongside the ZIP, then switch the updater’s pointer in a single release metadata update. .github/workflows/mac-main-build.yml:73

  3. Rerunning an older workflow can downgrade installed clients. After commit B is published, rerunning the workflow for commit A still passes the main ref guard and replaces the manifest with A. The updater treats the different SHA as an update and installs A over B. Verify that the run’s SHA still matches the remote main tip immediately before changing the published pointer. .github/workflows/mac-main-build.yml:73

  4. Stale-lock recovery can delete a live updater’s lock. Two invocations can both read the same dead PID. If one replaces the lock before the other reaches rm -rf, the second deletes the first’s new lock and also enters the swap. Their mv calls can then nest one staged bundle inside the other and record a SHA that does not match the installed app. Hold a macOS lockf lock through the entire update so the OS releases ownership when the process exits. scripts/update-local-mac-app.sh:46

  5. A termination signal releases the lock while the updater continues. The INT, TERM, and HUP handlers call cleanup and return. For example, a TERM just after the staged bundle moves into place releases the lock before the installed SHA is written. A second updater can acquire the lock, and the first updater’s EXIT cleanup can then delete it. Make signal handlers exit with the appropriate status and let the EXIT trap perform rollback and cleanup once. scripts/update-local-mac-app.sh:79

VERDICT: REQUEST_CHANGES

…arden updater lock

gh release view --jq has no --arg flag, so both asset lookups failed on every
run after the first; read ASSET_NAME through jq's env instead. Before writing
latest-main.json, confirm GITHUB_SHA is still the main tip so a rerun of an
older run cannot downgrade clients.

The updater now holds a flock(2) lock on fd 9 via lockf, which the kernel
releases on exit, replacing the mkdir lock and its racy stale-PID recovery.
HUP/INT/TERM traps exit with 128+n so the EXIT trap runs rollback and cleanup
once, instead of releasing the lock while the script kept running.

red-confirmed: gh release view --json assets --jq --arg name x '...' -> "accepts at most 1 arg(s), received 3"
yokoten: grep for "--jq" with "--arg" across .github/ found only the two fixed calls; files-touched: [.github/workflows/mac-main-build.yml, scripts/update-local-mac-app.sh]
pre-pr-check: not-applicable (shell/YAML only; check:changed typecheck fails in unrelated TS packages)
backend-test: not-applicable

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@SynurDevelopers

Copy link
Copy Markdown
Collaborator Author

Round-3 follow-up, fixed in fb742ad.

Fixed

  • A (both reviewers): the two gh release view --jq --arg ... lookups now read env.ASSET_NAME inside the single --jq expression (.github/workflows/mac-main-build.yml:82-83, :104-105). The old form fails locally with accepts at most 1 arg(s), received 3. The new expressions were checked against a public release.
  • B (codex ci: use GitHub-hosted runners so PR checks execute #3, stale rerun downgrade): is_main_tip compares GITHUB_SHA with gh api repos/$GITHUB_REPOSITORY/commits/main --jq .sha right before latest-main.json is uploaded or the release is created (:67-77, :87-89, :93-95). If the SHA is not the tip, or the tip can't be resolved, the step emits a notice or warning and exits 0. The manifest isn't written and retention doesn't run. The ZIP may still upload on the existing-release path.
  • C (codex chore: sync upstream MiaAI-Lab/m3code main #4, stale-lock race): the mkdir lock and its dead-PID recovery are gone. The updater opens ~/.m3-local-update.lockfile on fd 9 and takes a flock(2) lock with stock /usr/bin/lockf -s -t 0 9 (scripts/update-local-mac-app.sh:38-49). The kernel releases the lock when the process exits, so nothing has to be recovered and no run can delete another run's lock. Exit 75 (EX_TEMPFAIL) means another update holds the lock, and the script logs that and exits 0.
  • D (codex ci: build rolling unsigned macOS arm64 app on main pushes #5, signal traps): trap cleanup EXIT, plus HUP/INT/TERM traps that exit 129/130/143 (:70-74). The EXIT trap runs rollback and temp cleanup once, and the lock is not released until the process actually ends.

Not changed: E (codex #2, --clobber window). The window is real. While it is open, the updater fails safe and does not install anything:

  • The manifest fetch is the first network step after the lock (scripts/update-local-mac-app.sh:78-82). If latest-main.json is missing (404 during the clobber window, before the first publish, or a network error), the updater prints Could not fetch latest-main.json ...; leaving the current install untouched. and exits 1. That happens before any download, staging, or /Applications change, and the EXIT trap removes the temp dir.
  • The updater runs on a 30-minute schedule, so a non-zero exit only logs that run's failure. The next run tries again, and whatever publish happens next fills the gap. The window lasts as long as one asset upload, and it only matters if a cancelled run is followed by a failed build.
  • Versioned manifests plus an atomic pointer swap would mean redesigning the release layout. For a single-machine rolling beta, that costs more than a skipped half-hour update. We are leaving the design as it is on purpose.

Verification: bash -n passed. shellcheck and actionlint are not installed on this machine, so they were not run. A local harness confirmed:

  • A second run while the lock is held prints Another m3-update process is already running; exiting. and exits 0.
  • With the lock free and a nonexistent repo, the run exits 1 with the message above and never reaches the install step.
  • The trap block exits 129 on HUP and 143 on TERM, and cleanup runs once.

Posted by the orchestrator.

@SynurDevelopers

Copy link
Copy Markdown
Collaborator Author

Round 4 — read-only local run (no GitHub token), posted by the orchestrator.

I'll review PR #5 round 4 against the two in-scope files only, starting with the review skill and the provided diff.

Diff is in. Next I’ll read the two files in the repo and check how the updater is invoked so the A–D fixes can be verified against real call sites.

I need local lockf behavior and what the dist step actually emits; those two details decide whether the round-3 fixes really hold.

Shell is blocked here, so I’ll read the lockf man page and the desktop artifact builder from disk instead.

Local lockf does support the fd form, so (C) may be valid. Next I’ll check the dist zip output and a few remaining swap/publish edge cases.

A–D are implemented correctly, and the updater fails safe when the manifest is missing. No blocking correctness or security issues in the two in-scope files.

A — env.ASSET_NAME: Both gh release view --jq queries use a single --jq expression with env.ASSET_NAME. ASSET_NAME is in the step env from steps.assets.outputs.asset_name. gojq’s env builtin reads the process environment.

B — is_main_tip: The guard compares GITHUB_SHA to GET /repos/.../commits/main. On mismatch or lookup failure it skips latest-main.json upload/create (exit 0). A stale rerun cannot point the manifest at an older SHA. The function’s success path is a failed if test, which is POSIX status 0.

C — lockf: exec 9>"$LOCK_FILE" then /usr/bin/lockf -s -t 0 9 matches Darwin lockf(1) fd mode. Exit 75 is treated as lock held (exit 0); other failures exit 1. The kernel drops the flock when the process exits.

D — signal traps: HUP/INT/TERM call exit 129/130/143, so cleanup (and rollback) runs once via the EXIT trap.

E — --clobber window: Manifest fetch is the first step after the lock. A missing latest-main.json prints that the install is untouched and exit 1 before any download, stage, or /Applications change.

VERDICT: APPROVE

@SynurDevelopers

Copy link
Copy Markdown
Collaborator Author

Round 4 — read-only local run (no GitHub token), posted by the orchestrator.

  • (blocking) .github/workflows/mac-main-build.yml:11 A stale rerun can cancel the current main build before reaching is_main_tip, leaving the current commit unpublished. Set cancel-in-progress: false and queue: max so stale reruns can neither interrupt the active build nor displace a pending one.
  • (blocking) .github/workflows/mac-main-build.yml:70 A failed main-tip lookup makes the job report success without publishing the manifest. Fail the job on lookup errors and reserve a successful skip for a confirmed SHA mismatch.
  • (blocking) scripts/update-local-mac-app.sh:141 The two renames leave /Applications/M3 Code (Beta).app missing if the updater is killed or the machine loses power between them. Use macOS renameatx_np with RENAME_SWAP for replacements and a single rename for first installs.

The local GitHub CLI jq evaluator loads environment variables. On macOS, the lock check returned 75 under contention, and the TERM handler ran the EXIT trap once. A missing manifest exits before touching the installed bundle. The GitHub workflow was reviewed statically.

VERDICT: REQUEST_CHANGES

…rors, self-heal interrupted swaps

- Workflow concurrency no longer cancels in-progress runs, so a rerun of an
  older run cannot kill the current tip's build before it publishes.
- is_main_tip fails the job on a tip lookup error instead of silently
  succeeding; only a confirmed SHA mismatch skips the manifest publish.
- The updater uses a fixed backup path and, after taking the lock, restores
  a backup left by a run killed mid-swap (or drops a stale one when the app
  is present). A missing bundle still bypasses the recorded SHA, so the
  next run reinstalls.

red-confirmed: not-applicable
yokoten: pattern not found (only one swap path and one tip check in the PR)
pre-pr-check: not-applicable (intermediate commit)
backend-test: not-applicable

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@SynurDevelopers

Copy link
Copy Markdown
Collaborator Author

Re: Codex round-4 review. Addressed in 11e31a2.

1. A rerun cancels the current-main build. Fixed. concurrency keeps the ref-scoped group and now sets cancel-in-progress: false, so a running build is never cancelled. A rerun of an older run that waits behind it only uploads its ZIP; the tip check stops it from moving the manifest.

2. Tip lookup failure exits as success. Fixed. is_main_tip returns 0 when this commit is the tip and 1 when it is not, and exits the job with ::error:: and status 1 if the gh api lookup fails or returns an empty SHA. Only a confirmed mismatch skips the manifest publish with exit 0.

3. A crash between the two renames leaves no app. Fixed by recovery on the next run instead of an atomic swap. The backup now has a fixed path on the same volume (/Applications/.M3 Code (Beta).app.m3-update-backup). After taking the lock, and before the up-to-date check, the updater restores that backup if the app is missing, or deletes a stale backup if the app is present. If the app is still missing, the up-to-date check already requires -d "$APP_DEST", so the recorded SHA is ignored and the install goes ahead. Signals (HUP, INT, TERM) are still covered by the EXIT-trap rollback, and a successful run still removes the backup. An atomic renameatx_np(RENAME_SWAP) would need a compiled helper, which is too much for an unsigned beta updater that runs on one machine.

@SynurDevelopers

Copy link
Copy Markdown
Collaborator Author

Round 5 — read-only local run (no GitHub token), posted by the orchestrator.

I'll review PR #5 round 5 as specified: those two files only, blocking issues only, and I'll check that A–D and 1–3 are actually implemented correctly.

I have both files. Next I’ll verify the claimed A–D and 1–3 fixes against local lockf/gh behavior and the rest of the swap/publish paths.

A–D and 1–3 match the intended behavior. One security hole remains in the workflow.

(blocking) .github/workflows/mac-main-build.yml:14 — contents: write is live during vp install and the desktop build, so a compromised npm lifecycle script can push to the repo or clobber any release, including the rolling main-latest zip that machines auto-install.

The token is in GITHUB_TOKEN for every step of this job. release-desktop.yml keeps packaging at contents: read and publishes in a separate write job. This workflow does both in one job.

Suggested fix: split the job. Build with contents: read (checkout, install, vp run dist:desktop:dmg:arm64, upload-artifact). Publish with contents: write and only gh release plus the downloaded zip/manifest — no vp install.

Verified (not findings):

  • (A) env.ASSET_NAME in gh --jq (lines 84–85, 106–107)
  • (B)/(2) is_main_tip uses exit 1 on lookup failure and return 1 only on a SHA mismatch
  • (1) cancel-in-progress: false
  • (C) lockf -s -t 0 9 after exec 9> matches Darwin lockf(1) fd mode; exit 75 treated as lock held
  • (D) HUP/INT/TERM exit 129/130/143 so EXIT runs restore_backup_if_needed once
  • (3) fixed backup path; recover_interrupted_swap after the lock; up-to-date requires [ -d "$APP_DEST" ]
  • (E) missing latest-main.json exits before any swap

VERDICT: REQUEST_CHANGES

@SynurDevelopers

Copy link
Copy Markdown
Collaborator Author

Round 5 — read-only local run (no GitHub token), posted by the orchestrator.

  • (blocking) .github/workflows/mac-main-build.yml:84 — A failed upload can leave a same-named GitHub starter asset. The rerun counts it as a complete ZIP and publishes a manifest that clients can’t install. Reuse only uploaded, nonempty assets. Delete an incomplete asset and retry the upload before publishing the manifest.
  • (blocking) scripts/update-local-mac-app.sh:10 — Each user locks a different file while updating the same /Applications bundle. A second admin’s updater can restore the backup between the first updater’s two renames, causing the first updater to move the new bundle inside the restored app and report success. Use one lock shared by every updater targeting that installation.
  • (blocking) scripts/update-local-mac-app.sh:105 — Replacing the bundle with a different build leaves the home-directory SHA unchanged, so the updater can report that the replacement is current. Read the build SHA from the installed bundle before skipping the update.

VERDICT: REQUEST_CHANGES

…ublish jobs, reupload incomplete assets

The build job ran vp install and the desktop build while holding a
contents: write token, so a compromised lifecycle script could push to
the repo or clobber the rolling main-latest release. A same-commit rerun
also reused any same-named asset, including a half-uploaded "starter"
asset left by a failed upload.

The build job now runs with contents: read and hands the commit-stamped
ZIP and latest-main.json to a separate publish job (contents: write, no
checkout, no install) via upload/download-artifact, pinned to the same
action SHAs as release-desktop.yml. The publish job reuses an existing
ZIP only when its state is "uploaded" and its size is nonzero; otherwise
it deletes the incomplete asset and uploads again before the manifest.

red-confirmed: not-applicable
yokoten: release-desktop.yml already separates build and publish; no other workflow reuses release assets by name
pre-pr-check: not-applicable (intermediate commit)
backend-test: not-applicable

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@SynurDevelopers

Copy link
Copy Markdown
Collaborator Author

Round 5 response (head d76e7a9309), replying to Grok (#5 (comment)) and Codex (#5 (comment)).

Grok (blocking), contents: write during install/build: fixed.
.github/workflows/mac-main-build.yml now has two jobs, following the release-desktop.yml pattern:

  • build (workflow default and job permissions: contents: read) runs checkout, setup-ci-deps (vp install), the Rust toolchain, and vp run dist:desktop:dmg:arm64. It writes the commit-stamped ZIP and latest-main.json, then hands them off with actions/upload-artifact (pinned to the same SHA as release-desktop.yml).
  • publish (needs: build, permissions: contents: write) has no checkout and no install. It runs actions/download-artifact (same pinned SHA), then the existing gh release logic with GH_REPO: ${{ github.repository }}: is_main_tip, ZIP reuse/upload, manifest publish, and retention.
    Both jobs keep the github.ref == 'refs/heads/main' guard. Workflow-level concurrency still has cancel-in-progress: false.

Codex #1 (blocking), reusing a half-uploaded asset: fixed.
An existing same-named ZIP is now reused only when .state == "uploaded" and .size > 0. gh release view --json assets exposes both fields. Any other same-named asset, such as a starter left by a failed upload or a zero-byte asset, is removed with gh release delete-asset --yes and uploaded again before latest-main.json is published.

Codex #2, cross-user lock: not changing.
The updater is a per-user LaunchAgent on a single-user developer machine. A second admin running a concurrent updater against the same /Applications bundle is outside the supported deployment, so a machine-wide lock would add machinery for a case we don't support.

Codex #3, bundle SHA vs home-directory SHA: not changing.
Replacing the bundle by hand, outside the updater, is outside the updater's contract, and m3-update --force reinstalls in that case. Stamping the SHA into the bundle would need build changes beyond this PR's scope.

@SynurDevelopers SynurDevelopers self-assigned this Dec 3, 2026
@SynurDevelopers

Copy link
Copy Markdown
Collaborator Author

Round 6 — read-only local run (no GitHub token), posted by the orchestrator.

I'll review PR #5 round 6 read-only: load the review skill, then inspect the two scoped files and the provided diff.

I'll verify artifact path wiring, gh repo context without checkout, and whether release JSON actually exposes state/size for the reuse logic.

The gh binary is blocked here, so I'll inspect local docs and the workflow/action sources instead.

The man page lists assets but not nested fields. Next I’ll inspect the local gh source for the asset JSON shape.

I'll confirm where the arm64 zip is written and whether gh release view --json assets actually includes state.

The job split, artifact handoff, and ZIP reuse/delete flow match the spec. A–D, E2, and F2 still hold.

Item 1 — job split

  • Workflow default and build are contents: read; publish is contents: write and only runs gh release / gh api.
  • Artifact name mac-main-arm64 matches on upload and download.
  • Both files live under release/; upload-artifact keeps the least common ancestor, so download to path: release yields release/${ASSET_NAME} and release/latest-main.json. Same pattern as desktop-macos-preview-publish.yml.
  • asset_name is written to GITHUB_OUTPUT, exported as a job output, and read in publish as needs.build.outputs.asset_name.
  • Publish has no checkout; GH_TOKEN and GH_REPO: ${{ github.repository }} supply gh context. is_main_tip uses GITHUB_REPOSITORY, which Actions always sets.

Item 2 — reuse / delete

  • env.ASSET_NAME in jq (A).
  • uploaded and size > 0 → reuse; otherwise delete (if present) then upload; then is_main_tip before the manifest.
  • ZIP is in place before latest-main.json is clobbered.

Earlier fixes

  • (B) Lookup failure exit 1; SHA mismatch skips the manifest only.
  • (C) lockf -s -t 0 9 on fd 9; 75 → exit 0.
  • (D) HUP/INT/TERM exit 129/130/143 so EXIT rollback runs once.
  • (E2) cancel-in-progress: false.
  • (F2) Fixed backup path; recover_interrupted_swap after the lock; up-to-date check requires the bundle.

(non-blocking) If gh release view --json assets omits state, every existing ZIP is treated as incomplete and deleted before re-upload. REST (GET /releases/tags/...) documents state; switch to gh api if a rerun ever deletes a complete ZIP.

VERDICT: APPROVE

@SynurDevelopers

Copy link
Copy Markdown
Collaborator Author

Round 6 — read-only local run (no GitHub token), posted by the orchestrator.

  • (blocking) .github/workflows/mac-main-build.yml:67 — A full rerun while the previous attempt’s artifact is retained tries to upload mac-main-arm64 again under the same run ID. The name conflict stops the build before publishing can retry. Set overwrite: true on the artifact upload.
  • (blocking) .github/workflows/mac-main-build.yml:133 — If the first gh release create is interrupted after creating the draft, later runs find the draft and can successfully refresh its assets while leaving it unpublished. Add --draft=false to the release edit after both assets are ready.

The artifact paths, job output, token permissions, and checkout-free GH_REPO context line up. Local checks passed for shell syntax, ZIP classification, and macOS lock contention. The main-tip guard, concurrency setting, signal traps, and interrupted-swap recovery still hold on inspection.

VERDICT: REQUEST_CHANGES

A full rerun of the mac main build failed to upload because the
mac-main-arm64 artifact from the earlier attempt already existed. And
an interrupted gh release create can leave main-latest as a draft,
which the edit path never published.

The upload step now sets overwrite: true, and the existing-release path
passes --draft=false to gh release edit so a leftover draft is
published alongside the target and notes update.

red-confirmed: not-applicable
yokoten: other upload-artifact and release edit uses live in release.yml, release-desktop.yml and desktop-macos-preview-publish.yml with unique per-run artifact names or explicit --draft=false; out of scope for this PR
pre-pr-check: not-applicable (intermediate commit)
backend-test: not-applicable

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@SynurDevelopers

Copy link
Copy Markdown
Collaborator Author

Re #5 (comment) — both fixed in 5ee4e2d:

  • actions/upload-artifact now sets overwrite: true, so a full rerun replaces mac-main-arm64 instead of conflicting.
  • gh release edit now passes --draft=false (confirmed in gh release edit --help, gh 2.91.0), so a release left as a draft by an interrupted gh release create gets published.

Grok's non-blocking state field concern was checked: gh 2.91.0 gh release view --json assets exposes each asset's state and size, so the .state == "uploaded" and .size > 0 check works as written.

@SynurDevelopers

Copy link
Copy Markdown
Collaborator Author

Round 7 — read-only local run (no GitHub token), posted by the orchestrator.

No blocking issues found at 5ee4e2d0e2. Artifact overwrite supports full reruns, and --draft=false publishes a recovered draft after its assets are in place.

The CI jobs retain separate permissions, and the artifact name, paths, build output, and GH_REPO align. Local jq checks covered complete, incomplete, and missing ZIPs, plus retention. The main-tip guard, concurrency settings, updater lock, signal handling, and interrupted-swap recovery still hold on inspection. Bash syntax checks passed. Live publishing and installation were outside this read-only review.

VERDICT: APPROVE

@SynurDevelopers

Copy link
Copy Markdown
Collaborator Author

Round 7 — read-only local run (no GitHub token), posted by the orchestrator.

I'll review PR #5 round 7 as a read-only pass: load the review skill, then inspect the two in-scope files and the provided diff.

I'll load the review-format and security notes, then read the two in-scope files plus the provided diff.

I'll verify lockf, gh asset fields, and how the desktop build names its zip so path and reuse logic can be judged against real behavior.

gh is off-limits, so I'll use local man pages and the desktop build config to confirm lockf and zip naming.

Round 7 static review of .github/workflows/mac-main-build.yml and scripts/update-local-mac-app.sh (diff vs origin/main, head 5ee4e2d). No blocking defects.

Post–round 6 changes

  • overwrite: true on actions/upload-artifact is valid for this pin (same pattern as desktop-macos-preview-publish.yml) and only affects same-run re-uploads, so a re-run of build can replace mac-main-arm64.
  • gh release edit "$TAG" --draft=false --target "$GITHUB_SHA" --notes "$NOTES" matches this repo’s release.yml usage and keeps an existing main-latest release public after the manifest upload.

G still holds

  • Workflow default contents: read; build stays read-only (checkout, install, build, upload); publish is contents: write with no checkout.
  • Artifact name mac-main-arm64 matches. Upload of release/<zip> + release/latest-main.json strips LCA release/; download to path: release restores release/${ASSET_NAME} and release/latest-main.json.
  • asset_name flows steps.assets → job output → needs.build.outputs.asset_name → ASSET_NAME.
  • GH_TOKEN + GH_REPO: ${{ github.repository }} give gh a repo context without a checkout.
  • Zip reuse still requires .state == "uploaded" and .size > 0; otherwise delete then re-upload before the manifest is touched.

A–D, E2, F2 still hold

  • A: env.ASSET_NAME inside --jq (no gh --jq --arg).
  • B: tip lookup failure exit 1; SHA mismatch skips manifest publish only.
  • C: exec 9> then /usr/bin/lockf -s -t 0 9; lock held → 75. Matches this machine’s lockf(1) fd form.
  • D: HUP/INT/TERM exit 129/130/143 so EXIT rollback runs once.
  • E2: cancel-in-progress: false.
  • F2: fixed backup path; recover_interrupted_swap after lock; up-to-date check requires the bundle.

(non-blocking) gh release create / gh release edit omit --latest=false. This repo sets that on the update-feed pointer release so a pointer cannot become GitHub Latest. Same hardening would fit main-latest.

VERDICT: APPROVE

@SynurDevelopers
SynurDevelopers merged commit 9e58144 into main Dec 3, 2026
27 checks passed
SynurDevelopers added a commit that referenced this pull request Dec 3, 2026
…osts; store Vikunja URL as a credential field

Jira site and Vikunja base URLs now require https and refuse private,
link-local, loopback and cloud-metadata hosts (literal host check). Vikunja's
server URL moves into the credential fields model (credential.fields.url)
like Jira's site, with fallback field -> legacy base-URL secret ->
T3CODE_VIKUNJA_URL, so saved accounts keep working. Removes baseUrl from
probeCredential, getBaseUrl from IssueTrackerHost and requiresBaseUrl from
contracts.

Review findings F7 and senior-dev #5.

yokoten:
  command: rg "requiresBaseUrl|baseUrlPlaceholder|getBaseUrl|siteOrigin" apps packages
  outcome: found-elsewhere-fixed (web, mobile, client-runtime fixture)
  files-touched: [packages/issue-tracker-jira/src/server/JiraApi.ts, packages/issue-tracker-vikunja/src/shared/issueUrl.ts, apps/server/src/issue/IssueTrackerConnections.ts]

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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