Skip to content

fix(release): retry notarization submit/wait on transport failures and name the resume command - #157116

Merged
steipete merged 5 commits into
mainfrom
upd/notary-retry-and-resume-text
Sep 24, 2026
Merged

steipete merged 5 commits into
mainfrom
upd/notary-retry-and-resume-text

Conversation

@steipete

@steipete steipete commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes macOS release preflights failing when Apple's notarization transport briefly drops after a successful submission. In release-ops run 35959639128, arm64 job 107505754436, submit --no-wait had already checkpointed the submission ID before notarytool wait failed with NSURLErrorDomain -1009 "The Internet connection appears to be offline". The script treated the missing verdict as fatal even though the network recovered eight seconds later.

Refs #156861

User Impact

Checkpointed macOS packaging now survives transient submit/wait failures automatically. If the wait budget expires, operators get the existing Apple submission ID, checkpoint path, and a copyable openclaw-macos-publish.yml resume dispatch with the run, attempt, architecture variant, tag, and exact source SHA. Apple rejection still fails immediately and prints the notary log. Known IDs remain authoritative after submit errors, preserving the existing checkpoint contract; this does not add a protocol to resume an incomplete archive upload.

No new configuration, environment, CLI, dependency, or checkpoint-schema surface is added. The separate release workflow change is outside this PR.

Why This Change Was Made

The notarization script owns recovery; callers continue consuming its checkpoint and terminal result. The initial production delta was +77/−12 lines. The review fix for unavailable history adds nine lines, making the final production delta +86/−12 lines (net +74) in scripts/notarize-mac-artifact.sh.

  • The helper's submit branch owns up to five upload attempts, recovers a lost response from the first 100 history entries from five minutes before submit start through the response time, and returns any valid ID even if the command exits unsuccessfully. Temporary upload names include the artifact SHA-256 so concurrent architecture jobs named app.zip cannot adopt each other's submissions. A failed history lookup, malformed entry, or invalid JSON response retries history within the existing budget without another upload. The existing checkpoint writer persists the recovered ID before waiting.
  • The helper's wait branch owns repeated waits on that persisted ID. Only matching Accepted, Invalid, or Rejected JSON is terminal; transport errors, timeouts, malformed JSON, missing status, and In Progress remain retryable. The shared loop backs off from 5 seconds to a 60-second cap within a 30-minute budget, logging ID and elapsed time.
  • The exhaustion branch owns the actionable resume command. The shared terminal-result branch fetches rejection logs, including for standalone callers. Existing checkpoint validation and stapling recovery remain the owners of artifact integrity and replacement.

Evidence

The fake-notarytool tests exercise the actual shell entry point in test/scripts/notarize-mac-artifact.test.ts:

Behavior Regression test
One transport failure, then Accepted; one submission and checkpointed ID retries non-terminal wait responses "transport" on the checkpointed id
Repeated In Progress, then Accepted retries non-terminal wait responses "In Progress" on the checkpointed id
Wait budget expires; ID and exact resume command retained; no second submission exhausts the wait budget with an actionable resume command and resumes the same id
Lost response after a ten-minute upload adopts matching history, excluding another architecture's bytes adopts a recent matching history entry after losing the submit response
No matching history causes a bounded submit retry and success retries submit when history is empty (also old history and different names)
Invalid fails immediately, prints the log, and never resubmits retains Apple's terminal rejection without publishing accepted output or resubmitting

Additional cases cover malformed/missing status, a returned ID with unsuccessful submit exit, exhausted submit attempts, standalone rejection logs, checkpoint tampering, and stapling recovery. Tests replace date and sleep through the existing isolated PATH fixture; there are no real backoff sleeps or production test-only options.

  • Pre-fix proof: 12 regression cases failed against the original script (21 pre-existing cases passed), including the observed transport failure and missing recovery/log output.
  • Blacksmith Testbox tbx_01m393yvjmf9nq4q7pey1cxbsh: pnpm test test/scripts/notarize-mac-artifact.test.ts --maxWorkers=1 passed 33/33 three times, with 2.806 / 2.830 / 2.689 seconds of test time and 3.58 / 3.29 / 3.14 seconds of Vitest wall time. The same unchanged DMG test took 59.396 seconds on a contended Mac and 155–190 ms on the first Testbox run.
  • Cross-lane tests selected by production basename: five sibling files passed, 746 tests passed / 18 platform skips, 108.18 seconds wall time.
  • Test delta: +219/−40; release documentation: +1 line.
  • The first branch autoreview found that Apple timestamps uploads before completion. The extended history-adoption test reproduced an unwanted second submission after a ten-minute upload; anchoring the lookup to submit start fixes it. Lookup-failure and malformed-entry regressions also reproduced duplicate submissions and now retry only history; response validation must succeed before a missing match can authorize another upload. The separate ID-authority observation was retained as the explicitly requested, pre-existing contract rather than adding upload-resumption state.
  • git diff --check and Bash syntax validation passed.
  • Fresh autoreview --mode branch --base origin/main --max-priority P2: scoped-clean, no accepted/actionable findings. Complete Testbox check:changed: passed, exit 0, including root typecheck, lint, ratchets, dead-export checks and all three mapped macOS CI test commands. The complete proof command finished in 9m26.567s on Testbox allocation 35968109541. It used CI=1 OPENCLAW_TESTBOX=1 OPENCLAW_CHECK_CHANGED_REMOTE_CHILD=1 OPENCLAW_CHANGED_LANES_RAW_SYNC=1 pnpm check:changed --base 0fa428d6f6de2261c89fee1c7ea97d7282f2e3f6 -- scripts/notarize-mac-artifact.sh test/scripts/notarize-mac-artifact.test.ts docs/reference/RELEASING.md to bind checks to the branch merge base.

This is deterministic shell/API-boundary proof with a fake Apple service; no live notarization or release was dispatched.

macOS CI follow-up

Rebased onto main 9e007615ece5, including the checkpoint split in #157117. The failures in CI run 36000111723, job 107635046524 (macos-node-2), were at the initial fixture setup (failed.status), before the auditor was changed or the resume path ran. The old fixture expected one transient notarytool wait failure to abort packaging; the retry change correctly recovered it. Main commit 4ed527d970ba032f4e860257915080924bcabad0 already changes that setup to a non-retryable stapling interruption. The two re-audit tests and all their refusal assertions remain unchanged from main; they verify rejection/missing auditor, nonzero exit, and no additional submissions.

The first full macOS run exposed an additional smoke-signature flake: codesign --display --verbose=4 | grep -Fxq let grep close the pipe after its match, making codesign exit with SIGPIPE under pipefail. A real ad-hoc Mach-O probe reproduced codesign exit 141 with grep exit 0 in 23/40 runs. The packaging owner now drains output with grep -Fx ... >/dev/null, preserving both exact signature matching and genuine producer failures. The same probe passed 40/40 afterward. This repair adds two production lines and removes one; no test assertions were changed.

Validation on macOS: pnpm test test/scripts/package-mac-dist.test.ts passed 27/27 three times, with Vitest wall times 53.31s / 40.15s / 41.13s (wrapper wall 55.27s / 41.24s / 42.20s). Bash syntax and git diff --check passed. Both the focused pre-commit review and fresh autoreview --mode branch --base origin/main --max-priority P2 are scoped-clean. A supplemental Linux Testbox allocation was unavailable: Blacksmith returned HTTP 429 while fetching its workflow, before providing a lease receipt; no additional remote sibling-test result is claimed for this follow-up. Auto-merge remains off for coordinator verification of the new macOS job.

@clawsweeper

clawsweeper Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation scripts Repository scripts size: M labels Sep 24, 2026
@steipete
steipete marked this pull request as ready for review September 24, 2026 07:23
@steipete
steipete enabled auto-merge (squash) September 24, 2026 07:28
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 24, 2026
@clawsweeper

clawsweeper Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 24, 2026, 9:37 AM ET / 13:37 UTC (Revision 3).

ClawSweeper review

What this changes

The branch adds submit and wait recovery to macOS notarization, prints a release-workflow resume command, updates release guidance and tests, and drains codesign output during the smoke-signature check.

Merge readiness

⛔ Blocked before merge - 2 items remain

Current main still exits after a transient notarization wait failure, and the merged packaging checkpoint work does not add retries. The patch has focused boundary tests, but the requested signed Apple-service verification remains outstanding.

Priority: P2
Reviewed head: e775ab0469f604e3763fa8290796c042dc83d8ca

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The patch and boundary tests are focused, while the changed Apple-service path still lacks the requested live contract proof.
Proof confidence 🦐 gold shrimp (3/6) Not applicable: Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: Real behavior proof is not required for maintainer- or bot-authored pull requests.
Evidence reviewed 7 items Introduced recovery path: The pinned PR delta adds bounded submit and wait loops, Apple-history lookup, and the resume command.
Current-main behavior: Current main makes one checkpointed notarytool wait call and exits on a failed or unexpected response; it has no retry loop.
Boundary tests and proof limit: The changed tests invoke the actual shell script but replace xcrun with a fake Apple service and virtualize time. The PR body explicitly says no live notarization or release was dispatched.
Findings None None.
Security None None.

How this fits together

Mac release packaging signs the app and DMG, then sends each artifact to Apple's notary service. The notarization helper records submission IDs in a checkpoint and returns accepted artifacts to the release workflow.

flowchart LR
A[Signed app and DMG] --> B[Mac packaging]
B --> C[Notarization helper]
C --> D{Apple response}
D -->|Transient failure| E[Retry or recover submission]
E --> D
D -->|Accepted| F[Checkpoint and release artifacts]
D -->|Rejected| G[Notary log and failure]
Loading

Before merge

  • Resolve merge risk (P1) - Real Apple history visibility and timed-wait responses remain unverified after this change. If a submission is absent from the first successful history read, the new path can submit again; an incompatible response could also exhaust a signed preflight.
  • Complete next step (P2) - Attach a redacted signed macOS preflight trace of real notarytool history and timed-wait recovery, showing reuse of the same submission ID; update the PR body to trigger re-review, or ask a maintainer to comment @clawsweeper re-review if it does not.
Agent review details

Security

None.

PR surface

Tests +179, Docs +1, Other +75. Total +255 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 219 40 +179
Docs 1 1 0 +1
Config 0 0 0 0
Generated 0 0 0 0
Other 2 88 13 +75
Total 4 308 53 +255

Review metrics

Metric Value Why it matters
Production and test delta production +88/-13 lines; tests +219/-40 lines The production growth implements retry and history recovery plus the codesign pipe repair; the larger test delta exercises the shell boundary.

Merge-risk options

Maintainer options:

  1. Verify signed notarization recovery (recommended)
    Capture a redacted signed macOS preflight trace that exercises real Apple history and timed wait responses, including submission-ID reuse after a transport interruption.

Technical review

Best possible solution:

Keep recovery in the notarization helper and verify a signed preflight in which one Apple submission ID survives a transient failure through acceptance or checkpointed resume.

Do we have a high-confidence way to reproduce the issue?

Yes. Current main's one-shot wait path exits on the reported transport failure, and the PR identifies a specific failed release run; this read-only review did not rerun notarization.

Is this the best way to solve the issue?

Yes, provisionally. The existing notarization helper is the narrow owner for retries and checkpoint reuse, but its Apple-service response assumptions still need signed validation.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 1a3853e933a9.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: The reported failure interrupts macOS release preflight, with a focused proposed repair and limited operator-facing blast radius.
  • merge-risk: 🚨 automation: The introduced Apple-history and timed-wait decisions can change whether signed release automation retries, resumes, or stalls.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: Real behavior proof is not required for maintainer- or bot-authored pull requests.

Evidence

What I checked:

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Vincent Koc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Attach a redacted signed macOS preflight trace showing real notarytool history and wait responses, with one submission ID retained through recovery.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (2 earlier review cycles)
  • reviewed 2026-09-24T07:33:09.014Z sha 11e162a :: blocked before merge. :: none
  • reviewed 2026-09-24T12:45:57.607Z sha cb61418e714dd34797bd0db3361defbb1d1cd657 :: blocked before merge. :: none

@steipete
steipete disabled auto-merge September 24, 2026 13:05
@steipete
steipete force-pushed the upd/notary-retry-and-resume-text branch from cb61418 to e775ab0 Compare September 24, 2026 13:27
@steipete
steipete enabled auto-merge (squash) September 24, 2026 13:34
@steipete
steipete merged commit 290f427 into main Sep 24, 2026
103 checks passed
@steipete
steipete deleted the upd/notary-retry-and-resume-text branch September 24, 2026 13:48
vincentkoc added a commit that referenced this pull request Sep 24, 2026
* commit '9ccfc7d1bea21e34da48edbd54afd2e1be57db40': (89 commits)
  fix(exec): avoid gateway stalls during background task writes (#157177)
  test(cli): isolate preaction title setter state
  fix(test): synchronize Git backoff cancellation readiness (#157315)
  fix: validate Codex model references in Docker (#157175)
  fix(state): tolerate brief WAL coordinator contention (#157121)
  fix: unblock conversations after recovery preparation fails (#157214)
  test(telegram): avoid wall-clock pacing in HTTP conformance (#157281)
  fix: keep independent database work responsive under load (#157230)
  refactor(sqlite): centralize WAL checkpoint execution (#157263)
  improve(android): show tool outcomes in collapsed work (#156950)
  fix: remove tracked release scratch blocking source capture (#157308)
  test(update): remove legacy probe stream ordering race
  fix: preserve steering across reconnects and show queued input (#157135)
  fix(ui): keep typing focus when the GitHub reader opens (#157202)
  fix(ios): keep screenshot logs outside capture evidence
  test(codex): await startup teardown in lifecycle fixtures
  chore(ui): refresh control ui locales (#157311)
  refactor(memory): deslop memory plugins (#156867)
  refactor(test): share CLI diagnostics fixture setup (#157201)
  fix(release): retry notarization submit/wait on transport failures and name the resume command (#157116)
  ...
@roboclaw-bot roboclaw-bot mentioned this pull request Sep 24, 2026
2 of 8 tasks
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 25, 2026
…d name the resume command (openclaw#157116)

* fix(release): retry notarization transport failures

* fix(release): reconcile history from notarization upload start

* fix(release): retry unavailable notarization history before resubmitting

* fix(release): retain unknown state for malformed notarization history

* fix(release): drain codesign output in smoke signature check
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. scripts Repository scripts size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant