fix(release): correlate the PyPI monitor with its dispatched publish run

Author: LearningCircuitCreated Sep 29, 2026Updated Sep 29, 2026

monitor-pypi in .github/workflows/release.yml can report success for an unrelated publish.yml run. That lets create-release proceed even when the intended release's PyPI publication failed or has not appeared yet.

Verified on current main at 96a514454. The polling shell is also unchanged by #6887, where this pre-existing problem was identified.

The poll requests only status,conclusion,createdAt, filters to runs created after DISPATCH_TIME - 60 seconds, and takes the first result. It does not match the dispatch, release tag, release commit, or parent release run, and it does not retain a selected publish run ID. RELEASE_TAG is only used for logging in this step.

Reproduction

Execute the actual Wait for PyPI publish workflow to complete shell with DISPATCH_TIME=2026-09-29T12:00:00Z, stub sleep, and make gh run list return:

json
[
  {"status":"completed","conclusion":"success","createdAt":"2026-09-29T12:00:10Z"},
  {"status":"completed","conclusion":"failure","createdAt":"2026-09-29T12:00:05Z"}
]

Treat the newer successful run as unrelated and the failed run as the intended dispatch. The unmodified shell exits 0 and writes pypi_result=success.

A second fixture containing only an unrelated success at 11:59:30Z, before the intended run appears, also exits 0 because of the 60-second buffer. A control containing only the intended failure correctly exits 1. These cases were reproduced offline with the real shell and jq; no release or publish workflow was dispatched.

Follow-up

  • Carry a unique correlation value from the release dispatch into queryable publish-run metadata, bound to the intended release identity. Select the matching run and poll that exact run ID; timestamps alone cannot establish identity.
  • Account for repository_dispatch using the default branch's workflow commit; its headSha is not necessarily client_payload.sha.
  • Preserve deliberate recovery/rerun behavior and coordinate payload changes with #6887 and #6648.
  • Add regression cases for unrelated newer/older successes, the intended run failing or not appearing, unrelated failures, and recovery attempts. Missing or ambiguous identity must not authorize GitHub Release creation.

Checked open and closed issues for monitor-pypi, publish-pypi, PyPI monitoring, workflow-run correlation, and PyPI generally before filing; no existing issue covers this run-selection defect.

Source: LearningCircuit/local-deep-research