fix(ci): retire superseded Windows release sync PRs (#10727) - #10960
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
There was a problem hiding this comment.
1 issue found across 5 files
Confidence score: 4/5
- In
.github/workflows/sync-docs.yml, the workflow comment says docs PRs should be validated like human-authored PRs, but the immediate auto-merge step (gh pr me...) risks short-circuiting that intent and merging changes without equivalent gatekeeping; align the merge step with required checks/review conditions (or remove the conflicting claim) so the workflow behavior matches its stated safety model.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name=".github/workflows/sync-docs.yml">
<violation number="1" location=".github/workflows/sync-docs.yml:104">
P2: The change's stated purpose (per the new comment) is to author the PR with the Omi Bot app token so the generated diff is "verified by the same lanes as any human PR". But the very next step auto-merges with `gh pr merge --admin` immediately after PR creation, and the new retry loop only sleeps a fixed 5s — it never waits for the newly-triggered `pull_request` check suites to start or pass before merging. As a result the sync PR can be merged before (or regardless of) the verification lanes it was just re-enabled for, which undercuts the documented intent. Consider waiting for the required check suites to conclude successfully before attempting the admin merge (e.g., poll `gh pr checks`/mergeable state rather than blind 5s retries), or drop the `--admin` flag so the checks genuinely gate the merge.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| set -euo pipefail | ||
| merge_ok=0 | ||
| for attempt in 1 2 3; do | ||
| if gh pr merge --admin --merge --delete-branch "$PR_URL"; then |
There was a problem hiding this comment.
P2: The change's stated purpose (per the new comment) is to author the PR with the Omi Bot app token so the generated diff is "verified by the same lanes as any human PR". But the very next step auto-merges with gh pr merge --admin immediately after PR creation, and the new retry loop only sleeps a fixed 5s — it never waits for the newly-triggered pull_request check suites to start or pass before merging. As a result the sync PR can be merged before (or regardless of) the verification lanes it was just re-enabled for, which undercuts the documented intent. Consider waiting for the required check suites to conclude successfully before attempting the admin merge (e.g., poll gh pr checks/mergeable state rather than blind 5s retries), or drop the --admin flag so the checks genuinely gate the merge.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At .github/workflows/sync-docs.yml, line 104:
<comment>The change's stated purpose (per the new comment) is to author the PR with the Omi Bot app token so the generated diff is "verified by the same lanes as any human PR". But the very next step auto-merges with `gh pr merge --admin` immediately after PR creation, and the new retry loop only sleeps a fixed 5s — it never waits for the newly-triggered `pull_request` check suites to start or pass before merging. As a result the sync PR can be merged before (or regardless of) the verification lanes it was just re-enabled for, which undercuts the documented intent. Consider waiting for the required check suites to conclude successfully before attempting the admin merge (e.g., poll `gh pr checks`/mergeable state rather than blind 5s retries), or drop the `--admin` flag so the checks genuinely gate the merge.</comment>
<file context>
@@ -84,17 +95,25 @@ jobs:
+ set -euo pipefail
+ merge_ok=0
+ for attempt in 1 2 3; do
+ if gh pr merge --admin --merge --delete-branch "$PR_URL"; then
+ merge_ok=1
+ break
</file context>
e7fda1e to
7228c78
Compare
cubic review follow-up on BasedHardware#10960: the search matched any open PR whose head starts with release/windows-v*, which could include fork-origin contributor PRs this release job must not touch. Request isCrossRepository in the gh query, default the selection to same-repo only, and add a fork fixture to the contract test. Also pass an explicit --limit so cleanup does not silently stop at the CLI default (30) after a long outage or backlog growth. Co-authored-by: CommandCodeBot <noreply@commandcode.ai>
|
Addressed both cubic review points:
5/5 contract tests pass; |
|
Thanks for tightening this up. I reviewed the current head and the follow-up addresses the important safety points from the earlier automated review: the selector now reads I also ran the new unit test and the helper self-test locally in a stripped environment; they pass, and the GitHub checks on this head are green. Because this changes release workflow behavior and can close PRs, I’m leaving this as a positive maintainer signal rather than a formal approval. A human maintainer should still sign off on the workflow policy before merge. by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with |
|
Independently verified the final head (e7ba584):
The workflow step is correctly best-effort/non-fatal ( @Git-on-my-level — @kodjima33 approved and your automation re-verified (90 passed, self-test green, CI clean). Requesting your human sign-off on this Windows release-workflow change (needs-maintainer-review / workflow-review). |
|
@Git-on-my-level PR #10960 (sync-docs batch, related to #10959) is MERGEABLE with CI passing — awaiting your review for sign-off. |
e7ba584 to
61076e3
Compare
|
@Git-on-my-level The current failing Dart check is isolated to |
…0727) Each Windows release opens a release/windows-v* sync PR to stamp desktop/windows/package.json back onto main. The release tag is authoritative, so older open sync PRs are pure review noise once a newer release has a PR; nine had accumulated. Add a testable Python helper that lists open PRs whose same-repo head matches the release/windows-v* prefix, excludes the current release PR, and closes the rest as superseded with a pointer to the newest. The selection predicate is unit-tested (current PR retained, unrelated heads never selected) and wired into the checks-manifest so the contract runs in CI. Cleanup stays best-effort and non-fatal: publishing and tags remain authoritative. Co-authored-by: CommandCodeBot <noreply@commandcode.ai>
After the current release's sync PR exists, invoke the retire helper so older release/windows-v* PRs targeting main are closed as superseded. Failure is non-fatal: the release tag is already published and remains the source of truth. Co-authored-by: CommandCodeBot <noreply@commandcode.ai>
cubic review follow-up on BasedHardware#10960: the search matched any open PR whose head starts with release/windows-v*, which could include fork-origin contributor PRs this release job must not touch. Request isCrossRepository in the gh query, default the selection to same-repo only, and add a fork fixture to the contract test. Also pass an explicit --limit so cleanup does not silently stop at the CLI default (30) after a long outage or backlog growth. Co-authored-by: CommandCodeBot <noreply@commandcode.ai>
The script advertised `--self-test` as a hermetic check, but argparse required --current-pr/--version even in that mode, so the documented invocation failed before reaching the test. Make those args optional and validate them only for the real cleanup path. Co-authored-by: CommandCodeBot <noreply@commandcode.ai>
61076e3 to
0634e18
Compare
|
Rebased the actual PR branch onto latest |
Git-on-my-level
left a comment
There was a problem hiding this comment.
Thanks for the careful safety constraints here. I found one blocking issue in the current implementation:
gh pr list --search "head:release/windows-v" does not match the same-repo release/windows-v* sync branches as a prefix. A live query against this repo returns zero results for that qualifier, so the retirement script would usually no-op and leave the superseded Windows sync PRs open instead of closing them.
Please change the listing path to fetch candidate open PRs in a way that does not rely on head: prefix matching (for example, list open PRs for main with number,headRefName,isCrossRepository and apply the existing head_ref.startswith(prefix) predicate locally, or use a broader search only as a prefilter and still filter locally). Please also add a test seam/fixture that would catch the list/query behavior, not just the pure selector.
What I verified locally on the current head:
python3 .github/scripts/test_retire_superseded_sync_prs.pypasses in a stripped environment.python3 .github/scripts/retire_superseded_sync_prs.py --self-testexits 0 in a stripped environment.- The new manifest entry parses and is registered once.
- GitHub currently shows the Desktop Swift checks failing; the visible failure appears outside this PR’s Windows-release cleanup diff, but required checks still need maintainer rerun/resolution before merge.
Because this changes workflow behavior and can close PRs, needs-maintainer-review / workflow-review should stay until a human maintainer signs off.
by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.
gh pr list --search head:release/windows-v returns zero same-repo results, so retirement became a no-op. List open main PRs and filter by headRefName prefix locally, with a regression test on the query args. Co-authored-by: Cursor <cursoragent@cursor.com>
|
@Git-on-my-level — addressed the blocking listing issue on
Desktop Swift reds on the prior head looked outside this Windows-release cleanup diff; CI will rerun on this push. Please re-review / clear changes-requested when convenient — human workflow sign-off still required. |
|
Per current CI check summary: all checks show pass (any remaining are skipping). Could you please dismiss the existing 'Changes requested' review now that there are no failing signals on this head? Thanks. |
Resolved on 2032e1f: listing no longer uses head: prefix search, adds local prefix filtering plus list/parse contract coverage; current review is a positive signal, not changes requested.
Git-on-my-level
left a comment
There was a problem hiding this comment.
Thanks for the follow-up. I re-reviewed the current head and the earlier blocking issue is resolved: the retirement script no longer relies on gh pr list --search head:...; it lists open PRs against main, carries isCrossRepository, and applies the release/windows-v prefix filter locally. The new contract tests cover current-PR retention, unrelated heads, prefix-not-contains, fork-origin PRs, the listing args, and parsing the cross-repo flag.
I also re-ran the unit test and helper self-test in a stripped environment; they pass. CI is green on this head.
Because this workflow can close PRs as part of release automation, I’m keeping this as a positive maintainer signal rather than formal approval. needs-maintainer-review / workflow-review should remain for human workflow-policy sign-off before merge.
by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.
|
Verified current head (2032e1f) in
Given this, could you please add the approving review so the code-owner gate clears (needs-maintainer-review / workflow-review)? |
|
@Git-on-my-level final approval reminder: PR #10960 is CI-green at 2032e1f. Your changes-request is dismissed; the listing now avoids head: prefix search, filters same-repo release/windows-v* heads locally, preserves forks, and has 7 contract tests plus self-test passing. The only remaining gate is workflow code-owner approval. |
Keep Windows sync-PR retirement tip current for workflow CO.
|
@Git-on-my-level need human response — formal workflow/code-owner APPROVE is the only merge blocker on #10960. Author-clear:
Please human / workflow-review APPROVE (or explicit hold) when you can. Branch protection is waiting on code owner review from you ( |
Git-on-my-level
left a comment
There was a problem hiding this comment.
Thanks for the continued work here. I re-reviewed the current head and the core safety predicates still look good: current PR retention, same-repo-only selection via isCrossRepository, local release/windows-v prefix filtering, no branch/tag deletion, and best-effort/non-fatal workflow behavior are all the right shape.
I found one remaining blocker before this should be merged: the candidate listing is still bounded to --limit 100 while this repo currently has more than 100 open PRs targeting main. Superseded Windows sync PRs are exactly the kind of older/noisy PRs that can fall outside that first page, which would make the cleanup silently no-op for stale sync PRs even though a newer release PR exists. Please make the listing exhaustive enough for this repo (for example, paginate/fetch all open PRs for main, or use a higher bounded limit with a contract that fails when the API result is truncated) before applying the local prefix + same-repo filters.
What I verified locally on this head:
python3 .github/scripts/test_retire_superseded_sync_prs.pypasses (7/7).python3 .github/scripts/retire_superseded_sync_prs.py --self-testexits 0.- The manifest entry is registered once.
- A live
gh pr list --base main --state open --limit 100only returns the first 100 PRs while the repo currently has more open PRs againstmain, so the current bound can miss older superseded sync PRs.
Because this changes release workflow behavior and can close PRs, needs-maintainer-review / workflow-review should stay for human workflow-policy sign-off after the truncation issue is fixed.
by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.
gh pr list --limit 100 truncated when main has 100+ open PRs, so older superseded release/windows-v* sync PRs could be missed. Fetch all open PRs via gh api --paginate --slurp and keep local prefix/fork filters. Co-authored-by: Cursor <cursoragent@cursor.com>
|
@Git-on-my-level addressed the truncation blocker on tip Fix: listing no longer uses Also: workflow passes Contracts:
Please re-review / dismiss CHANGES_REQUESTED when you can. Workflow-policy human sign-off still remains after that. |
|
@Git-on-my-level need human response — please dismiss CR / re-review on tip Your truncation blocker is addressed (was already on
CI re-running on the main merge. Please dismiss CHANGES_REQUESTED / human |
Resolved on current head: candidate listing now uses gh api --paginate --slurp, and the contract tests cover multi-page parsing so older page-2 sync PRs are not truncated.
Git-on-my-level
left a comment
There was a problem hiding this comment.
Thanks for the follow-up — I re-reviewed the current head and the previous truncation blocker is resolved.
What I checked:
.github/scripts/retire_superseded_sync_prs.pynow builds the candidate list withgh api --paginate --slurpinlist_open_prs_args(), then parses every returned page inparse_listed_prs(). That addresses the prior--limit 100first-page truncation concern for this repo’s current PR volume. The selector still retains the current PR, requires therelease/windows-vhead prefix, and skips cross-repo/missing-head-repo PRs before any close attempt..github/scripts/test_retire_superseded_sync_prs.pynow has 8 focused contracts, including the multi-page flattening case that keeps an older page-2 sync PR visible to the local selector, plus missing-head-repo handling as cross-repo..github/workflows/desktop_windows_release.ymlinvokes the cleanup only after a sync PR number exists, passes--repository "$GITHUB_REPOSITORY", and keeps the cleanup non-fatal with the shell fallback, so a cleanup failure cannot block an already-tagged release..github/checks-manifest.yamlregisterswindows-sync-pr-retirement-contractonce and wires it to the workflow/script/test triggers.
I also validated locally in a stripped environment:
python3 .github/scripts/test_retire_superseded_sync_prs.pypasses (8/8).python3 .github/scripts/retire_superseded_sync_prs.py --self-testexits 0.- The manifest entry parses and is registered once.
- A live read-only paginated API check for open PRs against
mainreturned multiple pages ([100, 84]), which is the failure mode the new pagination/test now covers.
This is a positive maintainer signal from me. Because the PR changes release workflow behavior and can close PRs, I’m still leaving needs-maintainer-review / workflow-review in place for human workflow-policy sign-off before merge rather than formally approving.
by AI on behalf of David — workflow-policy sign-off is needed here because this release automation can close superseded PRs.
|
@Git-on-my-level @kodjima33 workflow-review ping: current head is MERGEABLE; the superseded Windows sync retirement guard has no author-side blocker. Please approve or state an explicit hold. |
|
@Git-on-my-level @undivisible review ping — this one is ready and has been waiting 1 day. MERGEABLE, no failing checks on the current head. It retires superseded Windows release sync PRs (#10727). Blocked only on workflow CODEOWNER approval — Still current and still author-side clear. Verified against |
|
Yes — still active and not superseded. Fresh author-side check on 2026-08-28:
There is no remaining code or verification action for the author. The sole blocker is the human workflow CODEOWNER approval already requested from @Git-on-my-level @undivisible need human response: please approve the workflow policy or state an explicit hold so this month-old PR can reach a terminal decision. |
Fixes #10727
What changed and why
Each Windows release opens a
release/windows-v<version>sync PR that stampsdesktop/windows/package.jsonback ontomain. The release tag is authoritative, so older open sync PRs are pure review noise once a newer release has a PR — nine had accumulated (#10419, #10513, #10525, #10533, #10653, #10684, #10716, #10718, #10723).After the current release's sync PR is created, this closes older same-repo
release/windows-v*PRs targetingmainas superseded, with a comment pointing at the newest PR. Cleanup is best-effort and non-fatal: publishing and tags remain authoritative, and branches/releases/tags are never deleted.Product invariants affected
None (CI workflow + check script only).
How it was verified
python3 .github/scripts/test_retire_superseded_sync_prs.py— 4/4 pass (current PR retained, unrelated heads never selected, prefix-not-contains, empty/single cases).python3 .github/scripts/retire_superseded_sync_prs.py --self-test— passes.actionlint .github/workflows/desktop_windows_release.yml— clean.python3 .github/scripts/check_runner_cost_policy.py— passed.python3 .github/scripts/check_deployment_secret_boundary.py --base origin/main— passed.python3 .github/scripts/test_run_checks.py— no new failures vs pristinemain(the 2 pre-existing failures are sparse-checkout artifacts:desktop/macos/tests/...files not present locally).Tests
New
test_retire_superseded_sync_prs.pycovers the selection predicate, satisfying the issue's acceptance criterion #5 ("add a contract regression proving the current PR is retained and unrelated PRs are never selected"). It is wired into the checks-manifest (windows-sync-pr-retirement-contract) so it runs in CI whenever the workflow or script changes.Failure class (fixes)
Failure-Class: none
Scoped cleanups
None.