Skip to content

The agent that grows with you

fix(ci): route update dependencies and reject selected consumer skips

Teknium259fe73b0b88
diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
index 34861a35631..7f53b6db96d 100644
--- a/.github/workflows/ci.yaml
+++ b/.github/workflows/ci.yaml
@@ -308,7 +308,8 @@ jobs:
# Gate: runs after everything. ``if: always()`` ensures it reports a
# status even when some deps were skipped.
#
- # Non-release (PR/push): failure fails, skipped counts as success.
+ # Non-release (PR/push): failure fails. Update/E2E consumers selected
+ # by detect.outputs must succeed; only unselected consumers may skip.
# Release (inputs.release): strict — every required job must be
# `success`. A skipped required lane fails the gate; only the PR-only
# jobs (history-check, lockfile-diff, supply-chain) and
diff --git a/scripts/ci/classify_changes.py b/scripts/ci/classify_changes.py
index 6665773aed5..09e6f54410b 100644
--- a/scripts/ci/classify_changes.py
+++ b/scripts/ci/classify_changes.py
@@ -282,6 +282,14 @@ _DESKTOP_BUILD_ENTRY_POINTS = (
# What the entry points import, outside the update_* family and the pipeline above.
_UPDATE_DEPENDENCIES = (
"hermes_cli/_subprocess_compat.py", # update git env, process-tree kill, PM git exposure
+ "hermes_cli/local_runtime/processes.py", # bounded probes' spawn_server/job custody
+ "agent/deadline.py", # bounded probes' process-tree timeout cleanup
+ # migrate_all_homes' second-hop provider/profile/install decisions.
+ "agent/memory_provider.py",
+ "hermes_cli/plugins_cmd_install.py",
+ "hermes_cli/plugins_cmd.py",
+ "pm/plugins_state.py",
+ "pm/install.py",
"hermes_cli/desktop_build_lock.py",
"hermes_cli/memory_provider_migration.py",
"hermes_cli/left_core_migration.py", # source_build migrates plugins that left core
diff --git a/scripts/ci/required_results.py b/scripts/ci/required_results.py
index 1ccfcb64aea..b2aba2ad75f 100644
--- a/scripts/ci/required_results.py
+++ b/scripts/ci/required_results.py
@@ -4,10 +4,11 @@
Behavior tests: tests/ci/test_required_results.py
Input: the JSON ``toJSON(needs)`` of the all-checks-pass job on stdin.
-Any non-``success`` result fails the gate. ``skipped`` additionally fails in
-release mode unless the job is in :data:`EXCLUDED_JOBS` (PR-only jobs that
-cannot run on a tag event, plus the deferred Desktop E2E). The OSV scan is
-advisory in its findings only — its execution is required.
+Failures always fail the gate. A skipped or missing update/E2E consumer also
+fails whenever ``detect.outputs`` selects its lane. Other skips additionally
+fail in release mode unless the job is in :data:`EXCLUDED_JOBS` (PR-only jobs
+that cannot run on a tag event, plus the deferred Desktop E2E). The OSV scan
+is advisory in its findings only — its execution is required.
echo "$NEEDS" | python3 scripts/ci/required_results.py [--release]
"""
@@ -28,6 +29,15 @@ EXCLUDED_JOBS = frozenset((*PR_ONLY_JOBS, *DEFERRED_JOBS))
NEEDS_JSON_OUTPUT = "needs-json"
+# Reusable-workflow parents of the update/E2E consumers. The actual detect
+# outputs already arrive in toJSON(needs); a selected consumer cannot skip
+# merely because this is a PR rather than a release.
+_UPDATE_CONSUMER_LANES = {
+ "tests": ("python", "e2e", "e2e_upgrade"),
+ "tests-os": ("python", "desktop_updater", "e2e", "e2e_upgrade"),
+ "e2e-desktop-update": ("e2e_desktop_update",),
+}
+
def evaluate_gate(
needs: dict[str, dict[str, Any]] | None,
@@ -41,13 +51,17 @@ def evaluate_gate(
failed: list[str] = []
allowed_skips: list[str] = []
entries = needs or {}
+ lanes = (entries.get("detect") or {}).get("outputs") or {}
+ required = {job for job, keys in _UPDATE_CONSUMER_LANES.items()
+ if any(lanes.get(key) in ("true", True) for key in keys)}
if not entries:
failed.append("<no-needs>")
+ failed.extend(required - entries.keys())
for name, info in entries.items():
result = (info or {}).get("result")
if result == "success":
continue
- if result == "skipped" and (not release or name in EXCLUDED_JOBS):
+ if result == "skipped" and name not in required and (not release or name in EXCLUDED_JOBS):
allowed_skips.append(name)
continue
failed.append(name)
diff --git a/tests/ci/test_required_results.py b/tests/ci/test_required_results.py
index e14055f8bd0..14a59c6375d 100644
--- a/tests/ci/test_required_results.py
+++ b/tests/ci/test_required_results.py
@@ -35,6 +35,27 @@ def test_status_policy(job, result, ordinary, excluded, release):
"allowed_skips": [job] if expected and result == "skipped" else []}
[email protected]("lane,jobs", [
+ ("python", ("tests", "tests-os")),
+ ("e2e", ("tests", "tests-os")),
+ ("e2e_upgrade", ("tests", "tests-os")),
+ ("desktop_updater", ("tests-os",)),
+ ("e2e_desktop_update", ("e2e-desktop-update",)),
+])
[email protected]("result", ["skipped", "absent", "success"])
+def test_selected_update_consumers_must_succeed(lane, jobs, result):
+ needs = {"detect": {"result": "success", "outputs": {lane: "true"}}}
+ if result != "absent":
+ needs.update({job: {"result": result} for job in jobs})
+ verdict = evaluate_gate(needs)
+ assert verdict["ok"] is (result == "success")
+ assert verdict["failed"] == ([] if result == "success" else sorted(jobs))
+ assert verdict["allowed_skips"] == []
+ # False string outputs must not arm a job merely because they are truthy.
+ needs["detect"]["outputs"][lane] = "false"
+ assert evaluate_gate(needs)["ok"]
+
+
def test_release_exclusion_policy():
assert required_results.EXCLUDED_JOBS == {
"history-check", "lockfile-diff", "supply-chain", "e2e-desktop",
@@ -67,7 +88,7 @@ def test_cli_stdin_exit_codes_and_output(tmp_path, release, results, code, repor
)
assert child.returncode == code, child.stderr
assert report in child.stdout
- key, value = output.read_text(encoding="utf-8").strip().split("=", 1)
+ key, value = output.read_text(encoding="utf-8-sig").strip().split("=", 1)
assert key == "needs-json"
assert json.loads(value) == results
assert f"{key}={value}" in child.stdout
diff --git a/tests/ci/test_update_transitive_routing.py b/tests/ci/test_update_transitive_routing.py
new file mode 100644
index 00000000000..22bfec4f5f6
--- /dev/null
+++ b/tests/ci/test_update_transitive_routing.py
@@ -0,0 +1,31 @@
+"""Executed second-hop update dependencies must retain their real-update routes.
+
+These are scoped call edges, not a claim that a recursive static import walk
+identifies the executed dependency closure of every lazy branch.
+"""
+
+import pytest
+
+from tests.ci.test_update_ci_routing import _ci_run, _consumers_reached, _real_classifier
+
+
+# bounded_probe_run -> spawn_server, kill_process_tree -> deadline; the
+# remaining edges are migrate_all_homes' provider/profile/install decisions.
+# backup is the update transaction's pre-build step, not a build dependency.
+ "hermes_cli/local_runtime/processes.py",
+ "agent/deadline.py",
+ "agent/memory_provider.py",
+ "hermes_cli/plugins_cmd_install.py",
+ "hermes_cli/plugins_cmd.py",
+ "pm/plugins_state.py",
+ "pm/install.py",
+ "hermes_cli/backup.py",
+])
+def test_second_hop_update_change_dispatches_real_update_consumers(path):
+ lanes = _real_classifier([path])
+ for lane in ("e2e_upgrade", "e2e_desktop_update"):
+ assert lanes[lane], f"{path}: classifier leaves {lane} off"
+ run = _ci_run(lanes)
+ for lane in ("e2e_upgrade", "e2e_desktop_update"):
+ assert all(_consumers_reached(run, lane).values()), f"{path}: {lane} never reaches its consumers"