Skip to content

Reduce repeated release recovery caused by publisher budget exhaustion #668

Open

Description

@blove

Implementation follow-up — September 22, 2026

Audit freshness #783 is merged and its main CI/release rollout passed. Ordered uploads with deferred verification are implemented in #784, awaiting required CI before authorized merge. Independent recovery/spec/code reviews approved; all 3,940 local controller tests passed. A deterministic scheduling test gives 42 minutes versus 2 minutes for 21 two-minute delays, with identical evidence and serial npm commands; this is not a production forecast. No workflow/deadline/credential changes or benchmark release. Measure the next ordinary release after rollout.


Version-visibility investigation — September 22, 2026

The remaining version-absent waits are strongly consistent with registry-side publish-time scanning/availability delays, not the local audit cache fixed in #783.

npm announced on July 28 that newly published packages are scanned before becoming installable, with variable delays: https://github.blog/changelog/2026-07-28-npm-publish-time-malware-scanning-and-dual-use-metadata/. This is distinct from optional staged publishing; no staging migration is proposed.

Read-only comparison of the 0.10.0 publisher's package-publish-accepted timestamps with each public full packument's time["0.10.0"] finds all 21 registry timestamps after upload acceptance. The summed intervals are 36m36.861s, median 95.152s, range 54.326–370.007s. They closely match the version-absent retry windows. These are registry timestamp intervals rather than exact observer availability measurements; historical per-package scan status/headers were not saved, so scan attribution is an inference supported by npm's documented behavior.

The ordinary reader uses Node fetch through the bounded HTTP adapter, with no persistent response cache. A version-absent result requires the exact-version endpoint's 404 plus a package metadata document that lacks the version; contradictory evidence fails closed. Fresh probes show exact-version 200 responses marked DYNAMIC and missing-version 404 responses without cache lifetime headers. Packument responses have max-age=300, but that alone does not establish cached exact-version absence during the historical run. Adding cache-busting queries or polling faster is not a demonstrated fix.

Package Upload accepted → registry version timestamp, seconds
@b4run/ag-ui 131.332
@b4run/config-biome 127.016
@b4run/config-typescript 74.948
@b4run/devkit 54.967
@b4run/sdk 126.964
@b4run/langgraph 95.646
@b4run/permissions 54.326
@b4run/postgres-storage 75.352
@b4run/workspace 76.571
@b4run/sandbox 54.399
@b4run/sqlite-storage 75.146
@b4run/core 95.152
@b4run/langchain 75.329
@b4run/memory 54.429
@b4run/cli 156.818
@b4run/inspector 126.716
@b4run/memory-pgvector 54.359
@b4run/testing 370.007
@b4run/evals 95.728
@b4run/vite-plugin 125.927
create-b4-app 95.729

Next design decision

The current loop uploads one package and fully waits/verifies before uploading the next, so registry-side delays accumulate. The credible larger improvement is to decouple ordered uploads from final verification: keep npm publish commands serial in canonical order, retain all existing pre-write checks, then verify every exact version, tarball, signature and provenance before downstream release steps. This would let npm process accepted packages concurrently without concurrent npm publish commands or extra user steps.

That changes the timing of side effects: more packages may have been accepted when an earlier package later fails verification. It needs a separate design and fault/recovery proof covering ambiguous publish outcomes, accepted-package reconciliation, retries and final evidence. No implementation or guarantee of savings yet. Preserve the existing publisher while #783 is validated; do not reset its active CI to append this investigation. No benchmark release, registry mutation or workflow change was performed.


0.10.0 follow-up — September 22, 2026

0.10.0 tag run completed in one publishing attempt. Merge-to-publication was 1h42m32s; tag observation 9m17s and publishing 58m53s. Inventory reuse from #766 is present, but no overall discovery speedup is measured (0.9.0 tag observation:8m55s).

The publisher logged 395 version-absent,6 metadata-pending and84 audit-pending events. Recorded convergence lower bound:52m23.465s. Three packages each had28 ETARGET audit retries spanning roughly five minutes. A controlled test using exact npm11.17.0 reproduced retrying a cached missing-version packument without network access after the registry became current. Setting prefer-online revalidated immediately and saw the version. Historical logs lack cache headers, so precise historical savings cannot be claimed.

Implementing the smallest fix: force online metadata revalidation in the isolated signature-audit environment only. Keep publication settings, serial ordering, deadlines, registry checks and signature/provenance requirements unchanged. No extra release for measurement. Detailed evidence and reproduction will be linked in the performance PR.


Current status — September 20, 2026

Detection fixes (#672), bounded diagnostic detail (#674), and the publisher budget adjustment (#678) are merged. The last three completed releases each had one successful npm publishing attempt, exceeding the former 25-minute budget:

Release Candidate merge → public release Successful publisher step Evidence
0.8.35 1h17m31s 37m30s tag run
0.8.36 2h32m32s 55m15s publishing continuation, completion
0.9.0 1h32m25s 49m35s tag run

0.8.36 is an incident-affected result: GitHub ref observation was rate-limited during escrow, then a Docker container startup timed out in the published harness smoke. Its later completion skipped publishing; it was not another publisher-budget retry. These results validate the larger budget, not a clean total-duration speedup across releases.

For 0.9.0, the exact-tag observation took 8m55s, after main CI had completed. The publisher accepted all 21 packages and recorded 438 registry-pending events (369 version-absent, 11 metadata-pending, 58 audit-pending). Summing the largest recorded elapsed wait for each package gives a 43m38.337s lower bound on convergence waits, not a complete wall-clock decomposition.

Next: profile repeated discovery reads and reuse identical immutable inputs within one invocation where measured. Preserve global candidate arbitration, all terminal/publication evidence, and fresh authorization reads before writes. Keep serial publishing and existing deadlines; do not dispatch an extra benchmark release. The earlier investigation below is retained as historical evidence.


The completed 0.8.32 release took 2h20m30s from candidate merge to public GitHub release, compared with 2h11m14s for 0.8.30 on the same boundary. The former 3h34m baseline included unrelated work and must not be used as a speedup claim. Measurement and linked run evidence are merged in #666 at docs/superpowers/runbooks/2026-09-11-release-performance.md.

Observed bottleneck

The 0.8.32 publisher needed three attempts (7 accepted; then 11 accepted with 7 existing verified; then 3 accepted with 18 existing verified). The first two ended at the overall roughly 25-minute budget while individual package propagation budgets remained valid. Publisher job time totaled 54m26s. Recorded registry waits alone account for at least 41m33.731s, excluding unlogged tails and separate tarball waits. Of 397 pending events, 340 were version-absent, 29 metadata-pending, and 28 audit-pending. Three blocked detection runs added 18m39s of run time.

The audit retry fix was exercised successfully; the next terminal failures were overall publisher-budget exhaustion. Do not assume a larger timeout alone is the best fix.

Scope

  • Reconstruct overall and per-package deadline consumption using the existing logs and execution path; separate active work, registry propagation, repeated verification, CI observation, and queue time.
  • Compare a bounded overall-budget adjustment against reducing repeated detection/verification work. Preserve fail-closed behavior, immutable package evidence, OIDC trust, accepted-package reconciliation, and the existing release order.
  • Choose the smallest implementation that improves completion time and avoids repeated operator recovery without adding manual gates, new credentials, new publishing steps, or additional services.
  • Validate budget behavior with deterministic delayed-registry scenarios and existing release-controller/publisher suites. No gratuitous new release: measure the next ordinary completed release on the same candidate-merge-to-publication boundary.

Acceptance: one ordinary release result with comparable phase timings and explicit limits. Do not count partial, failed, still-recovering, or overnight incident releases as clean speedup evidence. Leave the active 0.8.33 recovery under its current maintainer; do not mutate its candidate or cancel its runs.

Investigation: main merges and repeated detection — September 15, 2026

Publisher retries were caused by the 25-minute overall deadline, not cancellation by main merges. Both failing 0.8.32 publisher logs end with npm publisher overall deadline expired. All publication/recovery runs retained candidate 4084b7a66014e1b4ab8190b76e71a981c126b919. Release concurrency is a shared queue with cancel-in-progress: false; the next main merge cannot replace that candidate or cancel its active publisher.

Main pushes nevertheless enqueue expensive detection. The saved production-observation artifacts identify the actual failures behind the generic “Require a non-ambiguous route” job label:

Run Trigger Detect duration Actual diagnostic
34996309125 Code merge a239527d 6m10s ATTEMPT_COVERAGE_INCOMPLETE, then PUBLISHER_JOB_HISTORY_INVALID
34998832904 Version merge dd1c4c7c 6m01s Same two job-history diagnostics
35000250824 Exact 0.8.32 recovery dispatch 6m28s GitHub asset-download HTTP 500 / UNEXPECTED_CONTENT_TYPE, followed by RELEASE_VERIFIABLE_BASE_DIGEST_MISMATCH

These were observation failures, not evidence that merging 0.8.33 caused candidate arbitration to choose the wrong release. All three reports selected 0.8.32. The two push runs occupied the serialized queue after the first publisher failed; the explicit recovery was created at 17:16:42 UTC but its detect job began only at 17:28:28 UTC.

Reproduced queued-run failure

observeProductionPublicationHistory queries all exact-tag runs, including queued ones. normalizeAllAttemptJobs rejects an empty job array as incomplete attempt coverage; the observer then marks publication history invalid. A disposable local fixture containing a completed failed publisher and a queued first-attempt recovery with zero jobs reproduced both exact diagnostic codes. Probe passed and was removed; no tracked test or workflow changed.

A fresh GitHub read independently confirms the normal API shape: run 35027529122 was an exact-tag 0.8.33 first attempt with status: pending, null conclusion and {total_count: 0, jobs: []}. Historical 0.8.32 reports do not retain the offending run ID/raw job payload, so attribution of those old empty responses to queued run 35000250824 remains a strong inference supported by the timeline, rather than a retained raw-response proof.

The fix must distinguish a positively verified, unstarted first attempt from missing history for a completed or retried run. Never broadly accept empty history or infer that an absent job proves no prior publication. Preserve serialization and duplicate-publication safeguards.

Measured detection cost

The existing local discoverManagedCandidate check classified the code-merge SHA as NO_CANDIDATE/noop in 397 ms and the version-merge SHA as a valid 0.8.33 candidate in 396 ms. No network reader was needed for either classification. However, resolveProductionCandidate proceeds into global discovery even when an ordinary push creates no new candidate.

Read-only profiling found 483 GitHub releases. The first recovery-ownership scan performed one sequential asset inventory read for each: 109.020 seconds summed request time, spanning approximately 110.1 seconds. The code intentionally inspects durable ownership even when names/tags are absent or changed, so simply filtering old/display-named releases would weaken a real invariant. Independent reads can instead use bounded concurrency, with successful results reused within one discovery invocation and explicit fresh authority reads retained at mutation boundaries.

The profiler later encountered an incomplete local installation of the required npm 11.17.0; the extended probe was stopped. The preceding GitHub inventory timings are valid, but the overall probe is not a valid complete-observer benchmark. Hosted artifacts place the three actual observation steps at about 5m50s, 5m40s, and 6m05s respectively; they do not attribute that entire duration to asset listing. Source tracing also confirms full terminal verification of older releases and a late publication-history check.

Revised implementation order

  1. Correct queued first-attempt job-history handling with positive identity/state evidence and regressions for retries/completed runs/changed states.
  2. Use the existing cheap no-candidate result to make ordinary non-version push invocations return before global discovery. Preserve tag-bound continuation, explicit recovery, schedules, and supported recovery-record/controller maintenance triggers; verify those exceptions before implementation. No new manual release step.
  3. Bound concurrency of independent recovery inventory reads and reuse discovery results within one invocation; preserve full ownership discovery, payload limits, and fresh mutation authorization. Measure complete valid observation before/after.
  4. Retry only settled transient GitHub asset-read failures within a small existing/bounded read budget; actual content, identity and digest mismatches remain fatal. This should prevent an HTTP 500 from requiring another complete workflow invocation.
  5. Align publisher/job deadlines with measured work separately. Reducing merge-triggered detection will not prevent the existing 25-minute publisher timeout by itself.

No production code, CI configuration, release run, credentials, or active release candidate was changed by this investigation.

Activity

  1. blove commented on Sep 22, 2026

    @blove
    ContributorAuthor

    Ordinary-release measurement: 0.10.0

    The first ordinary release cut on a candidate that contains the sixty-minute publisher budget. All 21 packages completed in one attempt — no timeout, no resumed publish step, no recovery route.

    Candidate bfaf0c2b3030eebb572703c8f70f0e063593b1fa (#782) merged 2026-09-22 05:51:10 UTC. Release run 35693673498 published v0.10.0 as a public immutable release at 07:33:43 UTC: 1h42m33s end to end, against 2h55m49s for 0.8.34.

    Phase Duration
    Candidate merge to first npm publish step 37m02s
    npm publish step (single attempt) 59m08s
    npm reconciliation 19s
    Five smoke lanes (parallel) 1m08s
    Smoke reconciliation 1m02s
    Audit dispatch to correlation 2m53s
    Publication of the GitHub release 51s

    Publisher evidence: 21 packages accepted, 0 already existing. 485 registry-pending events — 395 version-absent, 84 audit-pending, 6 metadata-pending.

    The budget was necessary, and the margin is thin

    The single attempt ran 59m08s against the sixty-minute overall budget — about 52 seconds of margin. Under the former twenty-five-minute cutoff this release would have been interrupted and resumed exactly as 0.8.34 was, so the change did what it was meant to do. But a release that finishes with under a minute to spare is not comfortably inside the bound: a slightly slower registry, or one more package in the fixed group, puts the next ordinary release back on the resumed-publish path.

    Propagation, not our work, dominates: 395 of the 485 pending events were version-absent, and the last two packages alone (@b4run/vite-plugin, create-b4-app) each waited well over 90 seconds after acceptance. Overlapping package propagation waits — the deferred follow-up — is the lever that would actually reclaim this time; a larger budget only buys more room to wait serially.

    Recommend keeping this open until that is decided, since the limitation this measurement exposes is the remaining serial wait, not the cutoff.

  2. blove commented on Sep 23, 2026

    @blove
    ContributorAuthor

    Ordinary-release measurement: 0.11.2

    Release v0.11.2 is public from candidate 9a8e865428c434eab4da94e151e7581ebaed378f (#817). Tag Release run 35909743102 passed. Its saved npm evidence reports NPM_COMPLETE: all 21 packages have the exact version and latest tag, matching integrity, valid npm signatures, and provenance bound to the candidate commit. A fresh public npm check matched version and integrity for all 21. Five smoke lanes and the independent audit passed; the GitHub Release has 52 assets.

    • Publisher job: 11m 53s (20:00:51–20:12:44 UTC), versus 58m 53s for 0.10.0: 47m faster (~80% less time). This is a release-level observation after both audit freshness (fix(release): revalidate npm audit metadata on retries #783) and deferred verification (perf(release): overlap registry scans with ordered uploads #784), not an isolated estimate of either change.
    • Tag Release run to public Release: 54m 24s (19:30:11–20:24:35 UTC).
    • Initial Release 0.11.2 #817 merge to public Release: 1h 58m 37s (18:25:58–20:24:35 UTC), including failed discovery attempts and a wait for the API request window. The successful exact reconciliation dispatch to publication took 1h 7m 13s.
    • Tag-run detector: 12m 00s, versus 9m 17s in 0.10.0. Discovery remains the main follow-up.

    The initial push detector and one targeted retry blocked before any release mutation with CANDIDATE_DISCOVERY_AMBIGUOUS / exact value read unavailable. Recovery discovery enumerates assets across roughly 489 historical GitHub Releases, and multiple runs can plausibly exhaust the 1,000 requests/hour/repository GITHUB_TOKEN limit. The saved diagnostic did not retain the underlying HTTP status, so rate limiting is a strong inference, not confirmed. A separate authenticated read of all 489 asset lists found no persistent missing Release. After the earlier request window cleared, one exact reconciliation succeeded and the release completed. Follow-up: expose the safe failed-read method/status and reduce historical Release read volume without weakening recovery ownership checks. Keep the publisher's successful order, deadlines, and verification contract intact.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions