Skip to content

Approve pipeline: CF subrequest blowout + stale DOI in same invocation #382

Closed

Description

@neuromechanist

Follow-up to #340 / #369.

What happened

After PR #369 wrapped publish-orchestrator steps in step-level `withRetry` (3 attempts, 1s delay), three new failure modes appeared during `nemar admin publish approve`:

  1. `s3_lock` blows the CF Workers subrequest limit. Each `applyObjectLock` batch issues ~40 S3 PUT subrequests plus listObjectKeys pagination. The inline retry wrapper triples that in a single Worker invocation, reliably tripping "Too many subrequests by single Worker invocation" — every re-run hits the same wall.

  2. `tag_protect` halts on "Repository has been locked". GitHub briefly locks a repo right after the visibility flip. The 1s × 3 inline retries don't outlast the lock window. The pipeline aborts and the admin has to resume manually.

  3. `publish_doi` reads a stale `ezid_identifier`. `doi_create` updates D1 inside the same invocation, but the in-memory `dataset` snapshot was loaded at orchestrator start. `publish_doi` reads `dataset.ezid_identifier` (null) and throws "No EZID identifier found" — even though the DOI was just minted seconds earlier.

What I want

The original goal ("failures don't stop the process") was right; the implementation was wrong. Move retry across Worker invocations instead of inside one. Each retry should get a fresh subrequest budget and a fresh propagation window. CLI-side wait-and-retry, ~10s × ~5 attempts — the same thing admins were doing by hand.

Proposed fix

  • Drop inline `withRetry` from `s3_lock` and `tag_protect` — surface 500 to the CLI immediately
  • Sync the in-memory `dataset` after `doi_create` so `publish_doi` reads the fresh `ezid_identifier`
  • Add a 5-attempt × 10s retry loop in the CLI's `approvePublication` keyed on transient errors (5xx/429, network, GitHub 403 "Repository has been locked"); preserve `s3_lock_offset` across retries
  • Surface retries through the CLI spinner so admins see what's being retried

Repro

```
$ nemar admin publish approve nm000131 -y
✖ Tag protection failed: Repository has been locked
$ nemar admin publish approve nm000131 -y
✖ No EZID identifier found for dataset
$ nemar admin publish approve nm000131 -y
✖ S3 lock failed: Too many subrequests by single Worker invocation
$ nemar admin publish approve nm000131 -y
✖ S3 lock failed: Too many subrequests by single Worker invocation # repeats indefinitely
```

Activity

  1. added
    bug
    on Apr 28, 2026
  2. added 2 commits that reference this issue on Apr 28, 2026
    0938f1b
    868c98a
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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions