Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions .github/klaud-candidate-prompt.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ never treat a point's absence from the current family as its retirement.
Keep targeted work draft with no sweep labels. Dispatch ONLY updated-image e2e-tests.yml
from main, with ref=exact measured SHA, fail-fast=true, klaud-run=true,
test-name=$KLAUD_TEST_NAME, and
`generate-cli-command="test-config --config-files FILE --config-keys FAMILY --smoke"`.
`generate-cli-command="test-config --config-files FILE --config-keys FAMILY --scenario-type agentic-coding --smoke"`.
Autosweeps cover only the family's AgentX (agentic-coding) points; never run fixed-seq-len points.
Smoke retains minimum-concurrency throughput and canonical representative eval concurrency;
it is startup evidence, not a full curve. Persist each run ID/head/attempt and typed progress
comment immediately, before waiting. Use `gh run watch --interval 60`, resume after tool
Expand All @@ -117,8 +118,9 @@ Benchmarks may take three hours. Do not cancel healthy or queued work to fit the
limit; leave it queued when the session ends, and a later session resumes it.

After smoke benchmarks AND selected evals pass, append one exact-family inferencex-e2e/perf-changelog.yaml
entry at the physical tail with this PR URL, preserving every prior byte. Omit scenario,
append-only and eval-selection modifiers. Its description must be one plain-English sentence
entry at the physical tail with this PR URL, preserving every prior byte. Set exactly
`scenario-type: [agentic-coding]`; omit append-only and eval-selection modifiers.
Its description must be one plain-English sentence
of at most 120 characters: state the engine image version change and, only when necessary,
one essential compatibility adjustment. Do not include evidence, benchmark results, upstream
release summaries, rationale or limitations there; those belong in attempt comments.
Expand Down
17 changes: 11 additions & 6 deletions inferencex-e2e/infx/klaud/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,18 @@ def target_clusters(entries: list[dict], inventory: RunnerInventory) -> frozense


def live_families(root: Path) -> dict[tuple, dict[str, tuple[frozenset[str], int]]]:
"""Resolve public identities, target clusters and node demand from the canonical generator.
"""Resolve public AgentX identities, target clusters and node demand from the generator.

Archives are excluded. A family's node demand is the node count of its largest generated job.
Archives and fixed-seq-len points are excluded. A family's node demand is the node count of
its largest generated AgentX job.
"""
from infx.clusters import load_inventory
from infx.config import project_root
from infx.matrix.generate import _hardware_family, generate_test_config_sweep
from infx.matrix.validation import load_config_files, load_runner_file

from .validation import in_scope

root = project_root(root)
runners = load_runner_file(str(root / "configs/runners.yaml"))
inventory = load_inventory(runners)
Expand All @@ -105,23 +108,25 @@ def live_families(root: Path) -> dict[tuple, dict[str, tuple[frozenset[str], int
except ValueError:
print(f"::warning::Klaud live-family-unrenderable: {family}")
continue
entries = [entry for entry in entries if in_scope(entry)]
if not entries:
continue
clusters = target_clusters(entries, inventory)
if not clusters:
print(f"::warning::Klaud live-family-clusters-unresolved: {family}")
continue
demand = max(entry.get("node-count", 1) for entry in entries)
for entry in entries:
agentic = entry.get("scenario-type") == "agentic-coding"
row = {
"model": entry["model-prefix"],
"hardware": _hardware_family(entry["runner"]),
"framework": entry["framework"],
"precision": entry["precision"],
"spec_method": entry["spec-decoding"],
"disagg": entry.get("disagg", False),
"benchmark_type": "agentic_traces" if agentic else "single_turn",
"isl": None if agentic else entry["isl"],
"osl": None if agentic else entry["osl"],
"benchmark_type": "agentic_traces",
"isl": None,
"osl": None,
"image": entry["image"],
}
index.setdefault(observation_key(row), {})[family] = (clusters, demand)
Expand Down
26 changes: 19 additions & 7 deletions inferencex-e2e/infx/klaud/validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@
if TYPE_CHECKING:
from infx.matrix.revision import Revision

# Klaud autosweeps cover only AgentX; fixed-seq-len points are out of scope.
SCENARIO = "agentic-coding"


def in_scope(entry: dict) -> bool:
return entry.get("scenario-type") == SCENARIO


def benchmark_entries(matrix: dict) -> list[dict]:
return [
Expand All @@ -44,7 +51,7 @@ def project_prefix(repository: str, head: str) -> str:


def canonical_matrix(repository: str, head: str, family: str) -> dict:
"""Generate the unfiltered family from exact-head YAML using trusted local code.
"""Generate the family's AgentX points from exact-head YAML using trusted local code.

Candidate source is data only. A future generator-policy change can require manual
inspection of an older run; it cannot silently waive points or required evals.
Expand Down Expand Up @@ -77,12 +84,16 @@ def canonical_matrix(repository: str, head: str, family: str) -> dict:
for path in [*paths, *blocks]:
(root / path).parent.mkdir(parents=True, exist_ok=True)
(root / path).write_bytes(github.file_at(repository, head, prefix + path))
entries = generate_test_config_sweep(
SimpleNamespace(config_keys=[key]),
validate_master_config(family_config, root),
validate_runner_config(runners),
root,
)
entries = [
entry
for entry in generate_test_config_sweep(
SimpleNamespace(config_keys=[key]),
validate_master_config(family_config, root),
validate_runner_config(runners),
root,
)
if in_scope(entry)
]
Comment on lines +87 to +96

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.

🔴 In-flight Klaud candidates for fixed-seq-len families can no longer pass final validation. They burn resume sessions and then end as "unexpected-error". On the base branch they would validate. canonical_matrix now drops every non-AgentX point, so a pure 8k1k family regenerates to an empty canonical set. check_matrix then raises "Final matrix omits or changes canonical benchmark points". The PR notes this as possible, but the retry loop makes it costlier than a single failure. Fix: classify such a candidate as out of scope once, either with a terminal outcome or by applying the new scope only to new selections, so it is not resumed repeatedly.

Why this was flagged

The trigger is any Klaud candidate created before this merge whose family has only fixed-seq-len points. Real configs keep agentic and 8k1k curves in separate families, for example qwen3.5-fp8-b200-sglang in nvidia-master.yaml:1125. For such a family, the filter at validation.py:87-96 leaves entries empty. check_matrix (validation.py:223) then raises VerificationError because expected is empty, and resolve_baseline (reporting.py:1214) raises "Baseline source image no longer matches the selected base". In lifecycle.py:819-832 the VerificationError sets validated = False. The cleanup path then calls resume and raises PendingCleanup until MAX_SESSIONS is reached. After that it finishes with outcome "unexpected-error", so each affected PR consumes repeated sessions before it is abandoned. On the base branch the same final sweep would pass validation and be marked "validated". The PR description says in-flight 8k1k PRs "may fail final checking", but nothing gives them a clean terminal outcome.

Verification: validation.py:87-96 now filters through in_scope (validation.py:26-27). For a pure 8k1k family, expected is empty, so line 223 raises "Final matrix omits or changes canonical benchmark points". lifecycle.py:825-834 resumes until MAX_SESSIONS, then ends with outcome="unexpected-error". On the base branch the unfiltered canonical matrix would have validated it.

fingerprinted = [
{**row, "recipe-fingerprint": recipe_fingerprint(row, root)} for row in entries
]
Expand Down Expand Up @@ -133,6 +144,7 @@ def producer_matrix(repository: str, head: str, family: str) -> dict:
rows = throughput_rows(producer, family.split(":", 1)[1])
if not isinstance(rows, list) or not all(isinstance(row, dict) for row in rows):
raise ValueError("the generator did not print a list of matrix rows")
rows = [row for row in rows if in_scope(row)]

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.

🟣 pre-existing, not blocking: An AgentX candidate can be deferred every wave because a same-date fixed-seq-len producer run fails to regenerate, even though those rows are now out of scope. publication (reporting.py:1004-1023) does not filter rows by benchmark_type. resolve_baseline raises PRODUCER_UNAVAILABLE at reporting.py:1244 for any public row's head before checking whether any AgentX point could match. Fix: drop public rows whose benchmark_type is not "agentic_traces" before collecting producer heads and requiring producers. That covers both regenerate_producers and resolve_baseline.
A small fix can ride a push you are already making; otherwise a short reply is enough.

Why this was flagged

This needs the source date's feed to hold fixed-seq-len rows for the same model/hardware/framework/precision/spec/disagg/image. Those rows must come from a different head whose producer_matrix raises ProducerRegenerationError. publication (reporting.py:988-1039) keeps rows of every benchmark_type, so Publication.heads includes that head. regenerate_producers (main.py:832-840) logs the failure and leaves the head out of producers.json. resolve_baseline reaches that row at reporting.py:1243-1245 and raises PRODUCER_UNAVAILABLE without checking whether any AgentX point could match. After this PR, producer_matrix keeps only in-scope rows (validation.py:147), so that head can never contribute a point. select still adds the candidate to baseline_deferred and blocks its family (main.py:907-910) on every wave, because the public data does not change. On the base branch the same block protected in-scope 8k1k points. It now blocks AgentX autosweeps for rows they never use, and still spends a snapshot regeneration per irrelevant head.

Verification: publication (reporting.py:988-1039) never checks benchmark_type, so fixed-seq-len rows stay in Publication.rows. In resolve_baseline, raise VerificationError(PRODUCER_UNAVAILABLE) (reporting.py:1244-1245) happens before it computes matches. The new in_scope filter (validation.py:147) runs after the generator subprocess. On base the same route raises the same PRODUCER_UNAVAILABLE.

fingerprints = producer.fingerprints(rows)
except subprocess.SubprocessError as error:
stderr = getattr(error, "stderr", None) or b""
Expand Down
29 changes: 25 additions & 4 deletions inferencex-e2e/infx/tests/historical_revision.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
"isl": 8192, "osl": 1024, "search-space": [{"tp": 1, "conc-list": [2, 6]}],
}]},
}}
AGENTX_MASTER = {KEY: {**MASTER[KEY], "scenarios": {"agentic-coding": [{
"search-space": [{"tp": 1, "kv-offloading": "none", "conc-list": [2, 6]}],
}]}}}
POINTS = [("example/model", 2, "example/image:stable"), ("example/model", 6, "example/image:stable")]

GENERATOR = '''\
Expand All @@ -49,7 +52,7 @@ def rows(config_keys, config_files, runner_config):
for key in config_keys:
entry = master[key]
gpus = hardware[entry["runner"]]["gpus-per-node"]
for scenario in entry["scenarios"]["fixed-seq-len"]:
for scenario in entry["scenarios"].get("fixed-seq-len", []):
for space in scenario["search-space"]:
if space["tp"] > gpus:
sys.exit(f"{key}: tp {space['tp']} exceeds {gpus} GPUs per node")
Expand All @@ -65,6 +68,21 @@ def rows(config_keys, config_files, runner_config):
"exp-name": entry["model-prefix"] + "_8k1k", "disagg": False,
"run-eval": False,
})
for scenario in entry["scenarios"].get("agentic-coding", []):
for space in scenario["search-space"]:
if space["tp"] > gpus:
sys.exit(f"{key}: tp {space['tp']} exceeds {gpus} GPUs per node")
for conc in space["conc-list"]:
result.append({
"image": entry["image"], "model": entry["model"],
"model-prefix": entry["model-prefix"], "precision": entry["precision"],
"framework": entry["framework"], "runner": entry["runner"],
"tp": space["tp"], "pp": 1, "dcp-size": 1, "pcp-size": 1, "ep": 1,
"dp-attn": False, "spec-decoding": "none", "conc": conc,
"kv-offloading": space["kv-offloading"], "total-cpu-dram-gb": 0,
"duration": 1800, "exp-name": entry["model-prefix"] + "_agentx",
"scenario-type": "agentic-coding", "run-eval": False,
})
return result


Expand Down Expand Up @@ -131,11 +149,14 @@ def changelog_entry(link: str) -> bytes:
return f'- config-keys:\n - {KEY}\n description:\n - "Update {KEY}"\n pr-link: {link}\n'.encode()


def commit_history(root: Path, project: str = "", *, launcher: bool = True) -> tuple[str, str]:
def commit_history(
root: Path, project: str = "", *, launcher: bool = True, master: dict = MASTER
) -> tuple[str, str]:
"""Commit a base revision and a head appending one changelog entry; return both SHAs.

The working tree is left at the head. With ``launcher`` the revision ships its own
``infx.launch`` entrypoint, which e2e runs require of every measured revision.
``infx.launch`` entrypoint, which e2e runs require of every measured revision. ``master``
is the revision's NVIDIA master config.
"""
def git(*args: str) -> str:
return subprocess.run(
Expand All @@ -149,7 +170,7 @@ def git(*args: str) -> str:
"infx/matrix/generate.py": GENERATOR,
"infx/matrix/plan.py": PLANNER,
"configs/amd-master.yaml": "{}\n",
"configs/nvidia-master.yaml": yaml.safe_dump(MASTER),
"configs/nvidia-master.yaml": yaml.safe_dump(master),
"configs/runners.yaml": yaml.safe_dump(RUNNERS),
**({"infx/launch/__init__.py": "", "infx/launch/__main__.py": ""} if launcher else {}),
}
Expand Down
67 changes: 36 additions & 31 deletions inferencex-e2e/infx/tests/klaud/test_klaud_github.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from infx.klaud import api, claims, github, lifecycle, reporting, validation
from infx.klaud.models import CandidateOutcome, Feed, OwnedCandidate, Ownership, identity, stamp
from infx.tests.historical_revision import (
AGENTX_MASTER,
FAMILY,
KEY,
POINTS,
Expand Down Expand Up @@ -1705,19 +1706,21 @@ def family_configs():
"model-prefix": "dsr1",
"precision": "fp8",
"framework": "sglang",
"runner": "fixture",
"runner": "cluster:fixture",
"multinode": False,
"srt-recipe-dir": "fixture",
"scenarios": {
"fixed-seq-len": [{
"isl": 1024, "osl": 1024,
"search-space": [{"tp": 1, "conc-list": [2, 6], "srt-recipe": "recipe.yaml"}],
"agentic-coding": [{
"search-space": [{
"tp": 1, "kv-offloading": "none", "conc-list": [2, 6],
"srt-recipe": "recipe.yaml",
}],
}],
},
},
}
runners = {
"labels": {"fixture": ["node-a"], "cluster:fixture": ["node-a"]},
"labels": {"cluster:fixture": ["node-a"]},
"clusters": {"fixture": {
"gpus-per-node": 8, "arch": "x86_64", "scheduler": "slurm",
"slurm": {"partition": "batch", "exclusive": True},
Expand All @@ -1735,6 +1738,11 @@ def write_fixture_recipe(root: Path) -> None:
@pytest.mark.parametrize("prefix", ["", "inferencex-e2e/"])
def test_canonical_family_matrix_reads_revision_layout(monkeypatch, family_configs, prefix):
master, runners = family_configs
# A fixed-seq-len curve of the same family is outside Klaud's AgentX scope.
master["fixture"]["scenarios"]["fixed-seq-len"] = [{
"isl": 8192, "osl": 1024,
"search-space": [{"tp": 1, "conc-list": [4], "srt-recipe": "recipe.yaml"}],
}]
files = {
prefix + "configs/nvidia-master.yaml": yaml.safe_dump(master),
prefix + "configs/runners.yaml": yaml.safe_dump(runners),
Expand All @@ -1752,15 +1760,15 @@ def family() -> list[dict]:
matrix = validation.canonical_matrix(
"example/project", "a" * 40, "configs/nvidia-master.yaml:fixture",
)
assert matrix["evals"] == []
assert [row["conc"] for row in matrix["evals"]] == [6]
return matrix["single_node"]["all"]

rows = family()
assert [(row["model"], row["conc"], row["image"]) for row in rows] == [
("example/model", 2, "example/image:stable"),
("example/model", 6, "example/image:stable"),
assert [(row.get("scenario-type"), row["conc"], row["image"]) for row in rows] == [
("agentic-coding", 2, "example/image:stable"),
("agentic-coding", 6, "example/image:stable"),
]
block = prefix + "configs/srt-recipes/fixed-sequence-single.yaml"
block = prefix + "configs/srt-recipes/agentic.yaml"
files[block] = files[block] + b" env: {EXTRA: '1'}\n"
changed = family()
assert [row["conc"] for row in changed] == [2, 6]
Expand All @@ -1779,7 +1787,7 @@ def publish(monkeypatch, head):
{
"model": "dsr1", "hardware": "fixture", "framework": "sglang", "precision": "fp8",
"spec_method": "none", "disagg": False, "is_multinode": False,
"benchmark_type": "single_turn", "isl": 8192, "osl": 1024, "offload_mode": "off",
"benchmark_type": "agentic_traces", "isl": None, "osl": None, "offload_mode": "off",
"conc": conc, "image": image, "prefill_tp": 1, "prefill_ep": 1,
"prefill_dp_attention": False, "prefill_num_workers": 0, "decode_tp": 1,
"decode_ep": 1, "decode_dp_attention": False, "decode_num_workers": 0,
Expand Down Expand Up @@ -1829,7 +1837,7 @@ def review_candidate(directory, monkeypatch, source):
def test_select_builds_baselines_from_regenerated_producers_without_starting_a_process(
tmp_path, monkeypatch, regenerated, selected, deferred
):
_, head = commit_history(tmp_path, "inferencex-e2e")
_, head = commit_history(tmp_path, "inferencex-e2e", master=AGENTX_MASTER)
monkeypatch.chdir(tmp_path)
base_family = validation.producer_matrix("example/project", head, FAMILY)
monkeypatch.setattr(validation, "canonical_matrix", lambda *_: base_family)
Expand Down Expand Up @@ -1863,7 +1871,7 @@ def no_process(args, *_args, **_kwargs):


def test_select_defers_a_baseline_the_current_family_no_longer_generates(tmp_path, monkeypatch):
_, head = commit_history(tmp_path, "inferencex-e2e")
_, head = commit_history(tmp_path, "inferencex-e2e", master=AGENTX_MASTER)
monkeypatch.chdir(tmp_path)
producer_family = validation.producer_matrix("example/project", head, FAMILY)
shrunk = {"single_node": {"all": [
Expand Down Expand Up @@ -2452,7 +2460,7 @@ def items(_repository, path, _key=None):
def test_producer_outside_the_local_clone_is_fetched_from_its_repository(tmp_path, monkeypatch):
remote = tmp_path / "remote"
remote.mkdir()
base, head = commit_history(remote)
base, head = commit_history(remote, master=AGENTX_MASTER)

def remote_git(*args):
subprocess.run(["git", *args], cwd=remote, check=True, capture_output=True)
Expand Down Expand Up @@ -2484,7 +2492,7 @@ def remote_git(*args):
def test_producer_predating_no_evals_regenerates_throughput_rows(tmp_path, monkeypatch):
from infx.tests.historical_revision import GENERATOR

commit_history(tmp_path)
commit_history(tmp_path, master=AGENTX_MASTER)
legacy = GENERATOR.replace(
' parser.add_argument("--no-evals", action="store_true")\n', ""
).replace(
Expand Down Expand Up @@ -2539,8 +2547,8 @@ def test_live_families_preserve_public_identity_after_move(tmp_path, family_conf
families = klaud.live_families(tmp_path if from_repository_root else project)

assert families == {
("dsr1", "fixture", "sglang", "fp8", "none", False, "single_turn",
1024, 1024, "example/image:stable"): {
("dsr1", "fixture", "sglang", "fp8", "none", False, "agentic_traces",
None, None, "example/image:stable"): {
"configs/nvidia-master.yaml:fixture": ({"fixture"}, 1),
},
}
Expand Down Expand Up @@ -2576,8 +2584,8 @@ def git(*args):
families = klaud.live_families(tmp_path)

assert families == {
("dsr1", "fixture", "sglang", "fp8", "none", False, "single_turn",
1024, 1024, "example/image:stable"): {
("dsr1", "fixture", "sglang", "fp8", "none", False, "agentic_traces",
None, None, "example/image:stable"): {
"configs/nvidia-master.yaml:fixture": ({"fixture"}, 1),
},
}
Expand All @@ -2590,19 +2598,18 @@ def test_choose_needs_node_demand_on_every_target_cluster_and_skips_unresolved_r
fixture, record = master["fixture"], runners["clusters"]["fixture"]
worker = {"num-worker": 1, "tp": 8, "ep": 1, "dp-attn": False}
master = {
"spanning": {**fixture, "runner": "h100"},
"exact": {**fixture, "runner": "cluster:h100-dsxe"},
"wide": {**fixture, "runner": "cluster:h100-dsxe", "multinode": True, "scenarios": {
"fixed-seq-len": [{"isl": 1024, "osl": 1024, "search-space": [
{"num-nodes": nodes, "worker": worker, "conc-list": [4], "srt-recipe": "wide.yaml"}
"agentic-coding": [{"search-space": [
{"num-nodes": nodes, "worker": worker, "kv-offloading": "none", "conc-list": [4],
"srt-recipe": "wide.yaml"}
for nodes in (2, 4, 3)
]}],
}},
"unmapped": {**fixture, "runner": "h100-retired"},
"unmapped": {**fixture, "runner": "cluster:h100-retired"},
}
runners = {
"labels": {
"h100": ["h100-cw_00", "h100-dsxe_00"],
"cluster:h100-cw": ["h100-cw_00"],
"cluster:h100-dsxe": ["h100-dsxe_00"],
},
Expand All @@ -2623,17 +2630,16 @@ def test_choose_needs_node_demand_on_every_target_cluster_and_skips_unresolved_r
"::warning::Klaud live-family-clusters-unresolved: configs/nvidia-master.yaml:unmapped\n"
)
assert families == {
("dsr1", "h100", "sglang", "fp8", "none", False, "single_turn",
1024, 1024, "example/image:stable"): {
"configs/nvidia-master.yaml:spanning": ({"h100-cw", "h100-dsxe"}, 1),
("dsr1", "h100", "sglang", "fp8", "none", False, "agentic_traces",
None, None, "example/image:stable"): {
"configs/nvidia-master.yaml:exact": ({"h100-dsxe"}, 1),
"configs/nvidia-master.yaml:wide": ({"h100-dsxe"}, 4),
},
} # fmt: skip
source = {
"model": "dsr1", "hardware": "h100", "framework": "sglang", "precision": "fp8",
"spec_method": "none", "disagg": False, "benchmark_type": "single_turn", "isl": 1024,
"osl": 1024, "image": "example/image:stable", "date": "2026-09-19",
"spec_method": "none", "disagg": False, "benchmark_type": "agentic_traces", "isl": None,
"osl": None, "image": "example/image:stable", "date": "2026-09-19",
} # fmt: skip
items = [{"source-status": "baseline", "source-id": "1", "source": source}]

Expand All @@ -2647,6 +2653,5 @@ def chosen(headroom):
assert chosen({"h100-cw": 1}) == []
assert chosen({"h100-dsxe": 3}) == [("exact", ["h100-dsxe"], 1)]
assert chosen({"h100-cw": 1, "h100-dsxe": 4}) == [
("exact", ["h100-dsxe"], 1), ("spanning", ["h100-cw", "h100-dsxe"], 1),
("wide", ["h100-dsxe"], 4),
("exact", ["h100-dsxe"], 1), ("wide", ["h100-dsxe"], 4),
]
Loading