Skip to content

Commit 98f0d6e

Browse files
authored
feat(klaud): update AgentX curves whose keys start on different images / feat(klaud):更新各配置键起始镜像不同的 AgentX 曲线 (#4624)
1 parent e06ae3e commit 98f0d6e

4 files changed

Lines changed: 488 additions & 92 deletions

File tree

‎.github/klaud-candidate-prompt.md‎

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ current family/image from the checkout, then independently inspect the actual bu
1616
source, official upstream releases and available images; stop if retired, ambiguous, updated
1717
or owned by another Klaud Cold PR. Open PRs on other branches never block a candidate.
1818
Normalize registry `/` versus enroot `#` spelling when comparing the same image.
19+
When candidate.json also has `sources`, the family's keys start on different images, and
20+
`sources` maps each key to the curve's newest published observation of that key's image.
21+
`unbaselined-keys` maps each key whose current image was never published to that image. The
22+
baseline freezes nothing for those keys and their deltas stay N/A, but they still move to the
23+
new image and every one of their points must pass the final sweep.
1924
Use the canonical generator, inferencex-e2e/configs/runners.yaml and public OpenAPI/repository mappings
2025
for all points, exact cluster routes and physical node demand; never invent aliases or
2126
substitute sibling clusters. The planner already owns the family claim; leave claim refs
@@ -56,8 +61,9 @@ duration, resources, recipe references, all points and default evals. No broad t
5661
shared code/workflows or other-family edits (keys outside the family).
5762
The candidate.json `family` may list several comma-separated keys of one master file. Together
5863
they form one AgentX dashboard curve, and the newest normal run replaces that whole curve.
59-
Update every listed key's master image to the same new image, and change each key's own recipe
60-
compatibility settings only as needed. Never leave a key of the family on the old image.
64+
The keys may start on different images. Update every listed key's master image to the same new
65+
image, and change each key's own recipe compatibility settings only as needed. Never leave a key
66+
of the family on an old image.
6167
The master `router` (Dynamo) record is frozen point identity: never change it. When a new
6268
engine needs a newer Dynamo, bump it only in the family's recipe (`dynamo.source.rev` or its
6369
install pin), and try that before reporting incompatible for a Dynamo version gap.
@@ -84,12 +90,14 @@ Preemption reruns use neither repairs nor infrastructure retries and never count
8490
same failure twice. Fail-fast cancellations after a real failure are not preemption.
8591

8692
Freeze the COMPLETE original public baseline point roster before attempts, using
87-
candidate.source.date, verified old-image producer IDs/SHAs and full recipe/workload/topology/
88-
concurrency/dataset identities. Use `infx.klaud`'s typed reporting commands:
93+
candidate.source.date (or each key's own `sources` date), verified old-image producer IDs/SHAs
94+
and full recipe/workload/topology/concurrency/dataset identities. Use `infx.klaud`'s typed
95+
reporting commands:
8996
`prepare-baseline --model DISPLAY_MODEL --goal-file "$KLAUD_EVIDENCE/goal.json"
9097
--output "$KLAUD_EVIDENCE/baseline.json"`, then
9198
`report --kind baseline --file "$KLAUD_EVIDENCE/baseline.json"`.
92-
The goal record has `en` and `zh` sentences naming the exact old/new images.
99+
The goal record has `en` and `zh` sentences naming the exact old/new images. When the keys
100+
start on different images, name each key with its own old image.
93101
Read `report-schema --kind attempt` once and publish/update each typed record with
94102
`report --kind attempt --file "$KLAUD_EVIDENCE/attempt.json"`.
95103
In attempts, copy each AgentX point's `dataset` from its result row's `dataset.hf_dataset_name`
@@ -186,6 +194,7 @@ artifacts; do not redispatch a full sweep just because several manifests exist.
186194
Before a repair push, remove sweep labels and keep draft, then repeat within budget.
187195

188196
Use the canonical reporting renderer. Body only: `Goal: Update ENGINE image from OLD to NEW.`
197+
(with each key and its own OLD image when the keys start on different images)
189198
plus the complete dated public baseline; no baseline comment. Attempt comments contain the
190199
counter, status/run, compact image/SHA/settings, Change, benchmark/eval tables and Next only.
191200
Keep English visible and Chinese prose in `<details><summary>中文</summary>`; numeric tables

‎inferencex-e2e/infx/klaud/__main__.py‎

Lines changed: 40 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,15 @@ class Family(NamedTuple):
8181
"""A live family's target clusters, node demands and whether its smoke matrix is complete.
8282
8383
``node_demand`` is the node count of its largest AgentX job, ``sweep_node_demand`` the
84-
nodes of every job of its full AgentX sweep.
84+
nodes of every job of its full AgentX sweep. ``images`` pairs each key with its master image
85+
when the keys use different images, and is empty otherwise.
8586
"""
8687

8788
clusters: frozenset[str]
8889
node_demand: int
8990
sweep_node_demand: int
9091
smoke_covers_full: bool
92+
images: tuple[tuple[str, str], ...] = ()
9193

9294

9395
class History(NamedTuple):
@@ -160,9 +162,9 @@ def live_families(root: Path) -> dict[tuple, dict[str, Family]]:
160162
161163
Archives and fixed-seq-len points are excluded. A family is one AgentX dashboard curve: every
162164
master key of one master file whose points share model, hardware, framework and precision,
163-
since the newest run replaces that whole curve. Curves spanning master files or using several
164-
images are left out. A family's smoke matrix covers its full sweep when the generator's
165-
``--smoke`` selection keeps every benchmark point and default eval.
165+
since the newest run replaces that whole curve. Curves spanning master files are left out.
166+
A family's smoke matrix covers its full sweep when the generator's ``--smoke`` selection
167+
keeps every benchmark point and default eval.
166168
"""
167169
from infx.clusters import load_inventory
168170
from infx.config import project_root
@@ -219,9 +221,7 @@ def live_families(root: Path) -> dict[tuple, dict[str, Family]]:
219221
if not clusters:
220222
print(f"::warning::Klaud live-family-clusters-unresolved: {family}")
221223
continue
222-
if len({normalized_image(entry["image"]) for entry in entries}) > 1:
223-
print(f"::notice::Klaud skips {family}: its keys use different images.")
224-
continue
224+
images = {key: normalized_image(rows[0]["image"]) for (_, key), rows in members.items()}
225225
evals = [
226226
dict(row, **{"eval-only": True})
227227
for row in mark_eval_entries(deepcopy(entries), root)
@@ -235,6 +235,7 @@ def live_families(root: Path) -> dict[tuple, dict[str, Family]]:
235235
sweep_node_demand=sum(entry.get("node-count", 1) for entry in [*entries, *evals]),
236236
smoke_covers_full=point_identities(smoke) == point_identities(entries)
237237
and expected_evals({"evals": smoke_evals}) == expected_evals({"evals": evals}),
238+
images=tuple(sorted(images.items())) if len(set(images.values())) > 1 else (),
238239
)
239240
for entry in entries:
240241
row = {
@@ -264,18 +265,24 @@ def choose(
264265
A branch or claim of the family, or of a single-key family of one of its keys, occupies it.
265266
The order is a weighted shuffle: a family's weight is its benchmark age in days plus one, so
266267
older images tend to lead without starving recent ones. Headroom is checked but not consumed
267-
here, so the overlap review keeps alternatives.
268+
here, so the overlap review keeps alternatives. A family whose keys use different images
269+
maps each key to the curve's newest observation of that key's image as ``sources``, and
270+
each key whose image has none to that image as ``unbaselined-keys``.
268271
"""
269272
occupied = {re.sub(r"^klaud[e]?/auto-", "klaud/auto-", branch) for branch in occupied}
270273
selected = []
271274
keys: list[float] = []
272275
seen = set()
273-
valid = [item for item in items if item["source-status"] == "baseline"]
274-
for item in sorted(
275-
valid,
276+
valid = sorted(
277+
(item for item in items if item["source-status"] == "baseline"),
276278
key=lambda item: (item["source"]["date"], item["source-id"]),
277279
reverse=True,
278-
):
280+
)
281+
newest: dict[tuple[str, str], dict] = {}
282+
for item in valid:
283+
for family in families.get(observation_key(item["source"]), {}):
284+
newest.setdefault((family, observation_key(item["source"])[-1]), item["source"])
285+
for item in valid:
279286
row = item["source"]
280287
legacy = identity(
281288
{
@@ -298,12 +305,22 @@ def choose(
298305
name = identity(member)[:16]
299306
claims |= {f"klaud/auto-{name}-", f"klaud/auto-{name}-{image_key}"}
300307
claims.add(f"klaud/claim-{name}")
308+
sources = {
309+
key: row if image == observation_key(row)[-1] else newest.get((family, image))
310+
for key, image in record.images
311+
}
301312
if (
302313
family in seen
303314
or claims & occupied
304315
or any(headroom.get(cluster, 0) < record.node_demand for cluster in record.clusters)
305316
):
306317
continue
318+
mixed = {
319+
"sources": {key: source for key, source in sources.items() if source},
320+
"unbaselined-keys": {
321+
key: image for key, image in record.images if not sources[key]
322+
},
323+
}
307324
selected.append(
308325
{
309326
"id": branch.removeprefix("klaud/auto-"),
@@ -314,6 +331,7 @@ def choose(
314331
"smoke-covers-full": record.smoke_covers_full,
315332
"source": row,
316333
"branch": branch,
334+
**(mixed if sources else {}),
317335
}
318336
)
319337
keys.append(random.expovariate(item["benchmark-age-days"] + 1))
@@ -1246,7 +1264,13 @@ def select(
12461264
``directory``.
12471265
"""
12481266
from . import claims, validation
1249-
from .reporting import BaselinePreflight, Prose, missing_baseline_points, resolve_baseline
1267+
from .reporting import (
1268+
BaselinePreflight,
1269+
Prose,
1270+
missing_baseline_points,
1271+
resolve_baseline,
1272+
unpublished_keys,
1273+
)
12501274

12511275
contexts = json.loads((directory / "candidates.json").read_text())
12521276
producers = json.loads((directory / PRODUCERS).read_text())
@@ -1318,6 +1342,7 @@ def select(
13181342
baseline=baseline,
13191343
)
13201344
missing = missing_baseline_points(matrix, baseline)
1345+
unpublished = unpublished_keys(matrix, baseline)
13211346
except (VerificationError, ReadError) as error:
13221347
baseline_deferred.append(candidate["id"])
13231348
baseline_reasons[candidate["id"]] = str(error)
@@ -1333,14 +1358,15 @@ def select(
13331358
baseline_reasons[candidate["id"]] = f"{type(error).__name__}: {str(error)[:300]}"
13341359
families.add(decision.family)
13351360
continue
1336-
if missing:
1361+
if missing or unpublished:
13371362
baseline_deferred.append(candidate["id"])
13381363
baseline_reasons[candidate["id"]] = "baseline-point-mismatch"
13391364
baseline_mismatches.append(
13401365
{
13411366
"id": candidate["id"],
13421367
"reason": "baseline-point-mismatch",
13431368
"missing-points": len(missing),
1369+
**({"unpublished-keys": unpublished} if unpublished else {}),
13441370
}
13451371
)
13461372
families.add(decision.family)

0 commit comments

Comments
 (0)