Skip to content

armgit / cua

Public Imported from GitHub
0

Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.

ci: stop PR-scoped cache saves, cap the gate timeout, and measure it (#6260)

injaneitycc225a5fe94d
diff --git a/.github/scripts/tests/test_ci_gate_workflow.py b/.github/scripts/tests/test_ci_gate_workflow.py
index fa36b910cc..77e6418d61 100644
--- a/.github/scripts/tests/test_ci_gate_workflow.py
+++ b/.github/scripts/tests/test_ci_gate_workflow.py
@@ -36,7 +36,9 @@ def test_gate_wiring():
'edited', 'labeled', 'unlabeled',
]
assert 'concurrency' not in GATE
- assert GATE['jobs']['ci-gate']['timeout-minutes'] == 360
+ # A wedged gate must not hold a required check for six hours. Three hours
+ # still leaves headroom over the longest gate run observed on main.
+ assert GATE['jobs']['ci-gate']['timeout-minutes'] == 180
assert '.workflow_id != $GITHUB_WORKFLOW_ID' in SCRIPT
assert '(.event == \\"pull_request\\" or .event == \\"pull_request_target\\")' in SCRIPT
assert 'claude-auto-fix|ci-release-reminder|review-cua-perception-candidates|/cla[.]yml($|@)' in SCRIPT
diff --git a/.github/scripts/tests/test_e2e_rust_linux_workflow.py b/.github/scripts/tests/test_e2e_rust_linux_workflow.py
index 07faf0b142..b403ae1904 100644
--- a/.github/scripts/tests/test_e2e_rust_linux_workflow.py
+++ b/.github/scripts/tests/test_e2e_rust_linux_workflow.py
@@ -291,3 +291,33 @@ class VerifySkillTests(unittest.TestCase):
finally:
sleeper.terminate()
sleeper.wait(timeout=5)
+
+
+def test_cache_saves_never_write_pull_request_scope_but_keep_dispatches() -> None:
+ """A PR must not save its own sccache entry, but a dispatch still may.
+
+ `github.ref_type == 'branch'` is true on pull_request too, so it never gated
+ a PR save. The in-repo rust-cache action decides `save` itself and only drops
+ a save when `save-if` is the literal "false", so these guards must evaluate
+ false on pull_request and true otherwise. Swatinem/rust-cache honours
+ `save-if` directly and was the one site writing PR-scoped entries.
+ """
+ workflow = WORKFLOW.read_text(encoding="utf-8")
+ # Only the save guards: setup-node's `cache:` inputs are a separate decision.
+ save_guards = [line for line in workflow.splitlines() if 'save-if:' in line]
+ assert not any("ref_type == 'branch'" in line for line in save_guards)
+
+ # `needs.source.outputs.sha == github.sha` must survive: a dispatch can
+ # certify an older SHA, and that run must not seed main's scope with it.
+ swatinem = workflow.split("- uses: Swatinem/rust-cache", 1)[1].split("- uses:", 1)[0]
+ assert (
+ "save-if: ${{ (github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch')"
+ " && needs.source.outputs.sha == github.sha }}" in swatinem
+ )
+
+ assert (
+ workflow.count(
+ "save-if: ${{ github.event_name != 'pull_request' && needs.source.outputs.sha == github.sha }}"
+ )
+ == 4
+ )
diff --git a/.github/scripts/tests/test_e2e_rust_windows_workflow.py b/.github/scripts/tests/test_e2e_rust_windows_workflow.py
index de94b6147a..3caa3e2f91 100644
--- a/.github/scripts/tests/test_e2e_rust_windows_workflow.py
+++ b/.github/scripts/tests/test_e2e_rust_windows_workflow.py
@@ -107,3 +107,23 @@ def test_matrix_summary_recovers_results_when_lane_summary_is_missing(tmp_path:
assert f"[recordings/windows-wpf-click/recording.mp4]({artifact_url})" in summary
assert "No lane summary artifact was produced." not in summary
assert step_summary.read_text(encoding="utf-8") == summary
+
+
+def test_cache_saves_never_write_pull_request_scope_but_keep_dispatches() -> None:
+ """Same invariant as the Linux matrix: no PR-scoped saves, dispatches still save."""
+ workflow = (ROOT / ".github/workflows/e2e-rust-windows.yml").read_text(encoding="utf-8")
+ save_guards = [line for line in workflow.splitlines() if 'save-if:' in line]
+ assert not any("ref_type == 'branch'" in line for line in save_guards)
+ assert (
+ workflow.count(
+ "save-if: ${{ github.event_name != 'pull_request' && needs.source.outputs.sha == github.sha"
+ " && inputs.runner == 'windows-latest' }}"
+ )
+ == 3
+ )
+ assert (
+ workflow.count(
+ "save-if: ${{ github.event_name != 'pull_request' && needs.source.outputs.sha == github.sha }}"
+ )
+ == 1
+ )
diff --git a/.github/workflows/ci-gate.yml b/.github/workflows/ci-gate.yml
index 58455e7692..d56db3347f 100644
--- a/.github/workflows/ci-gate.yml
+++ b/.github/workflows/ci-gate.yml
@@ -17,7 +17,7 @@ jobs:
ci-gate:
name: ci-gate
runs-on: ubuntu-latest
- timeout-minutes: 360
+ timeout-minutes: 180
steps:
# Which workflows this gate may ignore, from the paths the PR changes, the area map
# (.github/ci-areas.json) and the package graph (.github/scripts/ci_graph.py); see
diff --git a/.github/workflows/e2e-rust-linux.yml b/.github/workflows/e2e-rust-linux.yml
index 0b4858efc6..fc598dae13 100644
--- a/.github/workflows/e2e-rust-linux.yml
+++ b/.github/workflows/e2e-rust-linux.yml
@@ -110,7 +110,7 @@ jobs:
with:
workspaces: "libs/cua-driver/rust -> target"
key: e2e-shared
- save-if: ${{ github.ref_type == 'branch' && needs.source.outputs.sha == github.sha }}
+ save-if: ${{ (github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch') && needs.source.outputs.sha == github.sha }}
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: "22"
@@ -157,7 +157,7 @@ jobs:
with:
workspaces: "libs/cua-driver/rust -> target"
key: e2e-shared
- save-if: ${{ github.ref_type == 'branch' && needs.source.outputs.sha == github.sha }}
+ save-if: ${{ github.event_name != 'pull_request' && needs.source.outputs.sha == github.sha }}
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: "22"
@@ -206,7 +206,7 @@ jobs:
with:
workspaces: "libs/cua-driver/rust -> target"
key: e2e-native
- save-if: ${{ github.ref_type == 'branch' && needs.source.outputs.sha == github.sha }}
+ save-if: ${{ github.event_name != 'pull_request' && needs.source.outputs.sha == github.sha }}
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: "22"
@@ -256,7 +256,7 @@ jobs:
with:
workspaces: "libs/cua-driver/rust -> target"
key: e2e-capture
- save-if: ${{ github.ref_type == 'branch' && needs.source.outputs.sha == github.sha }}
+ save-if: ${{ github.event_name != 'pull_request' && needs.source.outputs.sha == github.sha }}
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: "22"
@@ -306,7 +306,7 @@ jobs:
with:
workspaces: "libs/cua-driver/rust -> target"
key: e2e-installer
- save-if: ${{ github.ref_type == 'branch' && needs.source.outputs.sha == github.sha }}
+ save-if: ${{ github.event_name != 'pull_request' && needs.source.outputs.sha == github.sha }}
- name: Install Rust build dependencies
uses: ./.github/actions/apt-install
with:
diff --git a/.github/workflows/e2e-rust-windows.yml b/.github/workflows/e2e-rust-windows.yml
index e277aecc9f..f2e38b021b 100644
--- a/.github/workflows/e2e-rust-windows.yml
+++ b/.github/workflows/e2e-rust-windows.yml
@@ -101,7 +101,7 @@ jobs:
with:
workspaces: "libs/cua-driver/rust -> target"
key: e2e-shared
- save-if: ${{ github.ref_type == 'branch' && needs.source.outputs.sha == github.sha && inputs.runner == 'windows-latest' }}
+ save-if: ${{ github.event_name != 'pull_request' && needs.source.outputs.sha == github.sha && inputs.runner == 'windows-latest' }}
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: "22"
@@ -146,7 +146,7 @@ jobs:
with:
workspaces: "libs/cua-driver/rust -> target"
key: e2e-native
- save-if: ${{ github.ref_type == 'branch' && needs.source.outputs.sha == github.sha && inputs.runner == 'windows-latest' }}
+ save-if: ${{ github.event_name != 'pull_request' && needs.source.outputs.sha == github.sha && inputs.runner == 'windows-latest' }}
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: "22"
@@ -191,7 +191,7 @@ jobs:
with:
workspaces: "libs/cua-driver/rust -> target"
key: e2e-capture
- save-if: ${{ github.ref_type == 'branch' && needs.source.outputs.sha == github.sha && inputs.runner == 'windows-latest' }}
+ save-if: ${{ github.event_name != 'pull_request' && needs.source.outputs.sha == github.sha && inputs.runner == 'windows-latest' }}
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: "22"
@@ -236,7 +236,7 @@ jobs:
with:
workspaces: "libs/cua-driver/rust -> target"
key: e2e-installer
- save-if: ${{ github.ref_type == 'branch' && needs.source.outputs.sha == github.sha }}
+ save-if: ${{ github.event_name != 'pull_request' && needs.source.outputs.sha == github.sha }}
- name: Verify installer runner is interactive
shell: pwsh
run: .\scripts\ci\windows\verify-user-session.ps1