Repository navigation
fix(klaud): requeue only PRs main superseded and count live candidates toward the backlog cap / fix(klaud):仅重新排队被 main 取代的 PR,并将进行中候选计入积压上限 - #5051
Conversation
…queue PRs main superseded The finished-PR backlog cap ignored claimed sessions and candidates taken earlier in the same wave, so a master config could overshoot it. Plan now counts family claims (once per candidate) and each wave take adds to its master config. Superseded-PR requeue compared the candidate image with every image the feed offered for the curve, so a newer image published by another key closed a validated PR. It now reads the PR's frozen baseline and requeues it only when main removed one of its keys or moved one to another image, which also closes PRs whose keys were retired.
|
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 包的改动有更高的代码质量要求。 |
| wave = WaveCapacity({}, {}, set(), backlog) | ||
| candidates = sorted(candidates, key=lambda candidate: wave.blocker(candidate) == "backlog") | ||
| candidates = candidates[: min(review_batch_size, REVIEW_PER_SLOT * free_slots + REVIEW_MARGIN)] |
There was a problem hiding this comment.
🟡 (optional) Free slots can sit idle in a wave because the plan reviews mostly candidates that select will then defer for backlog. plan still sorts and truncates with a static backlog. select now adds each taken candidate to the backlog. A config one place below FINISHED_BACKLOG_CAP still sorts first, so the truncated batch can be filled with its candidates. Candidates from configs with room fall outside the batch. Fix: order the candidates in plan by modelling in-wave takes the way select does. Each config gets at most FINISHED_BACKLOG_CAP - backlog[group] candidates ahead of the backlog ones. [also at: inferencex-e2e/infx/klaud/main.py:750 - After this change, producers can be prepared for candidates that select later defers for backlog. Candidates select would take can then be left without producers.]
Why this was flagged
In this pass nvidia-master.yaml has 7 counted backlog entries (the PR description says it now starts at or near the cap). free_slots is 2, so the batch at __main__.py:885 is min(review_batch_size, 3*2+4) = 10. The sort at __main__.py:884 calls wave.blocker with the static Counter, so nvidia candidates are not marked "backlog" and keep their idle-first and cooldown order. nvidia-master has about 145 keys against 47 for amd, so the 10 reviewed candidates can all be nvidia. In select, wave.take (__main__.py:750) moves nvidia to 8 after the first pick, and the other nine land in backlog-deferred-candidates. The second slot stays empty even though amd-master candidates were available but cut off by the truncation. On the base branch the static count let select take both nvidia candidates (the overshoot this PR fixes). Plan and select used the same rule, so no reviewed batch was wasted that way. Nothing in plan models the new in-wave increment.
Verification: Trigger: one master config is one below FINISHED_BACKLOG_CAP (8) at plan time, with 2 or more free slots. plan sorts against a static Counter and truncates (main.py:883-885). In select, wave.take(candidate) now adds to the backlog (line 750), so later candidates from that config are deferred and a slot stays empty for the wave. On the base, both slots filled, but by going over the cap.
| try: | ||
| baseline = baseline_from_body(body) | ||
| except VerificationError: | ||
| return None | ||
| if baseline is None: |
There was a problem hiding this comment.
🟡 (optional) A stale finished PR whose body baseline is missing or no longer parses is now never requeued, so it keeps its family and backlog place until someone closes it by hand. superseded returns None on VerificationError or a missing record, and logs nothing. The base requeued such PRs from the candidate ID alone. Fix: when the baseline cannot be read, emit a ::warning:: naming the PR, and fall back to the base's image check, which reads pull["head"]["ref"] and needs no body. This keeps unreadable-baseline PRs from being skipped forever.
Why this was flagged
The condition is a finished Klaud PR older than STALE_DAYS (5) whose body holds no klaud-baseline-record:v1 line, or holds one that the current strict Baseline contract rejects. A body with no record can still finish, because baseline_for (reporting.py:844-851) also accepts a baseline stored in a comment. requeue_superseded (finished.py:283) calls superseded(pull.get("body") or "", images). That catches the VerificationError at finished.py:241-243, or gets None at :244-245, and returns None without any log. The PR is then never closed, even after main removes its key or moves its image. On the base, requeue_superseded decided from the candidate ID prefix and image (candidate.split("-") against offered) and needed no body. No safeguard covers them: no other step requeues finished PRs, and nothing warns about them.
Verification: superseded (finished.py, new) does except VerificationError: return None and if baseline is None: return None, and prints nothing. requeue_superseded now only appends to stale when superseded(pull.get("body") or "", images) returns a reason, so these PRs are skipped with no ::warning::. The base decided from the head ref alone.
Three planner bugs. One closed a validated win, and the other two let the review backlog grow.
False supersede closed a good PR.
requeue_supersededmarked a finished PR stale whenever the published curve for its model, hardware and framework showed a newer image. On Nov 5 it closed #4685, which improved all 9 points. The cause was a new single-point key on main,dsv41flash-fp4-mi355x-vllm-agentic-dspark-tp8-c1, published on that image. #4685's own key was unchanged. A PR now counts as superseded only when main removed one of its own family keys or put one on a different image. The keys and their base images come from the PR's frozen baseline record.Retired keys were never requeued. The old check skipped families the feed no longer offered, so #4578 (key retired by #4664) and #4696 (Kimi-K3 retired) stayed open, counted against the backlog, and were closed by hand. The same rule above now requeues them, and the comment names the real reason.
Backlog cap overshot. The cap counted only open finished PRs and was computed once per wave. On Nov 7, two passes each selected 5 candidates while nvidia-master had 5 and 7 finished PRs, and it ended at 11 against a cap of 8. The count now includes live family claims (a candidate already having a finished PR is not counted twice) and candidates taken earlier in the same wave.
Effect on the 15 open finished PRs, checked against current main: none is requeued on the first pass. Under the new count nvidia-master starts at the cap (8), and amd-master (7) fills after one more candidate.
Not covered: a PR whose recipe files main changed while its master entry and image stayed the same. That was the #4559 case. The PR does not record its base recipe reliably, because changelog syncs move its merge base.
Tests: cases for another key's image moving (not requeued), its own key moving or being removed (requeued), claims counting toward the cap, and the cap filling within a wave. Klaud suite: 503 passed.
AI model disclosure
中文
修复三个规划器问题:一个关闭了已验证的正收益 PR,另外两个导致评审积压增长。
误判"已被取代"。
requeue_superseded在模型/硬件/框架的已发布曲线出现更新镜像时就认定已完成 PR 过期;11 月 5 日因 main 新增的单点 keydsv41flash-fp4-mi355x-vllm-agentic-dspark-tp8-c1而关闭了全部 9 个点都提升的 #4685,而 #4685 自身的 key 并未变化。现在只有当 main 删除了 PR 自身的某个 key,或改变了该 key 的镜像时才算被取代(key 与基础镜像取自 PR 冻结的基线记录)。退役的 key 从不重新排队。 旧逻辑跳过 feed 不再提供的配置族,#4578、#4696 因此一直开着并占用积压名额,最终被人工关闭。上述规则现在会将其重新排队,评论写明实际原因。
积压上限超额。 上限只统计已完成的开放 PR,且每轮只计算一次;11 月 7 日 nvidia-master 达到 11 个(上限 8)。现在同时统计进行中的配置族声明和本轮已选中的候选。
对当前 15 个已完成 PR:首轮不会重新排队任何一个;nvidia-master 从 8 起算,amd-master 为 7。未覆盖:main 只改了配方文件而 master 条目与镜像不变的情况(#4559)。Klaud 测试 503 个全部通过。