Skip to content

Retry transient notarytool timeouts in package-release.sh #255

Closed

Description

@sudoHG

Goal

Make scripts/package-release.sh survive transient notarytool network failures instead of failing the whole release run.

Context

During the v0.5.0 release (#252), notarytool requests to Apple intermittently failed with NSURLErrorDomain -1001 (request timed out) while plain HTTPS to the same endpoint stayed fast. notarize() runs notarytool submit --wait once and treats any non-JSON output as failure, so one timed-out poll aborts the run, leaves an orphaned (sometimes Accepted) submission, and costs the maintainer another pair of Ask Key approvals. Three runs failed this way before one succeeded.

Scope

scripts/package-release.sh and its tests or checks, if any. Keep the Ask Key delivery model (credential values only inside the helper's target shell, never printed), the four assets, and the stapling and verification steps unchanged.

Steps

  1. Split submission from waiting: submit once inside the Ask Key run, capture the submission ID, then poll status (notarytool wait or info) with a bounded number of retries on transient network errors, inside the same delivered-credential run so no extra approval is needed.
  2. Never resubmit automatically after a submission ID exists; on final failure, print the submission ID and the sanitized next step.
  3. Keep diagnostics free of signing identity, Team ID and key material.

Acceptance

bash -n and shellcheck (if available) pass; a synthetic --no-notarize packaging run still produces the same assets; the PR explains how a transient timeout is retried. Real notarization is verified at the next release.

Activity

  1. luoji-bot commented on Nov 3, 2026

    @luoji-bot

    Scope update from review round 1 on PR #256 (supersedes the original Scope and step 2 where they conflict):

    • Scope: scripts/package-release.sh, an optional runner file under scripts/ that it calls by path, docs/testing.md (the release notarization description), and the automation tests and fixtures for them.
    • Key lifetime: Ask Key deletes a delivered key file within 5 minutes, so the runner reads the key once into memory and passes it to each notarytool call through an inherited pipe; it is never written elsewhere or printed.
    • Waiting: poll the submission under a monotonic wall-clock deadline (about 30 minutes) with capped backoff, treating transient network errors as retryable.
    • Submit: on a transient submit failure, reconcile with notarytool history (same artifact name, created after this submit started) and adopt that ID; only if none exists, resubmit, at most a small bounded number of times. Stop with a clear message on ambiguous matches or unavailable history. Print every submission ID obtained.
    • Out of scope: resuming stapling from an existing submission ID.
  2. luoji-bot commented on Nov 3, 2026

    @luoji-bot

    Scope update from review round 2 on PR #256 (supersedes "one Ask Key approval per artifact" and the in-memory key pipe from the round-1 update):

    • Delivery model: notarytool cannot read a key through a pipe (--key /dev/fd/N fails with a file-permission error, checked on the maintainer's Mac with a non-release key). Credential mode therefore makes one Ask Key run per notarytool request (submit, history, status poll). Each run gets a freshly delivered key file used well within its 5-minute lifetime; the runner never reads the key itself.
    • Approvals: the first request asks for approval as before. The script tells the operator to approve it with a timed allowance so later requests run without a card. If the allowance is not granted, expires or ends (for example on screen lock with End Timed Allow on Lock), later requests may ask for approval again within the remaining deadline; that is accepted.
    • Everything else from the round-1 update stands (deadline, capped backoff, history reconciliation, bounded uploads, printing every submission ID).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    ready-for-agentFully specified; an agent may claim it

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions