Repository navigation
Harden tag release dispatch - #790
Conversation
PR SummaryMedium Risk Overview After dispatch, it polls up to six times (10s apart) until the dispatched-run count increases; if no new run shows up, the step fails explicitly instead of succeeding silently. Helper functions
Reviewed by Cursor Bugbot for commit 2fab074. Bugbot is set up for automated code reviews on this repo. Configure here. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 41863a19f6
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| exit 0 | ||
| fi | ||
| gh workflow run release --repo "${GITHUB_REPOSITORY}" --ref "${RELEASE_TAG}" --field "version=${RELEASE_VERSION}" | ||
| retry "Dispatch release workflow" gh workflow run release --repo "${GITHUB_REPOSITORY}" --ref "${RELEASE_TAG}" --field "version=${RELEASE_VERSION}" |
There was a problem hiding this comment.
Recheck runs before retrying dispatch
When gh workflow run reaches GitHub but the CLI exits non-zero because of a transient response/connection failure, this retries a non-idempotent dispatch without checking whether the run was already created. The GitHub CLI manual says this command creates a workflow_dispatch event and triggers the workflow, and I checked .github/workflows/release.yml:16-18, where duplicate release runs for the same ref are queued rather than canceled; that can run the release pipeline twice for one tag and later fail or race on publishing the same npm version. Re-list for the tag before each dispatch retry instead of blindly retrying this command.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ba6bdfe548
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| expect(dispatchStep?.run).toContain("release_run_count()"); | ||
| expect(dispatchStep?.run).toContain("retry()"); | ||
| expect(dispatchStep?.run).toContain( | ||
| 'retry "List active release workflows" release_run_count', |
There was a problem hiding this comment.
Fix stale release workflow test assertions
As committed, bunx vitest --run test/workflows/tag-release.test.ts fails because the workflow now calls active_release_run_count for the active-run check, but this new assertion still expects release_run_count; the same test also expects the old confirm/error strings below. This makes the workflow test suite fail on every CI run until the assertions are updated to match the YAML.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.
Bugbot Autofix prepared fixes for both issues found in the latest run.
- ✅ Fixed: Tests assert wrong workflow strings
- Updated the workflow test to assert the current helper names, retry label, and error text used by
tag-release.yml.
- Updated the workflow test to assert the current helper names, retry label, and error text used by
- ✅ Fixed: Capped list breaks dispatch confirmation
- Changed dispatch confirmation to compare the latest matching run ID before and after dispatch instead of relying on a limited run-count window.
You can send follow-ups to the cloud agent here.
Reviewed by Cursor Bugbot for commit ba6bdfe. Configure here.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c897d23a29
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| --limit 50 \ | ||
| --jq "[.[] | select(.headBranch == \"${RELEASE_TAG}\" and .event == \"workflow_dispatch\")] | length" |
There was a problem hiding this comment.
Track the dispatched run instead of comparing capped counts
In a redispatch for a tag that already has a previous workflow_dispatch release run near the 50-result cutoff, this capped count can stay unchanged: the new run enters the gh run list --limit 50 window while the old matching run falls out, so release_count > existing_count never becomes true and the job fails after successfully dispatching. Track the latest run id/createdAt, or use the run URL returned by gh workflow run, instead of confirming by count.
Useful? React with 👍 / 👎.
Resolve conflicts in .github/workflows/tag-release.yml and test/workflows/tag-release.test.ts by taking main's hardened dispatch confirmation (dispatched_release_run_count + dispatch_status capture) from PR #790, which is the deliberately-merged source-of-truth hardening (maestro-internal#2792). The mirror sync preserves public-owned CI workflows per the PR's stated invariant. Both Bugbot findings are addressed: - Workflow test assertions now match the workflow YAML (dispatched_release_run_count). - Stale cached telemetry enablement fixed via live shouldEnableTelemetry() checks (commits 8806287 + 7eaaff1 regression test), preserved through the merge.
Address review feedback on the public mirror sync: 1. src/telemetry.ts (codex-connector P2): the meter-only guard added in 8806287 skipped the default file write whenever a remote meter destination was configured, but only canonical-turn events mirror to Meter. Non-canonical events (tool-execution, api-request, background-task) therefore had no sink and were silently dropped. Now skip the default file only for canonical turns when a meter destination is present; non-canonical events fall back to the default file. Regression test in test/telemetry/telemetry-meter.test.ts records a tool-execution event and asserts the default file captures it (and the meter endpoint is not called). 2. .github/workflows/tag-release.yml (Bugbot 0855fa3a): the count-based dispatch confirmation caps gh run list at --limit 50, so a tag that already has 50+ matching dispatched runs would not see the count increase on a new successful dispatch and the step would fail. Add a latest_dispatched_release_run_id() helper (highest databaseId, which is monotonic with creation time) and use it as the primary confirmation, with the count check retained as a fallback. This keeps PR #790's dispatch_status capture and count-based design intact while closing the capped-window edge case. Test assertions updated to lock in the new helper.
* chore: sync public mirror from internal * [maestro] Fix release dispatch confirmation * fix telemetry enablement refresh * [maestro] Keep tag release dispatch test green * [maestro] Restore latest run dispatch confirmation * isolate telemetry oauth regression test * fix(telemetry+ci): keep non-turn telemetry and harden dispatch confirm Address review feedback on the public mirror sync: 1. src/telemetry.ts (codex-connector P2): the meter-only guard added in 8806287 skipped the default file write whenever a remote meter destination was configured, but only canonical-turn events mirror to Meter. Non-canonical events (tool-execution, api-request, background-task) therefore had no sink and were silently dropped. Now skip the default file only for canonical turns when a meter destination is present; non-canonical events fall back to the default file. Regression test in test/telemetry/telemetry-meter.test.ts records a tool-execution event and asserts the default file captures it (and the meter endpoint is not called). 2. .github/workflows/tag-release.yml (Bugbot 0855fa3a): the count-based dispatch confirmation caps gh run list at --limit 50, so a tag that already has 50+ matching dispatched runs would not see the count increase on a new successful dispatch and the step would fail. Add a latest_dispatched_release_run_id() helper (highest databaseId, which is monotonic with creation time) and use it as the primary confirmation, with the count check retained as a fallback. This keeps PR #790's dispatch_status capture and count-based design intact while closing the capped-window edge case. Test assertions updated to lock in the new helper. * fix(ci): guard jq max_by against empty dispatched-run array Bugbot (0855fa3a, high severity) on 8b9dc84: latest_dispatched_release_run_id() used max_by(.databaseId).databaseId with // "" fallback. While // catches the max_by error in some jq builds, it can propagate non-zero under set -euo pipefail in CI when no workflow_dispatch runs exist for the tag yet, aborting the step before a new release can be dispatched. Replace with an explicit length guard: if length == 0 then "" else (max_by(.databaseId).databaseId | tostring) end Verified empty/no-match/match cases all return rc=0. The tostring ensures consistent string output for bash comparison. --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Cursor Agent <cursoragent@cursor.com>

Summary
Source-of-truth: evalops/maestro-internal#2792
Verification