Multi-tier framework for evaluating AI agent skills and plugins with quality gates, security scanning, harness compatibility checks, semantic overlap detection, synthetic evaluation dataset generation, and live agent evaluation that measures how skills affect agent behavior. Ships reusable CI templates that bring every check to any repository.
Python agent-evaluationagent-pluginsagent-securityagent-skillsagentic-aibenchmarkci-templatesclaude-codecodexevaluateevaluationharnesspluginplugin-evaluationsecurity-scannerskill-evalskill-evaluationskill-evaluatorskill-gap-analysisskills
fix(ci): skip paid LLM Tier 1, Tier 2 and Tier 3 jobs when no skill changed (#468)
Narendran Raghavan8b76f2a1f808
diff --git a/.github/workflows/evaluate-all-tiers.yml b/.github/workflows/evaluate-all-tiers.ymlindex 2998f5e7..0e7ef890 100644--- a/.github/workflows/evaluate-all-tiers.yml+++ b/.github/workflows/evaluate-all-tiers.yml@@ -128,9 +128,9 @@ jobs:min-score: ${{ inputs.min-score }}security-baselines: ${{ inputs.security-baselines }}scan-mode: ${{ needs.eligibility.outputs.scan-mode || inputs.scan-mode }}- # Keep an unconditional keyless baseline. Eligible opt-in runs use the- # protected enriched job's canonical evidence for the required gate.- artifact-name: ${{ inputs.tier1-llm && needs.eligibility.outputs.allowed == 'true' && 'skill-evaluator-tier1-baseline' || 'skill-evaluator-tier1' }}+ # Keep an unconditional keyless baseline. Eligible opt-in runs that change+ # a skill use the protected enriched job's canonical evidence for the gate.+ artifact-name: ${{ inputs.tier1-llm && needs.eligibility.outputs.allowed == 'true' && needs.eligibility.outputs.skills-changed == 'true' && 'skill-evaluator-tier1-baseline' || 'skill-evaluator-tier1' }}llm: falseeligibility:runs-on: ubuntu-24.04@@ -140,6 +140,7 @@ jobs:outputs:allowed: ${{ steps.check.outputs.allowed }}scan-mode: ${{ steps.check.outputs.scan-mode }}+ skills-changed: ${{ steps.check.outputs.skills-changed }}steps:- name: Check immutable configuration and current same-repository PR headid: check@@ -150,9 +151,11 @@ jobs:ENV_MODE: ${{ inputs.env-mode }}TIERS: ${{ inputs.tiers }}SCAN_MODE: ${{ inputs.scan-mode }}+ SKILL_PATHS: ${{ inputs.paths }}run: |python3 -I - <<'PY'import json, os, re, urllib.parse, urllib.request+ from pathlib import PurePosixPathif not re.fullmatch(r'[0-9a-f]{40}', os.environ['TOOLS_REF']):raise SystemExit('tools-ref must be a reviewed immutable 40-character commit')if os.environ['ENV_MODE'] not in ('docker', 'local'):@@ -175,26 +178,39 @@ jobs:actor_allowed = permission.get('permission') in ('write', 'maintain', 'admin')allowed = Falsescan_mode = os.environ['SCAN_MODE']+ roots = [PurePosixPath(line.strip()) for line in os.environ.get('SKILL_PATHS', '').splitlines() if line.strip()]+ # The paid jobs (LLM Tier 1, Tier 2 and Tier 3) need a changed file+ # under a skill root, unless the caller asked for full scans.+ # Setup-only changes keep the keyless scan of every skill as the gate.+ # Pushes, manual runs and fork PRs (never listed) stay true.+ skills_changed = Trueif pr and pr['head']['repo'] and pr['head']['repo']['full_name'] == repo:+ skills_changed = scan_mode == 'all'url = os.environ['API_URL'] + '/repos/' + repo + '/pulls/' + str(pr['number'])request = urllib.request.Request(url, headers={'Authorization':'Bearer '+os.environ['GH_TOKEN'], 'Accept':'application/vnd.github+json'})with urllib.request.urlopen(request, timeout=30) as response:current = json.load(response)allowed = actor_allowed and current['state'] == 'open' and current['head']['sha'] == pr['head']['sha'] and current['head']['repo'] and current['head']['repo']['full_name'] == repo- # A setup/configuration PR must exercise every selected skill. This- # predicate equals select_changed_skills.setup_changed (tests check it).+ # A setup/configuration PR must exercise every selected skill. These+ # predicates equal select_changed_skills.setup_changed and+ # skill_root_changed (tests check them).+ setup = Falsefor page in range(1, 31):files_url = url + '/files?per_page=100&page=' + str(page)request = urllib.request.Request(files_url, headers={'Authorization':'Bearer '+os.environ['GH_TOKEN'], 'Accept':'application/vnd.github+json'})with urllib.request.urlopen(request, timeout=30) as response:files = json.load(response)- if any(path.startswith(('.github/', '.gitlab/', '.skillevaluator/ci')) or path == '.gitlab-ci.yml' for item in files for path in (item['filename'], item.get('previous_filename', ''))):- scan_mode = 'all'- break- if len(files) < 100:+ paths = [path for item in files for path in (item['filename'], item.get('previous_filename', '')) if path]+ if any(path.startswith(('.github/', '.gitlab/', '.skillevaluator/ci')) or path == '.gitlab-ci.yml' for path in paths):+ setup = True+ if any(PurePosixPath(path).is_relative_to(root) for path in paths for root in roots):+ skills_changed = True+ if (setup and skills_changed) or len(files) < 100:breakelse:- scan_mode = 'all' # Bounded discovery cannot certify a partial list.+ setup = skills_changed = True # Bounded discovery cannot certify a partial list.+ if setup:+ scan_mode = 'all'elif not pr and os.environ['GITHUB_EVENT_NAME'] in ('push', 'workflow_dispatch'):repository = read_api('')default = repository.get('default_branch')@@ -204,11 +220,15 @@ jobs:with open(os.environ['GITHUB_OUTPUT'], 'a') as output:output.write('allowed=' + str(allowed).lower() + '\n')output.write('scan-mode=' + scan_mode + '\n')+ output.write('skills-changed=' + str(skills_changed).lower() + '\n')print('Provider jobs eligible' if allowed else 'Provider jobs withheld; Tier 1 remains available')+ if allowed and not skills_changed:+ print('No changed skill: the LLM Tier 1, Tier 2 and Tier 3 jobs are skipped; the keyless Tier 1 scan is the gate')PYpaid-tiers:needs: eligibility- if: ${{ needs.eligibility.outputs.allowed == 'true' }}+ # A PR that changes no skill skips the paid tiers; the aggregate records them as skipped.+ if: ${{ needs.eligibility.outputs.allowed == 'true' && needs.eligibility.outputs.skills-changed == 'true' }}runs-on: ${{ inputs.runner }}environment: ${{ inputs.environment }}permissions:@@ -347,7 +367,7 @@ jobs:retention-days: 14tier1-llm:needs: eligibility- if: ${{ inputs.tier1-llm && needs.eligibility.outputs.allowed == 'true' && contains(format(',{0},', inputs.tiers), ',1,') }}+ if: ${{ inputs.tier1-llm && needs.eligibility.outputs.allowed == 'true' && needs.eligibility.outputs.skills-changed == 'true' && contains(format(',{0},', inputs.tiers), ',1,') }}# Match the keyless image job even when native Tier 3 uses a local runner.runs-on: ubuntu-24.04environment: ${{ inputs.environment }}@@ -409,7 +429,7 @@ jobs:if-no-files-found: warnretention-days: 14aggregate:- needs: [tier1, tier1-llm, paid-tiers]+ needs: [eligibility, tier1, tier1-llm, paid-tiers]if: ${{ always() }}runs-on: ubuntu-24.04permissions:@@ -418,6 +438,8 @@ jobs:id-token: writeenv:SKILLEVALUATOR_TOOLS_REF: ${{ inputs.tools-ref }}+ # Only an exact "false" records missing Tier 2/3 evidence as skipped.+ SKILL_EVAL_SKILLS_CHANGED: ${{ needs.eligibility.outputs.skills-changed }}DIFF_BASE_SHA: ${{ github.event.pull_request.base.sha }}REPORT_COMMIT: ${{ github.event.pull_request.head.sha || github.sha }}REPORT_REPOSITORY: ${{ github.repository }}diff --git a/.github/workflows/skill-checks-all-tiers.yml b/.github/workflows/skill-checks-all-tiers.ymlindex da786a5a..b18d38d5 100644--- a/.github/workflows/skill-checks-all-tiers.yml+++ b/.github/workflows/skill-checks-all-tiers.yml@@ -21,7 +21,7 @@ permissions:actions: readjobs:skills:- uses: NVIDIA/SkillEvaluator/.github/workflows/evaluate-all-tiers.yml@e56ced7f72904e055b04a5024c688d7603d5b49a+ uses: NVIDIA/SkillEvaluator/.github/workflows/evaluate-all-tiers.yml@80ef7b626128a4f54e35d24bc4b73eedf637e559with:tiers: 1,2,3paths: skills@@ -35,7 +35,7 @@ jobs:agents: codex,claude-coderunner: ubuntu-24.04tools-repository: NVIDIA/SkillEvaluator- tools-ref: e56ced7f72904e055b04a5024c688d7603d5b49a+ tools-ref: 80ef7b626128a4f54e35d24bc4b73eedf637e559image: ghcr.io/nvidia/skillevaluator-tier1@sha256:9d5483243918937be4f2178f74cf7c622a531dee41e3176906994d52fa14950an-attempts: 1n-concurrent: 1diff --git a/.github/workflows/skill-feedback-all-tiers.yml b/.github/workflows/skill-feedback-all-tiers.ymlindex 4d970614..46a49af3 100644--- a/.github/workflows/skill-feedback-all-tiers.yml+++ b/.github/workflows/skill-feedback-all-tiers.yml@@ -12,20 +12,20 @@ permissions:pull-requests: writejobs:feedback:- uses: NVIDIA/SkillEvaluator/.github/workflows/feedback-all-tiers.yml@e56ced7f72904e055b04a5024c688d7603d5b49a+ uses: NVIDIA/SkillEvaluator/.github/workflows/feedback-all-tiers.yml@80ef7b626128a4f54e35d24bc4b73eedf637e559with:tools-repository: NVIDIA/SkillEvaluator- tools-ref: e56ced7f72904e055b04a5024c688d7603d5b49a- trusted-workflow-ref: NVIDIA/SkillEvaluator/.github/workflows/evaluate-all-tiers.yml@e56ced7f72904e055b04a5024c688d7603d5b49a- trusted-caller-blobs: da786a5ab65cda8b4a2b9cbbb7c76db49e28f077+ tools-ref: 80ef7b626128a4f54e35d24bc4b73eedf637e559+ trusted-workflow-ref: NVIDIA/SkillEvaluator/.github/workflows/evaluate-all-tiers.yml@80ef7b626128a4f54e35d24bc4b73eedf637e559+ trusted-caller-blobs: b18d38d5c488fe9bc4f042371206dde11606f347benchmarks:- uses: NVIDIA/SkillEvaluator/.github/workflows/publish-benchmarks.yml@e56ced7f72904e055b04a5024c688d7603d5b49a+ uses: NVIDIA/SkillEvaluator/.github/workflows/publish-benchmarks.yml@80ef7b626128a4f54e35d24bc4b73eedf637e559permissions:contents: writeactions: readpull-requests: writewith:tools-repository: NVIDIA/SkillEvaluator- tools-ref: e56ced7f72904e055b04a5024c688d7603d5b49a- trusted-workflow-ref: NVIDIA/SkillEvaluator/.github/workflows/evaluate-all-tiers.yml@e56ced7f72904e055b04a5024c688d7603d5b49a- trusted-caller-blobs: da786a5ab65cda8b4a2b9cbbb7c76db49e28f077+ tools-ref: 80ef7b626128a4f54e35d24bc4b73eedf637e559+ trusted-workflow-ref: NVIDIA/SkillEvaluator/.github/workflows/evaluate-all-tiers.yml@80ef7b626128a4f54e35d24bc4b73eedf637e559+ trusted-caller-blobs: b18d38d5c488fe9bc4f042371206dde11606f347diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 6347d0c2..8af24142 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -30,7 +30,13 @@ All notable changes to SkillEvaluator are documented in this file.Tier 1 required-check and unscanned-content scope for publication decisions.The repository's own candidate CI selects Build for Tier 1/2 and separategateway-backed Claude Code/Codex models for Tier 3, without changing upstream- provider defaults.+ provider defaults. With the default `scan-mode: auto`, a merge request or+ same-repository pull request that changes no file under a configured skill+ root skips the paid jobs (LLM-enriched Tier 1, Tier 2 and Tier 3): the keyless+ scan remains the Tier 1 gate and reports list Tier 2 and Tier 3 as skipped.+ GitHub fork PRs never run the paid tiers and keep their existing Tier 2/3+ reason. The enriched scan applies reviewed security baselines like the keyless+ scan.- HTML, Markdown, and terminal findings show recorded LLM verification verdicts,confidence, and reasoning, with an explanation of retained or downgraded severity.diff --git a/ci/gitlab/all-tiers.yml b/ci/gitlab/all-tiers.ymlindex dbf92d92..dbdab87b 100644--- a/ci/gitlab/all-tiers.yml+++ b/ci/gitlab/all-tiers.yml@@ -202,6 +202,12 @@ skill-evaluation-native:*",$SKILL_EVAL_TIER,"*) ;;*) echo "Tier $SKILL_EVAL_TIER is not selected"; exit 0 ;;esac+ # A merge request that changes no skill skips this paid tier; the+ # aggregate recomputes the same decision and records it as skipped.+ if [ "$(python -I "$SKILL_EVAL_TOOLS_DIR/ci/select_changed_skills.py" --skills-changed --workspace "$CI_PROJECT_DIR")" = false ]; then+ echo "No file under a configured skill root changed; Tier $SKILL_EVAL_TIER did not run."+ exit 0+ fipython -I "$SKILL_EVAL_TOOLS_DIR/ci/eligible_gitlab.py"unset SKILLEVALUATOR_GITLAB_READ_TOKENif [ "$SKILL_EVAL_TIER" = 3 ]; then@@ -351,6 +357,16 @@ skill-evaluation-aggregate:env -i PATH="$PATH" python -I -m uv --no-config --cache-dir "$SKILL_EVAL_TOOLS_DIR/.uv-cache" sync --locked --no-dev --project "$SKILL_EVAL_TOOLS_DIR" --python 3.12 --default-index https://pypi.org/simpleexport PATH="$SKILL_EVAL_TOOLS_DIR/.venv/bin:$PATH"mkdir -p skill-evaluator-results/tier1+ # Recompute the paid jobs' no-skill-change skip with the pinned tools;+ # never trust an artifact or checkout file for this decision.+ skills_changed=true+ if [ "${CI_PIPELINE_SOURCE:-}" = merge_request_event ]; then+ if ! skills_changed="$(python -I "$SKILL_EVAL_TOOLS_DIR/ci/select_changed_skills.py" --skills-changed --workspace "$CI_PROJECT_DIR")"; then+ skills_changed=unknown+ fi+ fi+ # Only an exact "false" records missing Tier 2/3 evidence as skipped.+ export SKILL_EVAL_SKILLS_CHANGED="$skills_changed"enriched=falseif [ "$SKILL_EVAL_TIER1_LLM" = true ]; thenif [ "${CI_PIPELINE_SOURCE:-}" = merge_request_event ] && [ "${CI_MERGE_REQUEST_SOURCE_PROJECT_ID:-}" = "$CI_PROJECT_ID" ]; then@@ -362,6 +378,15 @@ skill-evaluation-aggregate:esacfifi+ if [ "$enriched" = true ] && [ "$skills_changed" = unknown ]; then+ echo 'Could not determine whether a skill changed; enriched Tier 1 evidence stays required.' >&2+ exit 1+ fi+ if [ "$enriched" = true ] && [ "$skills_changed" = false ]; then+ # The enriched job skipped its paid scan; the keyless scan (every+ # skill for a setup change) is the Tier 1 gate.+ enriched=false+ fiif [ "$enriched" = true ]; then# Missing authenticated evidence must fail the required gate instead of# silently substituting a successful static-only scan.diff --git a/ci/run_tier1_image.py b/ci/run_tier1_image.pyindex e984dda6..d6410937 100644--- a/ci/run_tier1_image.py+++ b/ci/run_tier1_image.py@@ -23,10 +23,17 @@ if not __package__:try:from model_config import PROVIDER_KEYS, model_environment- from select_changed_skills import _git, _paths, setup_changed, skill_roots+ from select_changed_skills import _git, changed_paths, pull_request, setup_changed, skill_root_changed, skill_rootsexcept ModuleNotFoundError:from ci.model_config import PROVIDER_KEYS, model_environment- from ci.select_changed_skills import _git, _paths, setup_changed, skill_roots+ from ci.select_changed_skills import (+ _git,+ changed_paths,+ pull_request,+ setup_changed,+ skill_root_changed,+ skill_roots,+ )IMAGE = re.compile(r"ghcr\.io/nvidia/skillevaluator-tier1@sha256:[0-9a-f]{64}")SHA = re.compile(r"(?:[0-9a-f]{40}|[0-9a-f]{64})")@@ -47,6 +54,10 @@ CONTEXT = frozenset(HOST_ENV = frozenset({"PATH", "LANG", "LC_ALL", "LC_CTYPE", "SYSTEMROOT"})+class NoSkillChanges(Exception):+ """An automatic PR/MR scan changed no file under a configured skill root."""++def _paths_safe(workspace: Path, reports: Path) -> tuple[Path, Path]:for path in (workspace, reports):if any(ord(c) < 32 or ord(c) == 127 or c == "," for c in str(path)):@@ -80,17 +91,13 @@ def _environment(workspace: Path, image: str, source: dict[str, str]) -> dict[stmode = source.get("SKILL_EVAL_SCAN_MODE", "auto")if mode not in {"auto", "all"}:raise ValueError- pull_request = (- source.get("GITHUB_EVENT_NAME") in {"pull_request", "pull_request_target"}- or source.get("CI_PIPELINE_SOURCE") == "merge_request_event"- or bool(source.get("DIFF_BASE_SHA"))- )- mode = "changed" if mode == "auto" and pull_request else "all"+ mode = "changed" if mode == "auto" and pull_request(source) else "all"if mode == "changed":- base = source.get("DIFF_BASE_SHA", "")- if not SHA.fullmatch(base):- raise ValueError- changed = _paths(_git(workspace, "diff", "--name-only", "-z", "--no-renames", f"{base}...{head}", "--"))+ changed = changed_paths(workspace, source, head)+ # The paid LLM pass needs a changed skill (select_changed_skills.skills_changed).+ # A setup-only change keeps the keyless scan of every skill as the gate.+ if not skill_root_changed(changed, configured):+ raise NoSkillChangesif setup_changed(changed):mode = "all"requested_provider = source.get("SKILL_EVAL_TIER1_PROVIDER") or source.get("SKILL_EVAL_PROVIDER") or "openai"@@ -147,7 +154,14 @@ def main(argv: list[str] | None = None) -> int:raise ValueErrorworkspace, reports = _paths_safe(args.workspace, args.reports)source = dict(os.environ)- child = _environment(workspace, args.image, source)+ try:+ child = _environment(workspace, args.image, source)+ except NoSkillChanges:+ print(+ "No changed file is under a configured skill root, so the LLM-enriched Tier 1 scan was skipped. "+ "The keyless Tier 1 scan remains the gate."+ )+ return 0reports.mkdir(parents=True, exist_ok=True)host = {name: value for name, value in source.items() if name in HOST_ENV}host.setdefault("PATH", os.defpath)diff --git a/ci/run_tiers.py b/ci/run_tiers.pyindex cf53b463..4e6f6dc6 100644--- a/ci/run_tiers.py+++ b/ci/run_tiers.py@@ -107,7 +107,7 @@ def select_skills(workspace: Path, env: dict) -> tuple[list[Path], dict]:raise ConfigurationError("The evaluated commit must match the checkout HEAD.")if base and mode == "auto":selected, selection = select_changed_skills(workspace, roots, base, head)- # Tier 1 applies the same setup predicate, so every tier selects the same skills.+ # Tier 1 applies the same setup predicate, so every tier that runs selects the same skills.changed = _paths(_git(workspace, "diff", "--name-only", "-z", "--no-renames", f"{base}...{head}", "--"))if not setup_changed(changed):return selected, selection@@ -739,6 +739,16 @@ def aggregate(reports: Path, tiers: tuple[int, ...], env: dict) -> int:_keep_selected(row, selection.get("selected") if isinstance(selection, dict) else None)if tier in recorded:row["source_attempt"] = recorded[tier]+ elif not required and env.get("SKILL_EVAL_SKILLS_CHANGED") == "false":+ # The trusted workflow decided no skill changed, so this paid+ # advisory tier did not run. That is a skip, not a failed job.+ row = {+ "tier": tier,+ "required": False,+ "status": "skipped",+ "skills": [],+ "reason": "No file under a configured skill root changed; this paid tier did not run.",+ }else:row = {"tier": tier,diff --git a/ci/select_changed_skills.py b/ci/select_changed_skills.pyindex 469a472d..3637df29 100644--- a/ci/select_changed_skills.py+++ b/ci/select_changed_skills.py@@ -10,11 +10,14 @@ is an error; removing the entire skill is recorded as a deletion, not a pass.from __future__ import annotations+import argparseimport osimport reimport selectorsimport subprocess+import sysimport time+from collections.abc import Mappingfrom pathlib import Path, PurePosixPathMAX_GIT_BYTES = 16 * 1024 * 1024@@ -25,10 +28,11 @@ MAX_ROOTS = 100MAX_ROOTS_TEXT = 16384GIT_TIMEOUT = 30_SHA = re.compile(r"(?:[0-9a-fA-F]{40}|[0-9a-fA-F]{64})")-# A pull request that changes CI setup evaluates every skill in every tier, so-# the setup change is exercised. run_tiers uses this predicate directly; the-# GitHub eligibility script and the GitLab Tier 1 job keep inline copies that-# tests hold equal to these values.+# A pull request that changes CI setup evaluates every skill in every tier that+# runs, so the setup change is exercised. Tier 2/3 and the LLM Tier 1 pass run+# only when a skill-root file also changed (skill_root_changed). run_tiers uses+# this predicate directly; the GitHub eligibility script and the GitLab Tier 1+# job keep inline copies that tests hold equal to these values.SETUP_PREFIXES = (".github/", ".gitlab/", ".skillevaluator/ci")SETUP_FILES = frozenset({".gitlab-ci.yml"})@@ -38,6 +42,16 @@ def setup_changed(paths: list[str]) -> bool:return any(path.startswith(SETUP_PREFIXES) or path in SETUP_FILES for path in paths)+def skill_root_changed(paths: list[str], roots: list[str]) -> bool:+ """Return whether any changed path (both sides of a rename) is inside a skill root.++ The paid jobs (LLM-enriched Tier 1, Tier 2 and Tier 3) run on a pull or+ merge request only for such changes. The GitHub eligibility script keeps an+ inline copy that tests hold equal to this one.+ """+ return any(PurePosixPath(path).is_relative_to(root) for path in paths if path for root in roots)++class SelectionError(ValueError):"""A selection cannot be established from the supplied checkout."""@@ -277,3 +291,78 @@ def select_changed_skills(workspace: Path, roots: str, base: str, head: str) ->if len(selected) > MAX_SELECTED_SKILLS:raise SelectionError("The CI integration supports at most 100 selected skills per run.", selection=selection)return [workspace / directory for directory in selected], selection+++_COMMIT = re.compile(r"(?:[0-9a-f]{40}|[0-9a-f]{64})")+++def pull_request(environ: Mapping[str, str]) -> bool:+ """Return whether the CI event evaluates a pull or merge request diff."""+ return (+ environ.get("GITHUB_EVENT_NAME") in {"pull_request", "pull_request_target"}+ or environ.get("CI_PIPELINE_SOURCE") == "merge_request_event"+ or bool(environ.get("DIFF_BASE_SHA"))+ )+++def changed_paths(workspace: Path, environ: Mapping[str, str], head: str) -> list[str]:+ """Return both sides of every path changed from the DIFF_BASE_SHA merge base to head."""+ base = environ.get("DIFF_BASE_SHA", "")+ if not _COMMIT.fullmatch(base) or not _COMMIT.fullmatch(head):+ raise SelectionError("Changed paths require exact base and head commits.")+ # A committed .gitmodules "ignore" setting must not hide a changed gitlink+ # under a skill root and so skip the paid jobs.+ return _paths(+ _git(+ workspace,+ "diff",+ "--name-only",+ "-z",+ "--no-renames",+ "--ignore-submodules=none",+ f"{base}...{head}",+ "--",+ )+ )+++def skills_changed(workspace: Path, environ: Mapping[str, str]) -> bool:+ """Return False only when a pull or merge request changes no file under a skill root.++ The paid jobs then skip and the keyless Tier 1 scan is the gate. Each CI+ consumer recomputes this from the checkout with the pinned tools; none+ trusts an artifact or a file in the checkout.+ """+ head = environ.get("REPORT_COMMIT") or environ.get("DIFF_HEAD_SHA", "")+ if not _COMMIT.fullmatch(head):+ raise SelectionError("The evaluated commit must be exact.")+ mode = environ.get("SKILL_EVAL_SCAN_MODE", "auto")+ if mode not in {"auto", "changed", "all"}:+ raise SelectionError("SKILL_EVAL_SCAN_MODE must be auto, changed or all.")+ if mode == "all" or not pull_request(environ):+ return True+ roots = skill_roots(workspace, environ.get("SKILL_EVAL_PATHS", "skills"))+ return skill_root_changed(changed_paths(workspace, environ, head), roots)+++def main(argv: list[str] | None = None) -> int:+ """Print ``true`` when the paid jobs must run, or ``false`` when no skill changed."""+ parser = argparse.ArgumentParser(description=main.__doc__)+ parser.add_argument("--skills-changed", action="store_true", help="the only supported query")+ parser.add_argument("--workspace", required=True, type=Path)+ args = parser.parse_args(argv)+ if not args.skills_changed:+ parser.error("--skills-changed is required")+ try:+ workspace = args.workspace.resolve(strict=True)+ if not workspace.is_dir():+ raise SelectionError("The workspace must be a directory.")+ print("true" if skills_changed(workspace, os.environ) else "false") # noqa: T201+ except (OSError, ValueError):+ print("Could not determine whether a skill changed.", file=sys.stderr) # noqa: T201+ return 2+ return 0+++if __name__ == "__main__":+ raise SystemExit(main())diff --git a/ci/templates/all-tiers/README.md b/ci/templates/all-tiers/README.mdindex 8b749d61..981b16b9 100644--- a/ci/templates/all-tiers/README.md+++ b/ci/templates/all-tiers/README.md@@ -285,6 +285,12 @@ prerequisites remain visible in the reports. A passing Tier 1 gate is not anall-tier evaluation pass. Forks retain keyless Tier 1 checks. On PRs, ordinary software changesselect no skills, skill changes select the affected skills, and CI configurationchanges select the collection. Pushes to `main` and manual runs scan the collection.+With `scan-mode: auto`, the paid jobs (LLM-enriched Tier 1, Tier 2 and Tier 3)+run on a PR only when it changes a file under a configured skill root. A+same-repository configuration-only PR runs the keyless Tier 1 scan of every+skill, and its report lists Tier 2 and Tier 3 as skipped because no skill+changed. Fork PRs never run the paid tiers, so their reports keep the existing+Tier 2 and Tier 3 reason.If a provider returns HTTP 404, verify that the selected model accepts chatrequests with your account. Presence in the public model catalog alone does not@@ -363,6 +369,11 @@ with LLM security, SkillSpector semantic findings, verification and rubricchecks. An unconditional keyless baseline remains available for forks anddenied admission. For an authorized LLM run, missing or failed enriched evidencefails the required Tier 1 gate; it is never replaced with a passing static scan.+With the default `scan-mode: auto`, a PR runs the enriched job only when it+changes a file under a configured skill root. CI configuration or unrelated+changes skip it, and the keyless scan, which covers every skill for a setup+change, remains the Tier 1 gate. Pushes to the default branch, manual runs and+`scan-mode: all` keep the enriched job.The image supports OpenAI, Anthropic and NVIDIA Build at their native endpoints.Tier 2 chat/embeddings can use one provider while Tier 3 uses an@@ -478,7 +489,11 @@ enriched evidence determines the Tier 1 gate for an eligible run; missingevidence cannot fall back to a passing static baseline. Default-branch enrichmentis limited to `push` and `web` pipelines, matching provider admission. Scheduled,API, trigger and downstream default-branch pipelines retain the keyless Tier 1-baseline, as do forks.+baseline, as do forks. With `SKILL_EVAL_SCAN_MODE: auto`, an MR that changes no+file under a configured skill root skips the paid jobs (enriched Tier 1, Tier 2+and Tier 3) before reading a provider key. The aggregate recomputes that decision+from the checkout with the pinned tools, never from an artifact. It then keeps+the keyless report as the Tier 1 gate and records Tier 2 and Tier 3 as skipped.Use `SKILL_EVAL_TIER3_PROVIDER`, `SKILL_EVAL_TIER3_BASE_URL` and`SKILL_EVAL_TIER3_MODEL` for a separate live-agent/judge route, and@@ -678,11 +693,15 @@ configuration-only scope notices are excluded. Incomplete or missing evidenceshows an unknown count; it cannot imply zero findings or a completed check.The Tier 1 gate and each advisory tier's status stay separate, so this examplecan pass the required CI gate while still needing review of Tier 2 and Tier 3.-Every tier selects the same skills: the changed skills, or every skill when-the pull request changes CI setup under `.github/`, `.gitlab/`,+Every tier that runs selects the same skills: the changed skills, or every+skill when the pull request changes CI setup under `.github/`, `.gitlab/`,`.skillevaluator/ci` or `.gitlab-ci.yml` (on GitHub, also when it changes morefiles than the API can list). A cell for a skill that its tier did not select-reads `Skipped · issues unknown · Not selected for this tier`.+reads `Skipped · issues unknown · Not selected for this tier`. With+`scan-mode: auto`, a merge request or same-repository pull request that changes+no file under a configured skill root skips Tier 2 and Tier 3. Only Tier 1 then+scans, covering every skill for a setup change, and the Tier 2 and Tier 3 cells read+`Skipped · issues unknown · No file under a configured skill root changed; this paid tier did not run.````textci-results.jsondiff --git a/src/skillevaluator/ci-release-all-tiers.json b/src/skillevaluator/ci-release-all-tiers.jsonindex c7d26ef7..8ce6edd3 100644--- a/src/skillevaluator/ci-release-all-tiers.json+++ b/src/skillevaluator/ci-release-all-tiers.json@@ -1,6 +1,6 @@{"repository": "NVIDIA/SkillEvaluator",- "workflow_ref": "e56ced7f72904e055b04a5024c688d7603d5b49a",+ "workflow_ref": "80ef7b626128a4f54e35d24bc4b73eedf637e559","publisher_ref": "8096c6966a498f35f6f7dc1a596d1cc4da85cf11","image": "ghcr.io/nvidia/skillevaluator-tier1@sha256:9d5483243918937be4f2178f74cf7c622a531dee41e3176906994d52fa14950a","schema_version": 2,@@ -10,9 +10,9 @@"ci-model-routing-v1","ci-benchmark-pr-v1"],- "feedback_ref": "e56ced7f72904e055b04a5024c688d7603d5b49a",- "gitlab_ref": "e56ced7f72904e055b04a5024c688d7603d5b49a",- "tools_ref": "e56ced7f72904e055b04a5024c688d7603d5b49a",+ "feedback_ref": "80ef7b626128a4f54e35d24bc4b73eedf637e559",+ "gitlab_ref": "80ef7b626128a4f54e35d24bc4b73eedf637e559",+ "tools_ref": "80ef7b626128a4f54e35d24bc4b73eedf637e559","report_contract": "skillevaluator-ci-v1","evaluator_version": "0.8.0","runtime_lock_sha256": "4b22e964d4aa2e78c5a6a73fe2f1ee979e72090aac85b6558e91d885e72cd966"diff --git a/tests/ci/test_all_tier_workflows.py b/tests/ci/test_all_tier_workflows.pyindex 74e1c3fc..855a479f 100644--- a/tests/ci/test_all_tier_workflows.py+++ b/tests/ci/test_all_tier_workflows.py@@ -45,7 +45,8 @@ def test_aggregate_retains_every_tier_after_failure():workflow = load(".github/workflows/evaluate-all-tiers.yml")aggregate = workflow["jobs"]["aggregate"]assert aggregate["if"] == "${{ always() }}"- assert set(aggregate["needs"]) == {"tier1", "tier1-llm", "paid-tiers"}+ # Eligibility tells the aggregate when the paid tiers were skipped for no skill change.+ assert set(aggregate["needs"]) == {"eligibility", "tier1", "tier1-llm", "paid-tiers"}downloads = [s for s in aggregate["steps"] if s.get("uses", "").startswith("actions/download-artifact@")]assert [s["with"]["pattern"] for s in downloads] == ["skill-evaluator-tier[123]-attempt-*"]assert downloads[0]["with"]["path"] == "${{ runner.temp }}/skill-artifacts"diff --git a/tests/ci/test_gateway_benchmark_workflows.py b/tests/ci/test_gateway_benchmark_workflows.pyindex 838065ac..881c8252 100644--- a/tests/ci/test_gateway_benchmark_workflows.py+++ b/tests/ci/test_gateway_benchmark_workflows.py@@ -211,3 +211,132 @@ def test_gitlab_enriched_tier1_rejects_noncanonical_baseline_opt_in(tmp_path):result, evidence = _run_gitlab_enriched(tmp_path, {"SKILL_EVAL_SECURITY_BASELINES": "TRUE"})assert result.returncode != 0assert evidence is None+++def _aggregate_tier1_source(tmp_path, env, *, recomputed, marker=True):+ """Run the aggregate's Tier 1 selection with a stubbed pinned-tools decision."""+ import os++ document = yaml.safe_load((ROOT / "ci/gitlab/all-tiers.yml").read_text())+ script = "\n".join(document["skill-evaluation-aggregate"]["script"])+ selection = script[script.index("skills_changed=true") : script.index("if [ -d skill-evaluator-native ]")]+ (tmp_path / "skill-evaluator-report").mkdir()+ (tmp_path / "skill-evaluator-report" / "source.txt").write_text("keyless")+ enriched = tmp_path / "skill-evaluator-enriched-tier1"+ enriched.mkdir()+ (enriched / "source.txt").write_text("enriched")+ if marker: # A committed or forged file must never decide the gate.+ (enriched / "enriched-tier1-skipped.json").write_text('{"status": "skipped"}')+ (tmp_path / "skill-evaluator-results" / "tier1").mkdir(parents=True)+ bin_dir = tmp_path / "bin"+ bin_dir.mkdir()+ calls = tmp_path / "calls.txt"+ stub = bin_dir / "python"+ stub.write_text(f"#!/bin/sh\nprintf '%s\\n' \"$*\" >> {calls}\n" + recomputed + "\n")+ stub.chmod(0o755)+ result = subprocess.run(+ ["sh", "-c", "set -eu\n" + selection + 'printf %s "$SKILL_EVAL_SKILLS_CHANGED" > exported.txt\n'],+ cwd=tmp_path,+ env={+ "PATH": f"{bin_dir}{os.pathsep}/usr/bin:/bin",+ "SKILL_EVAL_TOOLS_DIR": "/pinned/tools",+ "CI_PROJECT_DIR": str(tmp_path),+ **env,+ },+ capture_output=True,+ text=True,+ check=False,+ )+ copied = tmp_path / "skill-evaluator-results" / "tier1" / "source.txt"+ invoked = calls.read_text().splitlines() if calls.exists() else []+ exported = tmp_path / "exported.txt"+ _aggregate_tier1_source.exported = exported.read_text() if exported.exists() else None+ return result.returncode, copied.read_text() if copied.exists() else None, invoked+++MR = {+ "SKILL_EVAL_TIER1_LLM": "true",+ "CI_PIPELINE_SOURCE": "merge_request_event",+ "CI_PROJECT_ID": "42",+ "CI_MERGE_REQUEST_SOURCE_PROJECT_ID": "42",+ "CI_DEFAULT_BRANCH": "main",+}++[email protected](("recomputed", "expected"), [("echo false", "keyless"), ("echo true", "enriched")])+def test_gitlab_aggregate_recomputes_the_skill_change_skip(tmp_path, recomputed, expected):+ """No skill change keeps the keyless gate; a marker file alone never does."""+ code, source, invoked = _aggregate_tier1_source(tmp_path, MR, recomputed=recomputed)+ assert code == 0+ assert source == expected+ assert invoked == [f"-I /pinned/tools/ci/select_changed_skills.py --skills-changed --workspace {tmp_path}"]+++def test_gitlab_aggregate_fails_closed_when_the_skip_cannot_be_recomputed(tmp_path):+ code, source, _ = _aggregate_tier1_source(tmp_path, MR, recomputed="exit 2")+ assert code != 0+ assert source is None+++def test_gitlab_default_branch_aggregate_never_skips_enriched_evidence(tmp_path):+ env = {+ "SKILL_EVAL_TIER1_LLM": "true",+ "CI_PIPELINE_SOURCE": "push",+ "CI_COMMIT_BRANCH": "main",+ "CI_DEFAULT_BRANCH": "main",+ "CI_COMMIT_REF_PROTECTED": "true",+ "CI_PROJECT_ID": "42",+ }+ code, source, invoked = _aggregate_tier1_source(tmp_path, env, recomputed="echo false")+ assert (code, source, invoked) == (0, "enriched", [])+++ ("recomputed", "exported"), [("echo false", "false"), ("echo true", "true"), ("exit 2", "unknown")]+)+def test_gitlab_aggregate_exports_the_paid_tier_decision(tmp_path, recomputed, exported):+ """Without enriched Tier 1, an unknown answer only keeps Tier 2/3 reported as incomplete."""+ env = {**MR, "SKILL_EVAL_TIER1_LLM": "false"}+ code, source, _ = _aggregate_tier1_source(tmp_path, env, recomputed=recomputed)+ assert (code, source) == (0, "keyless")+ assert _aggregate_tier1_source.exported == exported+++def _run_native_tier(tmp_path, recomputed):+ import os++ document = yaml.safe_load((ROOT / "ci/gitlab/all-tiers.yml").read_text())+ script = "\n".join(document["skill-evaluation-native"]["script"])+ bin_dir = tmp_path / "bin"+ bin_dir.mkdir()+ calls = tmp_path / "calls.txt"+ (bin_dir / "python").write_text(+ "#!/bin/sh\n"+ f"printf '%s\\n' \"$*\" >> {calls}\n"+ 'case "$2" in */select_changed_skills.py) ' + recomputed + " ;; esac\n"+ "exit 3\n" # Stop at admission, before any installation or provider work.+ )+ (bin_dir / "python").chmod(0o755)+ env = {+ "PATH": f"{bin_dir}{os.pathsep}/usr/bin:/bin",+ "SKILL_EVAL_TIERS": "1,2,3",+ "SKILL_EVAL_TIER": "3",+ "SKILL_EVAL_TOOLS_DIR": "/pinned/tools",+ "CI_PROJECT_DIR": str(tmp_path),+ }+ result = subprocess.run(["sh", "-c", script], env=env, capture_output=True, text=True, check=False)+ return result, calls.read_text().splitlines()+++def test_gitlab_paid_tier_skips_before_admission_when_no_skill_changed(tmp_path):+ result, calls = _run_native_tier(tmp_path, "echo false; exit 0")+ assert result.returncode == 0+ assert "Tier 3 did not run" in result.stdout+ assert calls == [f"-I /pinned/tools/ci/select_changed_skills.py --skills-changed --workspace {tmp_path}"]++[email protected]("recomputed", ["echo true; exit 0", "exit 2"])+def test_gitlab_paid_tier_runs_when_a_skill_changed_or_the_answer_is_unknown(tmp_path, recomputed):+ result, calls = _run_native_tier(tmp_path, recomputed)+ assert result.returncode == 3 # Reached admission: the tier was not skipped.+ assert calls[-1].endswith("ci/eligible_gitlab.py")diff --git a/tests/ci/test_github_admission_workflow.py b/tests/ci/test_github_admission_workflow.pyindex c02a9838..d09fb5b2 100644--- a/tests/ci/test_github_admission_workflow.py+++ b/tests/ci/test_github_admission_workflow.py@@ -141,3 +141,155 @@ def test_app_bot_needs_the_same_api_proven_write_role(tmp_path, monkeypatch, staallowed, requested = run_admission(tmp_path, monkeypatch, stage, actor="my-app[bot]")assert allowedassert any("/collaborators/my-app%5Bbot%5D/permission" in url for url in requested)+++def _eligibility_outputs(tmp_path, monkeypatch, files, *, scan_mode="auto", paths="skills"):+ """Run the actual eligibility script for an eligible same-repository PR."""+ workflow = yaml.load((ROOT / ".github/workflows/evaluate-all-tiers.yml").read_text(), Loader=yaml.BaseLoader)+ shell = workflow["jobs"]["eligibility"]["steps"][0]["run"]+ event_path = tmp_path / "event.json"+ event_path.write_text(+ json.dumps({"pull_request": {"number": 7, "head": {"sha": SHA, "repo": {"full_name": "acme/skills"}}}})+ )+ output = tmp_path / "outputs"+ for key, value in {+ "TOOLS_REF": SHA,+ "ENV_MODE": "docker",+ "TIERS": "1,2,3",+ "SCAN_MODE": scan_mode,+ "SKILL_PATHS": paths,+ "GH_TOKEN": "read-only-token",+ "API_URL": "https://api.github.example",+ "GITHUB_REPOSITORY": "acme/skills",+ "GITHUB_ACTOR": "alice",+ "GITHUB_EVENT_PATH": str(event_path),+ "GITHUB_OUTPUT": str(output),+ "GITHUB_REF": "refs/pull/7/merge",+ "GITHUB_SHA": SHA,+ "GITHUB_EVENT_NAME": "pull_request",+ }.items():+ monkeypatch.setenv(key, value)+ pages = [files[index : index + 100] for index in range(0, max(len(files), 1), 100)] or [[]]++ def respond(request, **_kwargs):+ url = request.full_url+ if url.endswith("/permission"):+ payload = {"permission": "write"}+ elif url.endswith("/pulls/7"):+ payload = {"state": "open", "head": {"sha": SHA, "repo": {"full_name": "acme/skills"}}}+ elif "/pulls/7/files?" in url:+ page = int(urllib.parse.parse_qs(urllib.parse.urlsplit(url).query)["page"][0])+ payload = pages[page - 1] if page <= len(pages) else []+ else:+ raise AssertionError(f"Unexpected API request {url}")+ return io.BytesIO(json.dumps(payload).encode())++ monkeypatch.setattr(urllib.request, "urlopen", respond)+ exec(compile("\n".join(shell.splitlines()[1:-1]), "<workflow eligibility>", "exec"), {})+ return dict(line.split("=", 1) for line in output.read_text().splitlines())+++ ("changed", "skills_changed", "scan_mode"),+ [+ ([{"filename": "skills/alpha/SKILL.md"}], "true", "auto"),+ ([{"filename": "docs/readme.md"}], "false", "auto"),+ ([{"filename": ".github/workflows/skill-checks-all-tiers.yml"}], "false", "all"),+ ([{"filename": ".github/workflows/ci.yml"}, {"filename": "skills/alpha/run.py"}], "true", "all"),+ ([{"filename": "docs/alpha.md", "previous_filename": "skills/alpha/notes.md"}], "true", "auto"),+ ([{"filename": "skills-archive/alpha/SKILL.md"}], "false", "auto"),+ ],+)+def test_eligibility_reports_whether_a_pr_changes_a_skill(tmp_path, monkeypatch, changed, skills_changed, scan_mode):+ """Setup-only and unrelated PRs skip the paid LLM Tier 1 pass; the keyless scan stays."""+ outputs = _eligibility_outputs(tmp_path, monkeypatch, changed)+ assert outputs["allowed"] == "true"+ assert outputs["skills-changed"] == skills_changed+ assert outputs["scan-mode"] == scan_mode+++def test_eligibility_skill_predicate_matches_the_shared_helper(tmp_path, monkeypatch):+ from ci.select_changed_skills import skill_root_changed++ roots = "skills\nplugins/tools/"+ cases = [+ ["skills/a/SKILL.md"],+ ["plugins/tools/x/SKILL.md"],+ ["plugins/toolsmith/SKILL.md"],+ ["plugins/README.md"],+ ["skills"],+ ["README.md", ".gitlab-ci.yml"],+ ]+ normalized = ["skills", "plugins/tools"]+ for index, case in enumerate(cases):+ directory = tmp_path / str(index)+ directory.mkdir()+ outputs = _eligibility_outputs(directory, monkeypatch, [{"filename": path} for path in case], paths=roots)+ assert (outputs["skills-changed"] == "true") is skill_root_changed(case, normalized), case+++def test_explicit_full_scans_and_long_listings_keep_the_enriched_pass(tmp_path, monkeypatch):+ outputs = _eligibility_outputs(tmp_path, monkeypatch, [{"filename": "docs/readme.md"}], scan_mode="all")+ assert outputs["skills-changed"] == "true"+ many = [{"filename": f"docs/{index}.md"} for index in range(3000)]+ long_listing = tmp_path / "long"+ long_listing.mkdir()+ outputs = _eligibility_outputs(long_listing, monkeypatch, many)+ assert outputs["skills-changed"] == "true" # A truncated listing cannot prove no skill changed.+ assert outputs["scan-mode"] == "all"+++def test_enriched_job_and_gate_artifact_share_the_skill_change_condition():+ workflow = yaml.load((ROOT / ".github/workflows/evaluate-all-tiers.yml").read_text(), Loader=yaml.BaseLoader)+ jobs = workflow["jobs"]+ condition = "needs.eligibility.outputs.skills-changed == 'true'"+ assert jobs["eligibility"]["outputs"]["skills-changed"] == "${{ steps.check.outputs.skills-changed }}"+ assert condition in jobs["tier1-llm"]["if"]+ assert condition in jobs["tier1"]["with"]["artifact-name"]+ assert jobs["eligibility"]["steps"][0]["env"]["SKILL_PATHS"] == "${{ inputs.paths }}"+++def test_paid_tiers_share_the_skill_change_condition_and_aggregate_reason():+ workflow = yaml.load((ROOT / ".github/workflows/evaluate-all-tiers.yml").read_text(), Loader=yaml.BaseLoader)+ jobs = workflow["jobs"]+ condition = "needs.eligibility.outputs.skills-changed == 'true'"+ assert condition in jobs["paid-tiers"]["if"]+ assert "needs.eligibility.outputs.allowed == 'true'" in jobs["paid-tiers"]["if"]+ assert "eligibility" in jobs["aggregate"]["needs"]+ assert jobs["aggregate"]["env"]["SKILL_EVAL_SKILLS_CHANGED"] == "${{ needs.eligibility.outputs.skills-changed }}"+++def test_fork_prs_never_claim_that_no_skill_changed(tmp_path, monkeypatch):+ """Fork file lists are not read, so their skipped paid tiers keep the withheld-job reason."""+ workflow = yaml.load((ROOT / ".github/workflows/evaluate-all-tiers.yml").read_text(), Loader=yaml.BaseLoader)+ shell = workflow["jobs"]["eligibility"]["steps"][0]["run"]+ event_path = tmp_path / "event.json"+ event_path.write_text(+ json.dumps({"pull_request": {"number": 7, "head": {"sha": SHA, "repo": {"full_name": "outsider/fork"}}}})+ )+ output = tmp_path / "outputs"+ for key, value in {+ "TOOLS_REF": SHA,+ "ENV_MODE": "docker",+ "TIERS": "1,2,3",+ "SCAN_MODE": "auto",+ "SKILL_PATHS": "skills",+ "GH_TOKEN": "read-only-token",+ "API_URL": "https://api.github.example",+ "GITHUB_REPOSITORY": "acme/skills",+ "GITHUB_ACTOR": "alice",+ "GITHUB_EVENT_PATH": str(event_path),+ "GITHUB_OUTPUT": str(output),+ "GITHUB_EVENT_NAME": "pull_request",+ }.items():+ monkeypatch.setenv(key, value)++ def respond(request, **_kwargs):+ if request.full_url.endswith("/permission"):+ return io.BytesIO(json.dumps({"permission": "write"}).encode())+ raise AssertionError(f"Fork PR eligibility must not list files: {request.full_url}")++ monkeypatch.setattr(urllib.request, "urlopen", respond)+ exec(compile("\n".join(shell.splitlines()[1:-1]), "<workflow eligibility>", "exec"), {})+ outputs = dict(line.split("=", 1) for line in output.read_text().splitlines())+ assert outputs == {"allowed": "false", "scan-mode": "auto", "skills-changed": "true"}diff --git a/tests/ci/test_gitlab_enriched_admission.py b/tests/ci/test_gitlab_enriched_admission.pyindex b4dfbc05..0dad95bb 100644--- a/tests/ci/test_gitlab_enriched_admission.py+++ b/tests/ci/test_gitlab_enriched_admission.py@@ -70,7 +70,41 @@ def job_enabled(job, env):return result.returncode == 0+def mr_checkout(workspace, env, *, skill_change=True):+ """Give an MR route the real checkout and pinned tools its skip check reads."""+ import sys++ git = ["git", "-C", str(workspace), "-c", "user.name=CI", "-c", "[email protected]"]+ subprocess.run([*git, "init", "-q"], check=True)+ (workspace / "skills" / "alpha").mkdir(parents=True)+ (workspace / "skills" / "alpha" / "SKILL.md").write_text("# alpha\n")+ subprocess.run([*git, "add", "skills"], check=True)+ subprocess.run([*git, "commit", "-qm", "base"], check=True)+ base = subprocess.check_output([*git, "rev-parse", "HEAD"], text=True).strip()+ changed = workspace / ("skills/alpha/SKILL.md" if skill_change else ".gitlab-ci.yml")+ changed.write_text("# changed\n")+ subprocess.run([*git, "add", "--", str(changed.relative_to(workspace))], check=True)+ subprocess.run([*git, "commit", "-qm", "head"], check=True)+ head = subprocess.check_output([*git, "rev-parse", "HEAD"], text=True).strip()+ bin_dir = workspace.parent / f"{workspace.name}-bin"+ bin_dir.mkdir()+ (bin_dir / "python").write_text(f'#!/bin/sh\nexec "{sys.executable}" "$@"\n')+ (bin_dir / "python").chmod(0o755)+ env.update(+ PATH=f"{bin_dir}{os.pathsep}{env['PATH']}",+ SKILL_EVAL_TOOLS_DIR=str(ROOT),+ CI_PROJECT_DIR=str(workspace),+ DIFF_BASE_SHA=base,+ DIFF_HEAD_SHA=head,+ REPORT_COMMIT=head,+ SKILL_EVAL_PATHS="skills",+ SKILL_EVAL_SCAN_MODE="auto",+ )++def route_evidence(config, env, workspace):+ if env.get("CI_PIPELINE_SOURCE") == "merge_request_event" and "SKILL_EVAL_TOOLS_DIR" not in env:+ mr_checkout(workspace, env)script = "\n".join(config["skill-evaluation-aggregate"]["script"])routing = script[script.index("mkdir -p skill-evaluator-results/tier1") :]routing, separator, _ = routing.partition('python -I "$SKILL_EVAL_TOOLS_DIR/ci/run_tiers.py" aggregate')@@ -119,3 +153,27 @@ def test_eligible_enriched_run_never_substitutes_keyless_evidence(config, tmp_paroute_evidence(config, env, tmp_path)assert list((tmp_path / "skill-evaluator-results/tier1").iterdir()) == []++[email protected](("skill_change", "expected"), [(True, "enriched"), (False, "keyless")])+def test_same_project_mr_routes_by_recomputed_skill_change(config, tmp_path, skill_change, expected):+ """The real pinned-tools check, not an artifact, decides whether the paid scan was skipped."""+ env = {+ "PATH": os.environ["PATH"],+ "CI_PIPELINE_SOURCE": "merge_request_event",+ "CI_PROJECT_ID": "42",+ "CI_MERGE_REQUEST_SOURCE_PROJECT_ID": "42",+ "CI_DEFAULT_BRANCH": "main",+ "SKILL_EVAL_TIER1_LLM": "true",+ }+ mr_checkout(tmp_path, env, skill_change=skill_change)+ (tmp_path / "skill-evaluator-report").mkdir()+ (tmp_path / "skill-evaluator-report" / "evidence.txt").write_text("keyless")+ (tmp_path / "skill-evaluator-enriched-tier1").mkdir()+ (tmp_path / "skill-evaluator-enriched-tier1" / "evidence.txt").write_text("enriched")+ # A forged skip marker must not change the decision.+ (tmp_path / "skill-evaluator-enriched-tier1" / "enriched-tier1-skipped.json").write_text("{}")++ route_evidence(config, env, tmp_path)++ assert (tmp_path / "skill-evaluator-results/tier1/evidence.txt").read_text() == expecteddiff --git a/tests/ci/test_run_tier1_image.py b/tests/ci/test_run_tier1_image.pyindex a416a019..2575e846 100644--- a/tests/ci/test_run_tier1_image.py+++ b/tests/ci/test_run_tier1_image.py@@ -300,3 +300,79 @@ def test_invalid_baseline_opt_in_fails_before_credential_launch(launch, baselineassert not callsoutput = capsys.readouterr()assert "secret" not in output.err + output.out+++def _setup_only_change(env, workspace, git):+ base = env["REPORT_COMMIT"]+ (workspace / ".github").mkdir()+ (workspace / ".github" / "config.yml").write_text("changed")+ (workspace / "README.md").write_text("changed")+ git("add", ".")+ git("commit", "-qm", "setup only")+ head = git("rev-parse", "HEAD")+ env.update(DIFF_BASE_SHA=base, REPORT_COMMIT=head, DIFF_HEAD_SHA=head)+++ "event", [{"GITHUB_EVENT_NAME": "pull_request"}, {"CI_PIPELINE_SOURCE": "merge_request_event"}]+)+def test_pr_without_a_skill_change_skips_before_credentials(launch, event, capsys):+ """Setup-only or unrelated changes leave the keyless scan as the gate."""+ runner, args, calls, env, workspace, reports, git = launch+ _setup_only_change(env, workspace, git)+ del env["ANTHROPIC_API_KEY"] # A skip never needs, reads or exposes a key.+ env.update(event)+ assert runner.main(args) == 0+ assert not calls+ assert not reports.exists() # No evidence or marker that could be mistaken for a result.+ assert "keyless Tier 1 scan remains the gate" in capsys.readouterr().out+++def test_explicit_full_scan_does_not_skip_without_a_skill_change(launch):+ runner, args, calls, env, workspace, _, git = launch+ _setup_only_change(env, workspace, git)+ env.update(GITHUB_EVENT_NAME="pull_request", SKILL_EVAL_SCAN_MODE="all")+ assert runner.main(args) == 0+ assert calls[-1][1]["env"]["SCAN_MODE"] == "all"+++def test_skills_changed_cli_matches_the_launcher_decision(launch, capsys):+ """The GitLab aggregate and paid tiers recompute the skip with this exact command."""+ _, _, calls, env, workspace, _, git = launch+ selector = importlib.import_module("ci.select_changed_skills")+ cli = ["--skills-changed", "--workspace", str(workspace)]+ assert selector.main(cli) == 0+ assert capsys.readouterr().out == "true\n" # Default-branch and manual runs keep the enriched scan.+ _setup_only_change(env, workspace, git)+ env["CI_PIPELINE_SOURCE"] = "merge_request_event"+ assert selector.main(cli) == 0+ assert capsys.readouterr().out == "false\n"+ env["SKILL_EVAL_SCAN_MODE"] = "all"+ assert selector.main(cli) == 0+ assert capsys.readouterr().out == "true\n"+ del env["SKILL_EVAL_SCAN_MODE"]+ (workspace / "skills" / "SKILL.md").write_text("changed again")+ git("commit", "-qam", "skill")+ env.update(REPORT_COMMIT=git("rev-parse", "HEAD"), DIFF_HEAD_SHA=git("rev-parse", "HEAD"))+ assert selector.main(cli) == 0+ assert capsys.readouterr().out == "true\n"+ env["DIFF_BASE_SHA"] = "not-a-commit"+ assert selector.main(cli) == 2+ assert not calls+++def test_committed_submodule_ignore_cannot_hide_a_skill_change(launch, capsys):+ """A gitlink update under a skill root still needs the enriched scan."""+ _, _, _, env, workspace, _, git = launch+ selector = importlib.import_module("ci.select_changed_skills")+ base = env["REPORT_COMMIT"]+ (workspace / ".gitmodules").write_text(+ '[submodule "vendor"]\n\tpath = skills/vendor\n\turl = ./vendor\n\tignore = all\n'+ )+ git("add", ".gitmodules")+ git("update-index", "--add", "--cacheinfo", f"160000,{'b' * 40},skills/vendor")+ git("commit", "-qm", "vendor skill")+ head = git("rev-parse", "HEAD")+ env.update(CI_PIPELINE_SOURCE="merge_request_event", DIFF_BASE_SHA=base, REPORT_COMMIT=head, DIFF_HEAD_SHA=head)+ assert selector.main(["--skills-changed", "--workspace", str(workspace)]) == 0+ assert capsys.readouterr().out == "true\n"diff --git a/tests/ci/test_run_tiers.py b/tests/ci/test_run_tiers.pyindex 92d80db6..031bd402 100644--- a/tests/ci/test_run_tiers.py+++ b/tests/ci/test_run_tiers.py@@ -907,3 +907,39 @@ def test_tier_diagnostics_budget_is_shared_by_every_skill(consumer, tmp_path, moassert not (second / "command.log").exists()index = json.loads((second / "index.json").read_text())assert index["omitted"] == [{"path": "command.log", "reason": "tier_limit"}]+++ ("skills_changed", "advisory"), [("false", "skipped"), ("true", "incomplete"), (None, "incomplete")]+)+def test_paid_tiers_skipped_for_no_skill_change_are_reported_as_skipped(consumer, tmp_path, skills_changed, advisory):+ """Only the trusted "false" turns missing Tier 2/3 evidence into a skip; Tier 1 stays required."""+ from ci.run_tier1 import _summary++ env = env_for(consumer)+ if skills_changed is not None:+ env["SKILL_EVAL_SKILLS_CHANGED"] = skills_changed+ reports = tmp_path / "reports"+ (reports / "tier1").mkdir(parents=True)+ legacy = _summary([], None)+ legacy.update(overall_status="skipped", execution={"commit": env["REPORT_COMMIT"]})+ _, legacy["selection"] = run_tiers.select_changed_skills(+ consumer, "skills", env["REPORT_COMMIT"], env["REPORT_COMMIT"]+ )+ (reports / "tier1/summary.json").write_text(json.dumps(legacy))+ assert run_tiers.aggregate(reports, (1, 2, 3), env) == 0+ rows = {row["tier"]: row for row in json.loads((reports / "ci-results.json").read_text())["tiers"]}+ assert rows[2]["status"] == rows[3]["status"] == advisory+ if advisory == "skipped":+ assert "No file under a configured skill root changed" in rows[3]["reason"]+ assert rows[1]["required"] is True+++def test_no_skill_change_never_excuses_missing_tier1_evidence(consumer, tmp_path):+ env = env_for(consumer, SKILL_EVAL_SKILLS_CHANGED="false")+ reports = tmp_path / "reports"+ reports.mkdir()+ assert run_tiers.aggregate(reports, (1, 2), env) == 1+ rows = {row["tier"]: row for row in json.loads((reports / "ci-results.json").read_text())["tiers"]}+ assert rows[1]["status"] == "incomplete"+ assert rows[2]["status"] == "skipped"