Repository navigation
Move CI priority scoring to the scheduler / 将 CI 优先级打分移至调度器 - #5085
Conversation
- Setup jobs label queued jobs `ci-job-<token>` and upload `scheduling-facts.json`, which records each token's classifier-credited facts. - Delete the priority weights and scorer. The priority scheduler scores jobs from the uploaded facts. - Build the classifier's criteria from the master configs in the checkout under test. - Drop the `p<score> |` prefix from job names.
|
Generally most InferenceX submissions don't need to add changes to the infx package. On the off chance they do, generally the diff is small. Please prompt your agent to clean your PR to keep your diff to only necessary & minimal changes too. We have an increased code quality bar for changes to the infx package. 中文大多数 InferenceX 提交通常不需要修改 infx 包。即使确实需要,改动通常也很小。请让你的 agent 清理 PR,使改动只包含必要且最小的内容。infx 包的改动有更高的代码质量要求。 |
| measured = { | ||
| key: value for key, value in entry.items() if key not in ("priority", "queue-token") | ||
| } | ||
| measured = {key: value for key, value in entry.items() if key != "queue-token"} |
There was a problem hiding this comment.
🔴 Klaud sessions that verify a final sweep set up before this merge will crash instead of validating it. That sweep's manifest still has a priority key on every matrix entry. check_matrix now strips only queue-token, and the strict matrix schemas (extra="forbid") reject priority with a pydantic ValidationError. The lifecycle handler catches only VerificationError, so that error escapes it. Fix: keep dropping both legacy queue fields before validation, e.g. key not in ("priority", "queue-token"), so manifests from either label format verify.
Why this was flagged
run-sweep.yml:837-852 writes needs.setup.outputs.search-space-config verbatim into the klaud-sweep-manifest artifact as 'matrix': matrix. Setup jobs that ran before this merge (old ci_priority) put priority and queue-token on every job. After the merge, a resumed or later Klaud session reaches lifecycle.py:173 verify_sweep -> validation.py:451 check_coverage -> validation.py:325 check_matrix for that run. At validation.py:251 only queue-token is removed. schema.validate_python(measured) then fails because SingleNodeMatrixEntry and the other matrix entry classes in infx/matrix/validation.py:148/252/307/358 set extra="forbid". On the base branch, line 251 filtered out ("priority", "queue-token"), so the same manifest verified. The raised pydantic ValidationError is not a VerificationError. lifecycle.py:1503-1506 catches only ListingUnavailable and VerificationError, and lifecycle.py:471/521 catch nothing, so the reconcile or publish step aborts.
Verification: The diff changes validation.py:251 from key not in ("priority", "queue-token") to key != "queue-token". All matrix entry classes have model_config = ConfigDict(extra="forbid") (infx/matrix/validation.py:149, 253, 308, 359), so a leftover priority key raises a pydantic ValidationError. lifecycle.py:1502-1511 catches only ListingUnavailable and VerificationError.
| _BENCHMARK_JOB = re.compile( | ||
| r"(?:^|/ )(?:klaud \| )?p[0-9.]+ \| (?P<model_prefix>\S+) (?P<precision>\S+) (?P<runner>\S+)" | ||
| r"(?:^|/ )(?!.* / )(?:klaud \| )?(?P<model_prefix>\S+) (?P<precision>\S+) (?P<runner>\S+)" | ||
| r" .* c(?P<conc>[0-9]+(?:x[0-9]+)*)(?: \| (?P<eval>eval|eval-only))?$" | ||
| ) |
There was a problem hiding this comment.
🟡 (optional) Full re-runs of sweeps started before this merge would record failed jobs under the wrong model, precision and runner. The new _BENCHMARK_JOB no longer knows the p<score> | prefix that those runs still put in job names. A name like p5.000 | dsr1 fp8 cluster:h200-dgxc sgl TP8 c4 still matches. It parses as model_prefix p5.000, precision | and runner dsr1. Fix: accept an optional (?:p[0-9.]+ \| )? after the klaud prefix, so names with and without a score both parse to the right fields.
Why this was flagged
The trigger is a full re-run of a run-sweep or e2e-tests run started before merge. Its workflow file still renders names as p<score> | <model> <precision> <runner> ..., and the PR says such reruns are still supported. On a full re-run, setup's "Resolve workflow tooling" step resolves the default-branch SHA again. collect-job-events.yml then checks out that tooling-ref and runs the new collect_events. At collect_events.py:28 the regex no longer expects the score prefix. (?P<model_prefix>\S+) captures p5.000, (?P<precision>\S+) captures | and (?P<runner>\S+) captures the real model prefix. The match still succeeds, so collect_events.py:140-141 write NoLauncherRecord events with garbage model_prefix, precision and runner. On the base branch the old regex parsed those same names correctly. The regex was also loosened from a fixed p<score> | anchor. Any job name in the run with three tokens and a trailing c<N> is now treated as a benchmark.
Verification: Trigger: collect_events runs from the new default-branch tooling while the run's job names still come from a pre-merge workflow file. On p5.000 | dsr1 fp8 cluster:h200-dgxc sgl TP8 c4 the regex at collect_events.py:27-30 still matches, with model_prefix=p5.000, precision=| and runner=dsr1. The base regex required p[0-9.]+ \| and parsed these names correctly, so this is a regression.
| # Read criteria from the checkout under test, so models it adds join the enum. | ||
| catalog_root="" | ||
| for root in "$GITHUB_WORKSPACE/inferencex-e2e" "$GITHUB_WORKSPACE" "$E2E_ROOT"; do | ||
| if [ -f "$root/configs/amd-master.yaml" ] && [ -f "$root/configs/nvidia-master.yaml" ]; then | ||
| catalog_root="$root" | ||
| break | ||
| fi | ||
| done | ||
| if [ -z "$catalog_root" ]; then | ||
| echo "::error::no checkout holds configs/amd-master.yaml and configs/nvidia-master.yaml" >&2 | ||
| exit 1 | ||
| fi |
There was a problem hiding this comment.
🟡 (optional) If the checkout under test lacks the master configs, the criteria enum is quietly built from the action's own repo instead of failing. AGENTS.md's no-fallback rule forbids this. The new catalog_root loop tries $GITHUB_WORKSPACE/inferencex-e2e, then $GITHUB_WORKSPACE, then $E2E_ROOT, and takes the first match. Fix: resolve one explicit root and fail with the existing ::error:: when its configs are missing. Have each caller pass it as an action input; run-sweep, e2e-tests and profile all check out inferencex-e2e/ at the workspace root.
Why this was flagged
The classify-priority step (action.yml:77-88) searches three candidate roots in turn and uses the first one that holds both master configs. The added comment says criteria come "from the checkout under test". The third candidate is $E2E_ROOT, the action's own repo. So when the workspace checkout has no configs, the step silently builds the enum from a different revision instead of failing. AGENTS.md:45-46 says receivers must not choose defaults and forbids "if unset, assign" logic. A missing input must fail clearly. All three callers check out the ref under test at the workspace root: run-sweep.yml:227, e2e-tests.yml:263 and profile.yml:82. The first candidate is therefore always the right one, and the other two branches only hide a misconfigured checkout. On the base, the action read a single fixed path ($E2E_ROOT/configs/ci-priority.yaml) and had no search order.
Verification: nit. Trigger: the workspace checkout has no configs/amd-master.yaml and configs/nvidia-master.yaml. In that case the action quietly falls back to the action's own repo. The first root that matches wins in action.yml:78-83 and nothing is logged. The ::error:: at line 85 only fires when all three candidates miss. Nothing regresses against the base.
| def test_catalog_covers_the_master_configs(): | ||
| criteria = supported_criteria(repository_root()) | ||
|
|
||
| assert {"multi-node", "agentic", "eval-only", "checklist-complete", "patchwork"} <= criteria | ||
| assert {"dsr1", "mtp", "fp4", "sglang", "dynamo-vllm"} <= criteria |
There was a problem hiding this comment.
🟡 (optional) This new test fails on any master-config edit that renames or drops dsr1, mtp, fp4, sglang or dynamo-vllm, even though supported_criteria still works. It reads the checked-in configs via repository_root() and pins values in them. CONTRIBUTING's test rules say tests that pin checked-in config must be deleted. Fix: delete test_catalog_covers_the_master_configs. test_catalog_reads_values_nested_anywhere already runs supported_criteria against a tmp-path fixture root.
Why this was flagged
test_catalog_covers_the_master_configs (test_scheduler_facts.py:199-203) calls supported_criteria(repository_root()). That parses the real configs/amd-master.yaml and configs/nvidia-master.yaml listed in MASTER_CONFIGS (infx/config.py:7). It then asserts that specific catalog values are present. The repo's test-quality rules (AGENTS.md defers to CONTRIBUTING.md) require deleting any test that pins checked-in config or duplicates a branch another test covers. The fixture test at line 206 already covers the same code path on synthetic input. As a result, a future config PR that retires dsr1 or renames a framework fails CI even though the code is correct. The base had no test that read the master configs here.
Verification: nit. The test breaks whenever a master-config edit removes any of the pinned values, even if supported_criteria still works. test_scheduler_facts.py:199-203 calls supported_criteria(repository_root()), which reads the real checked-in master configs. CONTRIBUTING.md:247 lists as delete-on-sight: "Pins checked-in config or data." The test is new in this PR.
| def test_list_criteria_reads_the_given_root(monkeypatch, capsys, root): | ||
| assert run_cli(monkeypatch, capsys, None, "--list-criteria", "--root", str(root)) == sorted( | ||
| supported_criteria(root) | ||
| ) |
There was a problem hiding this comment.
🟡 nit (optional): This test passes even if --list-criteria returns the wrong values. It builds its expected result from the function under test, sorted(supported_criteria(root)), so a catalog bug changes both sides together. CONTRIBUTING.md:248 bans tests that compute the expected value with the helper being checked. Fix: assert against the literal sorted list the root fixture defines, or delete the test if lines 206-210 are enough.
Why this was flagged
The CLI path at scheduler_facts.py:217-219 prints sorted(supported_criteria(args.root or repository_root())). The test at test_scheduler_facts.py:272-275 compares that output with sorted(supported_criteria(root)). Both sides use the same helper, so the test only checks that --root is forwarded. AGENTS.md:62 and CONTRIBUTING.md:248 classify this as tautological, and such tests must be removed or rewritten.
Verification: In test_scheduler_facts.py:272-275, test_list_criteria_reads_the_given_root asserts run_cli(..., "--list-criteria", "--root", str(root)) == sorted(supported_criteria(root)). Both sides call supported_criteria, so a catalog bug changes both together. The test only checks that --root is forwarded and that the output is sorted JSON.
| def test_queue_tokens_match_the_previous_implementation(): | ||
| """Tokens pinned from the scorer this module replaced, so runner labels keep their identity.""" |
There was a problem hiding this comment.
🟡 nit (optional): The docstring and test name describe history ("the scorer this module replaced", "previous_implementation"), which AGENTS.md forbids in comments. Fix: rename the test after the contract, for example test_queue_tokens_are_pinned_for_runner_labels, and make the docstring say why the values must stay stable, without naming the old module.
Why this was flagged
test_scheduler_facts.py:80-81 defines test_queue_tokens_match_the_previous_implementation with the docstring "Tokens pinned from the scorer this module replaced, so runner labels keep their identity." The repo's comment rules forbid history comments that describe what the code replaced or how it evolved. Once ci_priority.py is deleted, readers get no technical reason from "the scorer this module replaced". The real contract is token stability for ci-job-<token> labels across reruns, and the comment should say that.
Verification: nit: nothing breaks at runtime. The defect is in the new test at inferencex-e2e/infx/tests/workflows/test_scheduler_facts.py lines 80-81. AGENTS.md line 57 says: "No history: how code evolved, what it replaced, where it came from, or past results." The docstring describes "the scorer this module replaced", and the test name says "previous_implementation".
# Conflicts: # .github/workflows/collectivex-sweep.yml # .github/workflows/operatorx-sweep.yml # .github/workflows/speedbench-al.yml # inferencex-e2e/configs/ci-priority.yaml # inferencex-e2e/infx/tests/workflows/test_ci_priority.py # inferencex-e2e/infx/tests/workflows/test_e2e_matrix_generation.py # inferencex-e2e/infx/workflows/ci_priority.py
- Klaud matrix verification and point identity ignore the `priority` key that sweeps set up before this change still carry. - Job-event collection accepts the `p<score> | ` prefix that reruns of those sweeps still put in job names.
CI priority scoring moved to the scheduler (#5085): drop this branch's ci-priority.yaml change and keep main's scheduling facts in the sweep workflow, alongside the official-testlist ingest check. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Summary
CI priority weights and scoring move out of this repository. The classifier and matrix generation still describe each job, but the priority scheduler now does the ranking.
ci-job-<queue-token>(no score) and upload an unarchivedscheduling-facts.jsonartifact. It maps every token to the facts the old scorer used, after the same classifier projection: framework, model prefix, precision, speculative decoding, agentic, eval-only, multi-node and node count. It also records run-level event, patchwork and checklist-complete.inferencex-e2e/configs/ci-priority.yamland the scorer are deleted.infx.workflows.ci_prioritybecomesinfx.workflows.scheduler_facts, which adds queue tokens (unchanged values) and merges facts across the setup step's calls.p<score> |prefix. Theklaud |prefix is unchanged.collect_eventsparses the leaf job name without the prefix.e2e-tests,run-sweep, both benchmark templates,profile,collectivex-sweep,operatorx-sweepandspeedbench-al. OperatorX shards now get their queue tokens from the same tool.Rollout. #5121 already uploads
scheduling-facts.jsonalongside the score labels. The scheduler already accepts score-freeci-job-<token>labels and scores them from those facts. Its weights must matchmain's current policy before this merges. Reruns of runs started before this PR keep their old score labels, and the scheduler still honours those.After merge, weights change in the scheduler. This PR deletes
inferencex-e2e/configs/ci-priority.yaml. Later priority changes go to the scheduler's configuration, not this repository.Not yet exercised. Facts uploads are confirmed on a real
mainrun, and their scores match the labels. No run has produced score-free labels yet. Before merging, dispatch onee2e-tests.ymlrun from this branch and confirm its jobs are scored from facts and start.Validation details
A throwaway workflow (run) checked the artifact mechanics this PR relies on. An
archive: falseupload is served as raw JSON fromGET /repos/{owner}/{repo}/actions/artifacts/{id}/zip. Re-running failed jobs keeps attempt 1's artifact visible to the run. A full re-run withoverwrite: truereplaces it with the new attempt's tokens.AI model disclosure
PR checklist and change type
Type of Change
Checklist
python -m infx.matrix.changed --base origin/mainlists affected config keys, I have appended one new entry covering them to the physical end ofinferencex-e2e/perf-changelog.yaml; if it lists none, I have added none. I have not edited historical entriesinferencex-e2e/perf-changelog.yamlentry, it carries exactly one primary sweep label (a maintainer applies it on fork PRs):full-sweep-fail-fast(recommended),full-sweep-enabled, ornon-canary-full-sweep-enabled. Optional modifiersall-evals,evals-only, andagentx-fastrequire a primary label; the last two block reuse while applied./use <run_id>(or the legacy/reuse-sweep-run) on this PR. Do this only once there is a final full sweep that is all green with evals passing, since after this comment the primary sweep label will no longer automatically kick off new sweeps. Remove and re-add the primary sweep label to force a new sweep.中文
CI 优先级权重与打分逻辑移出本仓库。分类器与矩阵生成仍负责描述每个任务,排序改由优先级调度器完成。
ci-job-<queue-token>标签(不再包含分数),并上传未压缩的scheduling-facts.jsonartifact,按 token 记录分类器投影后的事实:框架、模型前缀、精度、投机解码、agentic、eval-only、多节点与节点数,以及运行级别的事件、patchwork 与 checklist 完成情况。inferencex-e2e/configs/ci-priority.yaml与打分代码。infx.workflows.ci_priority改为infx.workflows.scheduler_facts,负责添加 queue token(值不变)并合并同一步骤多次调用的事实。p<score> |前缀,klaud |前缀保持不变;collect_events相应调整解析。上线顺序: #5121 已在分数标签之外上传
scheduling-facts.json;调度器已支持不带分数的ci-job-<token>标签并依据事实打分,合并前需确认其权重与main当前策略一致。本 PR 之前启动的运行在重跑时保留旧标签,调度器仍按旧分数处理。合并后在调度器中调整权重: 本 PR 删除
inferencex-e2e/configs/ci-priority.yaml,此后的优先级调整需在调度器配置中进行。尚未验证: 已在
main的实际运行中确认事实文件上传且分数与标签一致;但尚无运行产生不带分数的标签。合并前请从本分支手动触发一次e2e-tests.yml,确认任务按事实打分并能启动。AI 模型说明:设计、审阅与 PR 由 anthropic/claude-opus-5-5(运行时报告)完成;工作流与 Python 改动由委派的 worker agent 编写,其确切模型无法核实。