Repository navigation
fix(ci): align beta promotion release guard - #10943
Conversation
Git-on-my-level
left a comment
There was a problem hiding this comment.
Thanks for tightening this guard alignment. I reviewed the release-process guard change against the existing desktop_promote_beta.yml workflow, and the new condition matches the promotion workflow's same-repository workflow_run trust gate while removing the obsolete workflow_dispatch-only expectation.
I also ran the focused contract test directly and the release-process guard script in a stripped temporary checkout; both passed:
python3 .github/scripts/test_desktop_release_flow_contract.pybash scripts/run-release-process-guards.sh
Because this touches release/CI guard logic for desktop beta promotion, I’m leaving this as a positive maintainer signal rather than a formal approval. A human maintainer should still do the final workflow/release-policy review 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.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cc892a912a
ℹ️ 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".
| fragments = { | ||
| node.value for node in ast.walk(guard) if isinstance(node, ast.Constant) and isinstance(node.value, str) |
There was a problem hiding this comment.
Exercise the release guard instead of parsing constants
This regression test never calls check_desktop_qualification_runner; it only verifies that two literals occur somewhere in the function AST. If a later edit leaves the trusted-repository literal in dead or unused code while bypassing the error-producing loop, this test remains green even though the release guard no longer protects beta promotion. Invoke the guard through a controlled workflow fixture and assert that omitting the repository predicate produces an error and including it passes.
AGENTS.md reference: AGENTS.md:L45-L45
Useful? React with 👍 / 👎.
| obsolete_dispatch_gate = "github.event.workflow_run.event == 'workflow_dispatch'" | ||
| self.assertIn(trusted_repository, self.promotion) | ||
| self.assertNotIn(obsolete_dispatch_gate, self.promotion) | ||
| self.assertIn(trusted_repository, fragments) |
There was a problem hiding this comment.
Trigger this contract when the release guard changes
In the inspected .github/checks-manifest.yaml, the desktop-release-one-path-contract trigger list omits .github/scripts/check-release-process-guards.py, even though this new assertion depends directly on that file. On a guard-only change that removes the trusted-repository requirement, the diff-scoped runner selects desktop-release-process-guards but not this test; the weakened checker then accepts the unchanged workflow, so the regression can land without exercising this contract. Add the guard script to this test's manifest triggers.
AGENTS.md reference: AGENTS.md:L119-L119
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4f14e7bb26
ℹ️ 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".
| self.assertIsNotNone(spec) | ||
| self.assertIsNotNone(spec.loader if spec else None) | ||
| guard = importlib.util.module_from_spec(spec) | ||
| spec.loader.exec_module(guard) |
There was a problem hiding this comment.
Run the contract with the locked PyYAML interpreter
In the inspected Repo Checks hygiene lane, desktop-release-one-path-contract is still launched as python3 .github/scripts/test_desktop_release_flow_contract.py; this new import executes the guard's top-level import yaml, but that ambient interpreter is not provisioned with PyYAML (the guard deliberately uses scripts/run-release-process-guards.sh to obtain the locked dependency). On a clean runner, the selected contract now exits with ModuleNotFoundError: No module named 'yaml' before reaching its assertions, so use the locked interpreter/wrapper or avoid importing the dependency-bearing module.
AGENTS.md reference: AGENTS.md:L37-L37
Useful? React with 👍 / 👎.
Git-on-my-level
left a comment
There was a problem hiding this comment.
Thanks for the follow-up on this release-guard alignment. The guard condition itself matches the trusted same-repository workflow_run gate in desktop_promote_beta.yml, but the current head still needs one fix before it can merge.
The new test_release_process_guard_matches_trusted_auto_promotion imports .github/scripts/check-release-process-guards.py directly via importlib. In the CI manifest path this test is run as python3 .github/scripts/test_desktop_release_flow_contract.py, before the release-guard helper has synced the backend Python environment, so that import fails on the module-level import yaml:
ModuleNotFoundError: No module named 'yaml'- failing checks:
Hygiene/PR Metadata Preflight, both atdesktop-release-one-path-contract
I reproduced the split locally as well: the focused test passes only in an environment that already has PyYAML available, while bash scripts/run-release-process-guards.sh passes after syncing the locked backend env. Please adjust the regression test so the manifest command is self-contained in CI too (for example, avoid importing the whole guard module with its PyYAML dependency, or make the manifest command run through the same dependency-prepared wrapper).
Because this is release/CI guard logic for desktop beta promotion, human maintainer workflow/release-policy review is still required after the CI failure 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.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
Bugbot Autofix is ON, but it could not run because the branch was deleted or merged before autofix could start.
Reviewed by Cursor Bugbot for commit 1734353. Configure here.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1734353423
ℹ️ 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".
| - id: desktop-release-one-path-contract | ||
| command: ["python3", ".github/scripts/test_desktop_release_flow_contract.py"] | ||
| triggers: ["codemagic.yaml", ".github/workflows/desktop_auto_release.yml", ".github/workflows/desktop_qualify_beta.yml", ".github/workflows/desktop_promote_beta.yml", ".github/workflows/desktop_recover_beta.yml", ".github/workflows/desktop_rollback_beta.yml", ".github/workflows/desktop_breakglass_rollout_beta.yml", ".github/workflows/desktop_beta_admission_control.yml", ".github/workflows/desktop_promote_prod.yml", ".github/workflows/gcp_backend.yml", "desktop/macos/scripts/qualify-desktop-beta.sh", "desktop/macos/scripts/qualification-cache-reclaim.py", "desktop/macos/scripts/qualification-runner-self-clean.py", "desktop/macos/scripts/qualification-watchdog.py", "desktop/macos/scripts/qualification-lease-command.sh", ".github/scripts/test_desktop_release_flow_contract.py", ".github/checks-manifest.yaml"] | ||
| triggers: ["codemagic.yaml", ".github/workflows/desktop_auto_release.yml", ".github/workflows/desktop_qualify_beta.yml", ".github/workflows/desktop_promote_beta.yml", ".github/workflows/desktop_recover_beta.yml", ".github/workflows/desktop_rollback_beta.yml", ".github/workflows/desktop_breakglass_rollout_beta.yml", ".github/workflows/desktop_beta_admission_control.yml", ".github/workflows/desktop_promote_prod.yml", ".github/workflows/gcp_backend.yml", "desktop/macos/scripts/qualify-desktop-beta.sh", "desktop/macos/scripts/qualification-cache-reclaim.py", "desktop/macos/scripts/qualification-runner-self-clean.py", "desktop/macos/scripts/qualification-watchdog.py", "desktop/macos/scripts/qualification-lease-command.sh", ".github/scripts/check-release-process-guards.py", ".github/scripts/test_desktop_release_flow_contract.py", ".github/checks-manifest.yaml"] |
There was a problem hiding this comment.
Execute the new behavioral guard test in CI
For a PR changing only check-release-process-guards.py, this trigger selects desktop-release-one-path-contract, but that command runs .github/scripts/test_desktop_release_flow_contract.py, where the newly loaded self.promotion is never used; the actual mutation test is in backend/tests/unit/test_desktop_release_scripts.py, and the Backend Unit Tests workflow does not include the guard script in its path filters. Fresh evidence since the earlier review is that the requested trigger was added to a contract that still never invokes the new test, so a guard-only regression can pass CI; wire the pytest through a manifest command using the locked backend interpreter or move the behavioral assertion into the selected contract.
AGENTS.md reference: AGENTS.md:L117-L120
Useful? React with 👍 / 👎.
Resolved by current head 1734353: the manifest contract now passes under plain python3 and release guard checks pass.
Git-on-my-level
left a comment
There was a problem hiding this comment.
Thanks for the quick fix here. I re-checked the current head after the previous CI-environment issue:
python3 .github/scripts/test_desktop_release_flow_contract.pynow passes in a stripped plain-Python environment, so the manifest command is self-contained again.bash scripts/run-release-process-guards.shpasses with the dependency-prepared backend environment and reportsrelease process guard checks passed.- The added backend regression for the trusted repository gate passes in the backend test environment.
The change now looks technically sound as a CI/release-guard alignment: the guard requires the same github.event.workflow_run.head_repository.full_name == github.repository condition that the beta promotion workflow uses, and the obsolete workflow_dispatch expectation stays out.
Because this still touches desktop beta promotion/release guard behavior, I’m leaving this as a positive maintainer signal rather than a formal approval. Human workflow/release-policy review is still warranted 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.
Addresses review feedback on BasedHardware#10943 (chatgpt-codex-connector P1s, cursor Bugbot low): - codex P1: desktop-release-process-guards triggered on backend/tests/unit/test_desktop_release_scripts.py but never executed it — run-release-process-guards.sh only ran check-release-process-guards.py. A guard-only diff could weaken the trusted-repository gate without exercising the mutation test (the backend path selector ignores .github/scripts/**). The runner now executes the backend pytest for test_desktop_release_scripts.py with the locked PyYAML interpreter after the guard script, so the behavioral contract runs in the same lane. - codex P1: the AST-literal check in test_desktop_release_flow_contract.py is a static tripwire; labeled it as such (omi-test-quality: source-inspection) pointing at the behavioral test that covers the trusted-repository gate. - cursor Bugbot low: removed the unused self.promotion fixture from setUp (added for a promotion contract that landed in the backend test instead). Verified: bash scripts/run-release-process-guards.sh -> release process guard checks passed; 25 passed (incl. 2 guard mutation tests) in 0.51s backend/.venv/bin/python -m pytest ... -k guard -> 2 passed python3 .github/scripts/test_desktop_release_flow_contract.py -> 9 tests OK python3 .github/scripts/check-release-process-guards.py -> passed python3 .github/scripts/test_desktop_swift_ci_contract.py -> OK python3 scripts/test_failure_class.py -> OK
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f62b294366
ℹ️ 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".
| # check_desktop_qualification_runner against a mutated promotion workflow). Run | ||
| # it here so a guard-only diff cannot weaken the trusted-repository gate without | ||
| # exercising the mutation test. | ||
| "$BACKEND_PYTHON" -m pytest -q "$ROOT_DIR/backend/tests/unit/test_desktop_release_scripts.py" |
There was a problem hiding this comment.
Select only the promotion guard test
When a guard-related file is pushed, scripts/pre-push calls this wrapper and then immediately schedules test_desktop_release_scripts.py again through backend/test.sh; because this command selects the whole module rather than ::test_release_process_guard_matches_trusted_auto_promotion, all 23 tests run twice instead of adding one focused mutation check. Select the new test by node ID so the guard lane does not broaden and duplicate the push gate.
AGENTS.md reference: AGENTS.md:L117-L119
Useful? React with 👍 / 👎.
| # check_desktop_qualification_runner against a mutated promotion workflow). Run | ||
| # it here so a guard-only diff cannot weaken the trusted-repository gate without | ||
| # exercising the mutation test. | ||
| "$BACKEND_PYTHON" -m pytest -q "$ROOT_DIR/backend/tests/unit/test_desktop_release_scripts.py" |
There was a problem hiding this comment.
Update the locked-interpreter fixture for the second invocation
Because check-manifest-contract runs .github/scripts/test_run_checks.py on every diff, this added interpreter invocation makes the existing test_release_process_guard_uses_locked_pyyaml_in_every_declared_lane fail deterministically: its fake Python writes every non--c invocation to guard-args.txt, so the pytest arguments overwrite the guard-script path and samefile() raises FileNotFoundError. Update that contract fixture to recognize and separately record the pytest invocation before adding this call; the current commit cannot pass the mandatory manifest contract.
AGENTS.md reference: AGENTS.md:L35-L37
Useful? React with 👍 / 👎.
Git-on-my-level
left a comment
There was a problem hiding this comment.
Thanks for the follow-up here. I re-checked the current head and the release-guard alignment itself still looks directionally right, but this revision has a CI blocker that should be fixed before merge.
The current scripts/run-release-process-guards.sh now invokes the backend Python twice: first for .github/scripts/check-release-process-guards.py, then again for -m pytest -q backend/tests/unit/test_desktop_release_scripts.py. That breaks the existing manifest contract test test_release_process_guard_uses_locked_pyyaml_in_every_declared_lane, whose fixture records the backend-python invocation used by the wrapper to ensure the guard runs through the locked PyYAML environment. The second pytest invocation overwrites that recorded command, so CI fails with:
FileNotFoundError: ... '-m\npytest\n-q\n.../backend/tests/unit/test_desktop_release_scripts.py'- failing checks:
Hygiene/PR Metadata Preflightatcheck-manifest-contract
Please adjust this so the manifest/runner contract remains compatible with the wrapper change (for example, by preserving the guard invocation the contract is trying to inspect, updating the contract to understand the additional focused pytest invocation, or otherwise routing the behavioral regression without breaking the locked-PyYAML guard probe).
Because this touches desktop beta promotion/release guard behavior, human workflow/release-policy review is still required after CI is green.
by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.
Git-on-my-level
left a comment
There was a problem hiding this comment.
Thanks for the update — I re-checked the new head after the previous manifest-contract failure.
The blocker I raised on the prior revision looks resolved now: scripts/run-release-process-guards.sh runs the focused backend mutation test first and then execs .github/scripts/check-release-process-guards.py, so the manifest contract still sees the guard invocation rather than pytest args. I also verified the current head in a stripped environment:
python3 .github/scripts/test_run_checks.py→ 40 tests OKpython3 .github/scripts/test_desktop_release_flow_contract.py→ 9 tests OKbash scripts/run-release-process-guards.sh→ backend release-script tests passed andrelease process guard checks passed
The release-guard alignment itself looks technically sound: the guard now requires the same trusted same-repository workflow_run gate that desktop_promote_beta.yml uses, the obsolete workflow_dispatch expectation is gone, and the added backend regression test exercises the behavior by mutating the promotion workflow and confirming the guard rejects it.
Because this still touches desktop beta promotion/release guard behavior, I’m keeping this as a positive maintainer signal rather than a formal approval. Human workflow/release-policy review is still warranted 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.
Superseded by current head 41768e4; the manifest-contract blocker from this review was fixed by running the mutation test before execing the guard, and current CI/local verification is green.
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_d473b0b7-ac03-4674-a4d2-c0f244443d65) |
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_715d0327-916b-4864-ae2b-5c3305c9a46b) |
Git-on-my-level
left a comment
There was a problem hiding this comment.
Thanks for the latest update. I re-checked this head after the manifest wiring change.
What I verified locally in a stripped environment:
python3 .github/scripts/test_run_checks.py-> 40 tests passedpython3 .github/scripts/test_desktop_release_flow_contract.py-> 9 tests passedbackend/.venv/bin/python -m pytest -q backend/tests/unit/test_desktop_release_scripts.py::test_release_process_guard_matches_trusted_auto_promotion-> passedbash scripts/run-release-process-guards.sh-> focused backend regression passed andrelease process guard checks passed
The release-guard alignment still looks technically sound to me: the guard now requires the same trusted same-repository workflow_run gate used by desktop_promote_beta.yml, the obsolete dispatch-only expectation is not reintroduced, and the focused regression test catches a promotion workflow that drops that trust gate. Adding check-release-process-guards.py to the manifest trigger also looks appropriate so guard-only changes exercise the desktop release-flow contract.
I’m not formally approving because this touches desktop beta promotion/release guard behavior and the PR is currently blocked by red Desktop Swift CI (Desktop Swift Static & Test Contracts was cancelled and Desktop Swift Build & Tests failed from that cancelled verify result). Please rerun or resolve that CI state before merge; human workflow/release-policy sign-off is still warranted.
by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.
Failure-Class: none
desktop-release-one-path-contract runs under bare python3, which has no PyYAML, so importing check-release-process-guards.py there raised ModuleNotFoundError and failed the check. The repo already asserts the guard only runs in a lane with the pinned dependency; this test belongs in backend/tests/unit, which runs under the backend interpreter and is already a trigger of desktop-release-process-guards. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
The guard imports its sibling git_bash module, which the backend unit lane cannot resolve, so the moved test failed on import. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Addresses review feedback on BasedHardware#10943 (chatgpt-codex-connector P1s, cursor Bugbot low): - codex P1: desktop-release-process-guards triggered on backend/tests/unit/test_desktop_release_scripts.py but never executed it — run-release-process-guards.sh only ran check-release-process-guards.py. A guard-only diff could weaken the trusted-repository gate without exercising the mutation test (the backend path selector ignores .github/scripts/**). The runner now executes the backend pytest for test_desktop_release_scripts.py with the locked PyYAML interpreter after the guard script, so the behavioral contract runs in the same lane. - codex P1: the AST-literal check in test_desktop_release_flow_contract.py is a static tripwire; labeled it as such (omi-test-quality: source-inspection) pointing at the behavioral test that covers the trusted-repository gate. - cursor Bugbot low: removed the unused self.promotion fixture from setUp (added for a promotion contract that landed in the backend test instead). Verified: bash scripts/run-release-process-guards.sh -> release process guard checks passed; 25 passed (incl. 2 guard mutation tests) in 0.51s backend/.venv/bin/python -m pytest ... -k guard -> 2 passed python3 .github/scripts/test_desktop_release_flow_contract.py -> 9 tests OK python3 .github/scripts/check-release-process-guards.py -> passed python3 .github/scripts/test_desktop_swift_ci_contract.py -> OK python3 scripts/test_failure_class.py -> OK
… test still sees guard args The manifest contract test records the guard's args via a fake interpreter that writes $@ to guard-args.txt on every invocation; running pytest after the guard overwrote that file with pytest args and broke test_release_process_guard_uses_locked_pyyaml_in_every_declared_lane (CI: check-manifest-contract on Hygiene, Windows contracts, and metadata preflight). Verification: python3 .github/scripts/test_run_checks.py -> 40 tests OK
Failure-Class: FC-release-process-guard-scope | new
a8f4913 to
09c602d
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 09c602d93d
ℹ️ 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".
| 'workflows: ["Qualify Desktop Beta Candidate"]', | ||
| "types: [completed]", | ||
| "github.event.workflow_run.conclusion == 'success'", | ||
| "github.event.workflow_run.head_repository.full_name == github.repository", |
There was a problem hiding this comment.
Bind the repository predicate to the job condition
When desktop_promote_beta.yml retains this text in a comment, environment value, or unrelated condition but removes it from jobs.resolve-candidate.if, check_desktop_qualification_runner() still returns no error, allowing automatic promotion without the intended repository-origin gate. Fresh evidence since the earlier review is that the new mutation test only deletes the sole occurrence, so it never covers this decoy or misplacement case even though it now invokes the production checker; parse the workflow and verify the predicate specifically within the resolve-candidate job condition.
AGENTS.md reference: AGENTS.md:L45-L45
Useful? React with 👍 / 👎.
Git-on-my-level
left a comment
There was a problem hiding this comment.
Thanks for the latest update. I re-checked head 09c602d93d now that the Desktop Swift CI has rerun.
What I verified:
- GitHub checks are now green for the relevant release/desktop lanes, including
Desktop Swift Static & Test ContractsandDesktop Swift Build & Tests. python3 .github/scripts/test_run_checks.py-> 44 tests passed.python3 .github/scripts/test_desktop_release_flow_contract.py-> 13 tests passed.bash scripts/run-release-process-guards.sh-> focused backend regression passed andrelease process guard checks passed.
The release-guard alignment still looks technically sound to me: the guard now requires the same trusted same-repository workflow_run gate used by desktop_promote_beta.yml, the obsolete dispatch-only expectation is not reintroduced, the focused mutation test catches a promotion workflow that drops that trust gate, and the manifest trigger includes check-release-process-guards.py so guard-only changes keep exercising the desktop release-flow contract.
I’m leaving this as a positive maintainer signal rather than a formal approval because this still touches desktop beta promotion/release guard behavior. Human workflow/release-policy sign-off is warranted 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.
kodjima33
left a comment
There was a problem hiding this comment.
Tightens the release-process guard to require the trusted-repository gate on beta auto-promotion and adds the behavioral mutation test to the guard runner.
…d/manifest updates Pick up beta-promotion release-guard alignment from BasedHardware#10943 on the same runner/manifest surfaces kodjima flagged.

Summary
Align the release-process guard with the trusted automatic desktop Beta promotion workflow.
Verification
python3 -m pytest .github/scripts/test_desktop_release_flow_contract.pybash scripts/run-release-process-guards.shFailure-Class: none
Note
Low Risk
CI and release-guard contract changes only; they tighten beta promotion preconditions without changing runtime product code.
Overview
Aligns desktop beta auto-promotion release-process guards with the workflow’s trusted-repository check so promotion only runs when the qualifying
workflow_runcame from this repo.check-release-process-guards.pynow requiresgithub.event.workflow_run.head_repository.full_name == github.repositoryindesktop_promote_beta.ymlalongside the existing post-qualification fragments. A mutation test intest_desktop_release_scripts.pycopies promotion workflows into a temp tree, strips that gate, and assertscheck_desktop_qualification_runner()fails;scripts/run-release-process-guards.shruns that pytest before the static guard so guard-only edits can’t drop the gate without failing CI.Checks wiring:
desktop-release-one-path-contracttriggers now includecheck-release-process-guards.py; the flow-contract AST test documents that the trusted-repo behavior is covered by the backend test, not only by string inspection of the guard.Reviewed by Cursor Bugbot for commit a8f4913. Bugbot is set up for automated code reviews on this repo. Configure here.