Skip to content

Move CI priority scoring to the scheduler / 将 CI 优先级打分移至调度器 - #5085

Merged
adibarra merged 3 commits into
mainfrom
feat/scheduler-facts
Nov 18, 2026
Merged

adibarra merged 3 commits into
mainfrom
feat/scheduler-facts

Conversation

@adibarra

@adibarra adibarra commented Nov 15, 2026 •

Copy link
Copy Markdown
Collaborator

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.

  • Setup jobs label each scheduled job ci-job-<queue-token> (no score) and upload an unarchived scheduling-facts.json artifact. 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.yaml and the scorer are deleted. infx.workflows.ci_priority becomes infx.workflows.scheduler_facts, which adds queue tokens (unchanged values) and merges facts across the setup step's calls.
  • The classifier's criteria enum comes from the master configs in the checkout under test, not from the weights file. A PR that adds a model prefix can be credited for it. An unknown criterion credits nothing instead of failing setup.
  • Job names drop the p<score> | prefix. The klaud | prefix is unchanged. collect_events parses the leaf job name without the prefix.
  • Updated for the new labels and the facts upload: e2e-tests, run-sweep, both benchmark templates, profile, collectivex-sweep, operatorx-sweep and speedbench-al. OperatorX shards now get their queue tokens from the same tool.

Rollout. #5121 already uploads scheduling-facts.json alongside the score labels. The scheduler already accepts score-free ci-job-<token> labels and scores them from those facts. Its weights must match main'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 main run, and their scores match the labels. No run has produced score-free labels yet. Before merging, dispatch one e2e-tests.yml run 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: false upload is served as raw JSON from GET /repos/{owner}/{repo}/actions/artifacts/{id}/zip. Re-running failed jobs keeps attempt 1's artifact visible to the run. A full re-run with overwrite: true replaces it with the new attempt's tokens.

AI model disclosure
  • Model/version: anthropic/claude-opus-5-5 (as reported by the runtime) for design, review and the PR. A delegated worker agent wrote the workflow and Python changes. Its exact model could not be verified.
  • Role: implementation, tests and PR description.
PR checklist and change type

Type of Change

  • Bug fix
  • New feature
  • Configuration change
  • Documentation update
  • Other (please describe)

Checklist

  • I have completed the AI model disclosure and kept it current
  • I have tested my changes locally
  • I have updated documentation if necessary
  • If python -m infx.matrix.changed --base origin/main lists affected config keys, I have appended one new entry covering them to the physical end of inferencex-e2e/perf-changelog.yaml; if it lists none, I have added none. I have not edited historical entries
  • If this PR appends an inferencex-e2e/perf-changelog.yaml entry, it carries exactly one primary sweep label (a maintainer applies it on fork PRs): full-sweep-fail-fast (recommended), full-sweep-enabled, or non-canary-full-sweep-enabled. Optional modifiers all-evals, evals-only, and agentx-fast require a primary label; the last two block reuse while applied.
  • Before merging via reuse, a maintainer with write access to the repository has commented /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 优先级权重与打分逻辑移出本仓库。分类器与矩阵生成仍负责描述每个任务,排序改由优先级调度器完成。

  • setup 任务为每个调度任务打上 ci-job-<queue-token> 标签(不再包含分数),并上传未压缩的 scheduling-facts.json artifact,按 token 记录分类器投影后的事实:框架、模型前缀、精度、投机解码、agentic、eval-only、多节点与节点数,以及运行级别的事件、patchwork 与 checklist 完成情况。
  • 删除 inferencex-e2e/configs/ci-priority.yaml 与打分代码。infx.workflows.ci_priority 改为 infx.workflows.scheduler_facts,负责添加 queue token(值不变)并合并同一步骤多次调用的事实。
  • 分类器的候选条件取自被测 checkout 中的 master 配置,而非权重文件;新增模型前缀的 PR 也能获得对应加分。未知条件不加分,也不会导致 setup 失败。
  • 任务名去掉 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 编写,其确切模型无法核实。

- 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.
@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

inferencex-e2e/infx diff: +556 -703

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 包的改动有更高的代码质量要求。

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Findings marked 🟡 are optional suggestions and need no follow-up push.

Comment thread inferencex-e2e/infx/klaud/validation.py Outdated
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"}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 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.

Comment on lines 27 to 30
_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))?$"
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 (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.

Comment on lines +77 to +88
# 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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 (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.

Comment on lines +199 to +203
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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 (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.

Comment on lines +272 to +275
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)
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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.

Comment on lines +80 to +81
def test_queue_tokens_match_the_previous_implementation():
"""Tokens pinned from the scorer this module replaced, so runner labels keep their identity."""

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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.
@adibarra
adibarra merged commit 5a1f810 into main Nov 18, 2026
10 checks passed
@adibarra
adibarra deleted the feat/scheduler-facts branch November 18, 2026 19:10
hbarclay added a commit that referenced this pull request Nov 23, 2026
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 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant