Repository navigation
Description
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`:
-
`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.
-
`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.
-
`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
fix(approve): cross-invocation retry, drop subrequest blowout
Cross-invocation retry for approve, drop subrequest blowout (#383)
fix(s3-lock): stream via continuation token, drop full-list per call