Skip to content

Recover PR UT Coverage when a selected runner pool stalls - #508

Draft
XuPeng-SH wants to merge 22 commits into
mainfrom
codex/coverage-shared-runner
Draft

XuPeng-SH wants to merge 22 commits into
mainfrom
codex/coverage-shared-runner

Conversation

@XuPeng-SH

@XuPeng-SH XuPeng-SH commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Goal

Use spare CS capacity for MatrixOne main and 4.2-dev UT Coverage. The hosted preflight reads four sites in parallel under a 15-second budget. Two observed idle runners can take work through the shared CS label. Otherwise the two groups divide the verified online and cold slots. With one verified slot for two groups at initial placement, group 0 takes CS and group 1 can use Shanghai. An incomplete inventory can still supply CS offers. Unmatched groups keep the shared queue. Read-only capacity setup

Cold capacity accounts for CPU, memory, Pod limits, pending ARC demand and space for a whole DirectPV work volume. The collector overlaps the two ARC set lists and reads each site’s storage inventory alongside its nodes and Pods. It gives slower online observations six seconds when two cold sites are already available. A removed host counts as exhausted only when ARC also confirms no spare registered runner. Incomplete reads and ambiguous cache-node identities keep the shared CS fallback available. Each group owns one reservation, including on the shared path. This costs one initial child dispatch per group, admission polling and artifact transfer.

Any preflight label older than three minutes is refreshed before dispatch. The first queue recheck is at three minutes for an exact pool and five minutes for the shared label. A group already at its selected site keeps its place during the initial five-minute window. A stalled reservation can then try another CS pool. If only one CS slot remains and the pool previously selected for the sibling shows startup progress, the waiting group can take that slot. The selector retains this hint only for its current reservation. When the startup is at an unrelated pool, Shanghai can serve the overflow group. A lone group prefers available CS capacity. The sibling grant lookup is needed only when it changes the route.

A healthy bound runner gets time to register on a cordoned node or a node with a new NoSchedule taint. Backoff, an unhealthy node and an untolerated NoExecute taint end that protection. After a handoff from an exact CS pool, a replacement with feasible startup demand has up to 30 minutes from its own dispatch before another verified cold slot can take over. A ready alternative can take over at a checkpoint.

Each group can try up to four placements within the original 84-minute queue budget. While another placement is possible, the selector rechecks capacity every five minutes after the initial startup window. A live reservation keeps its place when no alternative is confirmed. On long waits, GitHub assignment polling backs off to one minute with a final check before expiry. A failed-only rerun first confirms that its previous grants are terminal, then takes a fresh capacity snapshot. Selection and waiting for UT completion share the original six-hour hosted job limit. A handoff checks assignment and a current destination before cancellation. A rejected cancellation gets a fresh placement check. Repeated definite rejections keep the current reservation. Slow termination confirmation also refreshes the next destination. The selector rechecks the parent before publishing one grant. A GitHub cooldown resumes on the same reservation and counts against the queue budget. Both sites report the same UT step and support checkout with the workflow token.

Verification

  • On 808163d an isolated selector refreshed a 12-minute-old shared label using live CS inventory. The drill held the job observation at queued, injected one rejected cancellation (HTTP 429, 2-second cooldown), and withdrew the alternative offer. The original cs-mty-nc-n1-pr-v1 worker received the group's only grant. GitHub recorded one child and the sample job succeeded. Selector · CS worker
  • The current Linux suite passed 250 tests with three existing expected failures. In a replay with all 11 CS pools observed, refreshing the old shared decision changed time to grant from 6m30s to 1m30s. Revalidating a rejected cancellation preserved JED and changed 7m30s to 4m30s. The 83 historical assignment samples retained their grant times and GitHub request counts. PR workflow validation
  • On 1f722b1 a live exercise completed two withdrawals and granted the replacement. The isolated harness kept two test reservations queued and supplied a stuck ARC startup observation. It replaced the 30-minute registration window with 120 seconds. GitHub confirmed both cancellations in sequence, then group 1 acquired cs-ruh-nc-n2-pr-v1 and group 0 acquired cs-mty-nc-n1-pr-v1. The replacement was held for 139.3 seconds. Each group published one grant and the two sample coverage profiles merged. GitHub-hosted jobs also queued independently of CS capacity. The inventory job queued for 11m31s and the final merge queued for 24m21s before running for 24 seconds. Controlled handoff · Merged sample
  • On 1f722b1 the isolated MatrixOne Actions run used the exact collector and worker pool checks. Both sampled jobs took real capacity, group 0 on cs-mnl2-nc-n1-pr-v1 in 13 seconds and group 1 on cs-mty-nc-n1-pr-v1 in 10 seconds, measured from job creation to start. The hosted inventory job itself queued for 101 seconds and its collector took 8.83 seconds. Native placement
  • Replayed the observed waits for 83 CS workers from both protected branches (49 main, 34 release) through the selector while withholding capacity evidence. CI main at 51450fb and this revision both admitted all 83. The earlier PR head admitted 70. All 13 waits over 30 minutes eventually passed UT in production. The longest took 58m09s. Production sample
  • With production timers, an unregistered MTY replacement gave way to RUH at 33 minutes. A healthy MTY replacement registering at 22 minutes kept its reservation. A separate replay made RUH available only from minute 31 to 42. The group acquired RUH at minute 35. An assignment at 83m47s still obtained its grant. With a removed host, the collector distinguished confirmed exhaustion, a surviving registration and an unavailable ARC API.
  • On 1f722b1 the Linux scripts suite passed 248 tests with three existing expected failures. An independent allocation check exercised 6,880 two-group decisions. PR workflow validation
  • On 2bdb4ce the isolated Actions run read real capacity in two CS sites. The harness held group 0's grant, forced group 1's first reservation to stay queued and injected the capacity transition using 30- and 60-second checkpoints. Group 1 cancelled its JED reservation, ran on cs-ruh-nc-n0-pr-v1 and received its grant before group 0 dispatched. Group 0 then ran on cs-mty-nc-n1-pr-v1. Each group got one grant and both sample profiles merged. Run · Group 1 · Group 0 · Merged profile
  • With production timers in a controlled Linux replay, group 1 acquired MNL2 at 11 minutes while group 0 took 22 minutes to register on MTY after its handoff. On aee326f the same slow-start replay reached the 30-minute deadline. Two groups already on different single-slot sites both acquired runners at 3m30s in five replays, with zero withdrawals or sibling reads. On aee326f the slower group took 6m30s. Cordoning a healthy node preserved the same four-minute registration. With a third-party startup, the groups used CS and Shanghai when their common pool failed before or after the first checkpoint.
  • On 2bdb4ce the Linux scripts suite passed 244 tests with three existing expected failures. All 165 focused tests passed on macOS. An independent allocation check covered 30,096 first-checkpoint decisions with overlapping or distinct held pools, partial inventories, cold slots and idle runners. PR workflow validation
  • Earlier isolated runs exercised two groups leaving the same JED queue, Shanghai fallback and recovery, delayed assignment and GitHub cooldowns. Full UT Coverage was exercised on both protected caller branches before this revision. Two-site split · Return from Shanghai · Shanghai under contention · Cooldown · Late assignment · main UT · 4.2-dev UT

Rollout

Update the MatrixOne dispatch endpoint on main to the common CI worker and update both protected caller pins. The endpoint must understand exact CS pool labels before the callers start issuing them. The final canary used an isolated MatrixOne branch. Production still uses its current pins.

@Ariznawlll

Copy link
Copy Markdown
Collaborator

我认同 #508 让两组 UT 直接进父流程、去掉子流程派发和轮询的简化。上线前有几个点想确认:

  1. 共享标签的自动接单还没验证。 main 试跑 指定了 MNL2;4.2-dev 试跑 分别指定了 CS 和上海。它们证明 worker 能跑完、覆盖率能回传,但不是只用 matrixone-ut-coverage 自动选池。之前 CS 四站也共用队列,遇到过部分站点资源紧张、其他站点看起来有余量,但任务一直没拿到 runner 的情况;Recover PR UT Coverage when a selected runner pool stalls #508 不按 CPU、内存和工作盘余量选首派池,不能据此认为旧问题已经解决。
  2. 建议补一个 CS 内部的隔离对照。 上海不参与这轮:JED、MTY 忙时,先确认 MNL2 或 RUH 有可用容量,再只用共享标签,不指定站点、不手动重派,确认任务能自动接到、跑完并回传覆盖率。如果还排队,对照同一条 job 的 GitHub 记录和 ARC/Pod 事件,区分是没匹配到池,还是 ARC 收到了需求但 runner 没起来。上海也单独验一轮共享标签的双向接单;另确认是否接受上海从首轮接单,不再只做 1 小时兜底。

如果验收要求是哪里有余量就优先派到哪里,可以继续用 CI #506 这条路线作为备选:派发前并行查四站,最多 15 秒;优先把两组直派到不同的有余量池,只有一个可用池时另一组走共享队列。直派约 30 秒没拿到,先确认原预约已结束再回 CS 共享队列,已分配的组不动,上海 1 小时兜底保留。余量是快照,不是锁定名额;缺数据也不会阻断派发。建议等 #508 的共享标签验通,再决定是否替代 #506 的直派方案。

@XuPeng-SH XuPeng-SH changed the title Use one native UT Coverage queue across CS and Shanghai Select native UT Coverage runners using verified CS capacity Nov 29, 2026
@Ariznawlll

Copy link
Copy Markdown
Collaborator

复审 3c445cc:新版已经能复用在线空闲 runner,也能按已核实的冷容量选择首次派发池。还有一个排队场景需要明确:

[P2] 首派池在容量快照之后失去余量,已排队的组没有自动回退。 选池逻辑会选具体的 scale set;首次运行的 runs-on随之固定。例如一组按快照直派到 MTY n1,但空位被并发任务拿走,或 Pod 已无法调度。即使此时 RUH 能接,该组也不会自动改回共享 CS 标签。查不到容量时的共享队列兜底和失败重跑都不覆盖这个仍在排队的首次 job。

建议加一轮受控验证:先让快照选中 MTY,再让这个临时池接不住,同时保持另一 CS 池可接。明确这一场景是接受继续等或人工重跑,还是要求对尚未分配的组做有界回退;已经开始跑的组应保持不动。上海是否可以在首次派发时接单、不再保留 1 小时兜底,也请作为独立的上线策略确认。

@XuPeng-SH XuPeng-SH changed the title Select native UT Coverage runners using verified CS capacity Recover PR UT Coverage when a selected runner pool stalls Nov 29, 2026
@Ariznawlll

Copy link
Copy Markdown
Collaborator

[P2] 交接时不要撤掉已经分配 runner、但 job 状态还没更新的预约。

在 781c24e 发现,用模拟时钟在 448b5b1 复测仍可复现。容量刷新立即返回另一个可用 CS 池,GitHub Jobs API 返回如下时间线:

  • 180 秒:原预约仍显示 queued,但已经返回匹配原池的 runner_id 和 runner_name。
  • 190 秒:10 秒的状态确认宽限结束,原 job 仍显示 queued。选择器调用 withdraw(),撤掉原预约,再选择替代池。
  • 192 秒:模拟中如果保留原预约,GitHub 会把同一个 job 更新为 in_progress;撤回比这个状态更新早了 2 秒。

本地模拟输出:status_switch_at=192 decision_at=190 selected=52 withdrew=[(51, 190, 'queued', 51)]。对照把状态更新时间提前到 184 秒,原预约在 185 秒获选,未触发撤回。这是模拟复现,没有取消真实任务。

代码在宽限结束后只接受 in_progress,随后会撤回尚未结束的预约。建议把「是否可以发放执行许可」和「是否可以撤回」分开:有匹配的 runner ID 和名称时先保留原预约,在总预算内继续确认状态;只有确认未分配或原预约已结束才换池。请补一条 queued 已有 runner、超过 10 秒才转为 in_progress 的回归测试。

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants