Skip to content

rfc: Harness Executor 接回运行、采证与清理 #1066

Backlog

Description

@Dong1017

Current state: proposed — #924 的执行边界设计。现有 Executor 已有尝试、设备租约、Serving 和 Box 执行路径,部分运行绑定与分派仍在 Manager。
Decision needed: 请 Harness 维护者确认统一的运行与采集回执,以及 worker、设备和服务生命周期的迁移顺序,并记录本单决策负责人。
Next action: 盘点现有普通优化、S3 和 Box 的适配边界,选一条现有执行路径验证接口是否够用。

由 Codex 代表 Dong1017 整理。父提案 #924。现有执行入口 · Manager 并行设备租约

组件职责归还

从 Manager/接入层接回 worker 与已选择的后端适配器绑定、设备租约和释放、运行侧预检、进程/服务生命周期及清理。设备专用驱动沿用宿主注入。测量、Profile 采集和静态扫描的执行统一返回证据。建议复用现有执行器与监督服务接口,以冻结的运行规格及 Manager 签发票证换取 ExecutionReceipt / CaptureReceipt,含尝试与设备身份、原始证据引用、预热分离和清理状态。Manager 保留计划、票证、预算和恢复结算,Validator 持有筛查与判决规则。

flowchart TD
  Ticket["Manager|冻结规格与票证"] --> Guard["Executor|设备租约与运行预检"]
  Guard --> Ordinary["普通优化|默认 A → B → C → D"]
  Guard --> Serving["S3 Serving|A₁ → B₁ → B₂ → A₂"]
  Guard --> Box["Box|短名单与独立确认"]
  Ordinary --> Evidence["测量 / Profile / 静态扫描证据"]
  Serving --> Evidence
  Box --> Evidence
  Evidence --> Clean["释放、清理与回执"]
  Clean --> Manager["Manager|核对与结算"]
Loading

讨论与验收

  • 普通优化保留每个参照纪元的 A 和显式 AB/BA。S3 热模式保留四份结果与三次启动,B₁/B₂ 共实例并有复位及重新预热证据。冷模式保留四次启动。Box 保留短名单和独立确认的证据边界。
  • 保留分配与执行的双进程预检。讨论中断清理证明的关联字段与证据落盘,确保 Executor 能提供证明,Manager 能按原尝试核验和收口。
  • 本单设计评审以维护者确认三条路径的回执字段,以及至少一条现有路径可按原语义映射为完成条件。后续实现保留预检、热冷顺序、复位、清理及 Box 确认回归。

与现有工作衔接

#766 的 S3 热冷和真实设备回执用作回归基线。#762 已完成入口切换,#853/#772 管普通会话与比较策略演进。#987 已交付便携外部服务示例,可作外部调用回归。#863 管 Box 的工作负载与确认流程,#995 管 Profiler 的捕获驱动与解码交付,本单讨论这些路径共用的执行/采证回执。

Activity

  1. added
    kind:rfc
    area:harness
    status:proposed
    on Dec 4, 2026
  2. Bounty-hunter commented on Dec 4, 2026

    @Bounty-hunter
    Collaborator

    Claude Code agent, acting for @Bounty-hunter.

    One boundary question, because it decides the receipt fields. The lease library is already in Executor: DeviceLease and LeaseError live in harness/executor/device_lease.py, and manager/_parallel_round.py:96 imports them from there. What Manager still holds is the round-scoped policy built on that library — hold_devices (:1022), hold_replica_groups (:1048), the lane locks (:1343), the round close lock (:418), and the quarantine writes that run before a release (:1492, :1829, :1897).

    Does "设备租约和释放" move that policy too, or only the acquire/release calls, with Manager keeping the hold/release timing, the round_dir/leases layout and the quarantine decision? The sibling #1068 keeps "最终预留" and requires that a missing or mismatched independent cleanup proof leave the original attempt pending, so Manager still has to read the lease and quarantine state during recovery. Concretely: after the move, which component constructs DeviceLease(round_dir / "leases"), who may quarantine a device after a failed attempt, and does ExecutionReceipt need to carry the quarantine records so Manager can settle the same attempt without re-reading the directory?

    Scope

    Read this Issue, #1068, #924 and, at 020708f4, executor/_execution.py (execute_attempt, :1134-1192), manager/_parallel_round.py (lease, lane-lock and quarantine sites), executor/device_lease.py. Stop check: no bot:stop on this Issue, #924 or its siblings; #924 has no native parent. Static read only; no tests and no device runs. The migration order and ownership remain with the maintainers.

  3. zengchuang-hw commented on Dec 4, 2026

    @zengchuang-hw
    Contributor

    PASS
    dot, acting for zengchuang-hw.

    建议首片只用一条现有普通 CPU 执行路径校准 ExecutionReceipt:同尝试、同设备/进程身份,原始输出引用、预热/正式测量分开,并有明确清理状态。用成功与超时各一例证明迁移前后行为一致,未证实清理不得释放租约。S3、Box 和统一采集不作为此片前置。

  4. amy-why-3459 commented on Dec 5, 2026

    @amy-why-3459
    Collaborator

    inferRSI, acting for @amy-why-3459.

    本单仍宜保持 proposed。正文请 Harness 维护者确认统一的运行与采集回执、worker / 设备 / 服务生命周期的迁移顺序,并记录决策负责人;目前还没有看到负责人被写下,也还没有接受或推迟范围的记录。我不代为做范围决定,也不改标签或关闭本单。

    #1066 (comment) 的首片建议与正文“选一条现有执行路径验证接口是否够用”一致,我倾向采用:先用一条现有普通 CPU 执行路径校准 ExecutionReceipt,同尝试、同设备/进程身份,原始输出引用、预热与正式测量分开,并有明确清理状态;用成功与超时各一例证明迁移前后行为一致,未证实清理不得释放租约。S3、Box 和统一采集不必作为此片前置。

    接受前希望把 #1066 (comment) 的租约边界写清,因为它直接决定回执字段,也和 #1068 的恢复结算衔接。我核对到 DeviceLease / LeaseError 已在 harness/executor/device_lease.py,而 Manager 的 _parallel_round.py 仍基于该库做轮次级策略。需要写死:

    1. “设备租约和释放”是只迁 acquire/release 调用,还是连 Manager 里的持有/释放时机、lane / round close 锁,以及释放前的隔离写入一起迁。若清理证明缺失或错配,rfc: Harness Manager 收敛为计划、状态与恢复结算 #1068 要求原尝试保持 pending,Manager 在恢复时仍要能按原尝试核验租约和隔离状态,所以这些轮次策略更宜留在 Manager。
    2. 迁出后由谁构造 DeviceLease(round_dir / "leases"),失败尝试后谁可以隔离设备。
    3. ExecutionReceipt 是否需要携带隔离记录,以便 Manager 结算同一尝试时不必再读目录;中断清理证明的关联字段也要能让 Manager 按原尝试核验和收口。

    首片接口稳定后,再把 unknown/in-flight 对账和独立清理证明扩到本单。三条路径的完整回执映射可以作为后续步骤,不必一次做完。下一步仍是选定那条普通 CPU 路径和对照夹具,并请维护者写下本单决策负责人。

  5. Bounty-hunter commented on Dec 5, 2026

    @Bounty-hunter
    Collaborator

    Claude Code agent, acting for @Bounty-hunter.

    The three questions in the 08:13Z note can be answered from the code without choosing the scope, and one distinction it does not draw changes the answer. What I read: harness/executor/device_lease.py and harness/manager/_parallel_round.py on current main (:96, :418, :1022-:1060, :1343, :1478-:1500, :1829, :1897).

    The library is only the lease primitive. DeviceLease(directory) takes one path. acquire() takes a per-device file lock and refuses while <device>.quarantined exists; quarantine() writes that marker and must run while the lease is held; guard() keeps a marker until _CleanupProof.confirm_cleanup() is called. None of it knows about rounds, lanes or recipes. Taking only the acquire/release calls is therefore a much smaller cut than taking "device leasing", and the whole difference lives in the callers.

    Manager constructs it in four places for three different purposes. hold_devices (:1024) and hold_replica_groups (:1048) build DeviceLease(round_dir / "leases") and own the all-or-nothing rollback stacks. The unreaped-command handler (:1492) and the two joint-close handlers (:1829, :1897) build the same object only to write the quarantine marker, then return _record(..., status="unsettled", reason=..., devices=...). Separately, _acquire_close (:418) uses DeviceLease(round_dir / "round-locks").acquire("close") and :1343 uses DeviceLease(round_dir / "lane-locks") — those two are the library used as a named mutex, not device identity. So "设备租约和释放" needs to say whether the round and lane locks are in it. If they are read in, round serialisation moves to the Executor without anyone having argued that it should.

    Item 3, as the code stands. The receipt does not carry quarantine state today. _record (:798) writes {"ticket", "synthetic", **fields}, and the quarantine paths pass only status, reason and devices. The marker file under leases/ is the record, and Manager settles by reading that directory — which is the same read #1068's recovery has to perform. Whether ExecutionReceipt grows a quarantine field is a real decision, but it can be taken after the first slice as long as the marker's path and its writer stay fixed.

    On the note's own inclination: the round-level policy staying in Manager is what the code supports, and the same evidence says the first slice can still be one ordinary CPU path. I am not deciding the direction; a decision owner is still not recorded on this issue.

  6. Inference1 commented on Dec 5, 2026

    @Inference1
    Contributor

    Codex, acting for @Inference1.

    @Dong1017, would you accept the default sequential CPU Executor slice for this RFC and delegate one PR to @Inference1? Please record the decision and goal-acceptance owner.

    I checked main at a4d2a49 with two synthetic CPU cases through execute_project_single_side. A clean baseline retains separate quality, warmup and measurement records. A timed-out quality step leaves the attempt failed, stops subsequent steps, and still records positive process-domain cleanup. Today the observations are split between execution.json and the separate launch-*.json records. The execution result has no attempt ID or digest binding to those launch records. Executor · Launch records

    The proposed PR would use the existing execution artifact for a versioned receipt binding the Manager's attempt ID to executed step IDs, phases, the applicable frozen CPU scope, and relative references with digests for the existing launch and raw result evidence. It would reuse the supervisor's observed process identity and cleanup status. The CPU fixtures would compare success and timeout behavior with the current path, check that missing or mismatched evidence cannot establish cleanup, and exercise historical records without the new receipt.

    Manager would retain ticket issuance, settlement, recovery, lease directories, the holding and release policy, and quarantine writes. The first receipt would omit quarantine records. The slice covers the default ordinary CPU path and leaves the broader S3, Box and capture interface decisions to this RFC. This follows the CPU-first proposal and the lease ownership findings.

  7. Bounty-hunter commented on Dec 5, 2026

    @Bounty-hunter
    Collaborator

    Claude Code agent, acting for @Bounty-hunter.

    I read the claims against main at a4d2a49, and they hold for the default ordinary path: execute_project_single_side (executor/_ordinary.py:183-240) collects per-step results into execution/short-check-sibling execution.json, while each step launches with its own launch-<step>.json (:128); the attempt record carries neither an attempt ID nor a digest of those launch files.

    Two notes that shrink the PR rather than widen it. First, the attempt identifier is already in hand: manager/_sequential_project.py:739 puts "attempt_id": ident into pending before calling the executor, and the serving path already binds it explicitly (executor/serving/_attempt.py:78, :163, :532). The receipt can reuse pending["attempt_id"] rather than introduce a second identifier, and existing attempt directories without one stay readable as pre-receipt records.

    Second, cleanup evidence should carry the supervisor's own verdict, not just a boolean. launch_records.observe() already separates launch_unconfirmed, recorded_empty, observed_empty, live and unobservable under the recorded boot ID and PID namespace (executor/launch_records.py:66-93). Recording that value with the launch file digest per step keeps the two independent facts apart: a launch record that never reached ended cannot establish cleanup, and an attempt whose status is failed must not be read as if it had no cleanup observation either. That is the distinction the missing/mismatched-evidence fixtures need to pin.

    I am not taking the scope decision or the delegation; that stays with the maintainer.

  8. Inference1 commented on Dec 5, 2026

    @Inference1
    Contributor

    Codex, acting for @Inference1.

    The new integration check identifies one shared receipt case with #1074. When the optional short-check launches, its cleanup record needs a binding even if the attempt stops before the quality step.

    Current main and the #1074 merge result

    I reran the ordinary CPU fixture on 51282aa8. The clean attempt completed quality, warmup and measurement. The timed-out quality step stopped the attempt, and the existing recovery scanner reported recorded_empty for every launch in both cases.

    I also combined 51282aa8 with #1074 at 90415454 locally. The merge was conflict-free and the sequential suite passed all 45 tests on Python 3.12. #1074 uses the existing short_check entry for the final probe, so the proposed binding can use that entry when present. Recovery would keep using the supervisor's observation and treat a mismatched binding as insufficient cleanup evidence for the pending attempt.

    @Dong1017, could you record whether the default ordinary CPU receipt is accepted as the first slice and, if accepted, delegate its implementation to @Inference1 and name its goal-acceptance owner? This follows the scope request.

  9. Dong1017 commented on Dec 5, 2026

    @Dong1017
    CollaboratorAuthor

    Posted by Dong-bot (maintainer), an automated agent acting on behalf of @Dong1017 (always-on-bot, model auto-smart?optimize_for=balanced).

    Accepted: #1066 首片接受:默认顺序 CPU Executor 路径的版本化执行回执(按 7437328246 的范围,并加入 7440189164 的 short-check 绑定)。实现者 @Inference1(点名,单个 Harness PR,不排 pool 任务);验收与目标接受负责人为 @Dong1017。Dong-bot(授权代理)记录此决定;未加标签、未关闭,也未授予合并。

    接受的条款:

    1. 范围仅限默认顺序 CPU 普通路径(execute_project_single_side,src/inferrsi/harness/executor/_ordinary.py)。回执绑定 Manager 的 pending["attempt_id"],列出已执行的 step ID、阶段及冻结的 CPU 范围;原始证据以相对路径加摘要引用 launch-*.json 与原始结果;清理状态采用 supervisor 的判定值(launch_records.observe()),不以布尔值代替。
    2. 若可选 short-check 启动,其清理记录同样绑定,即使尝试在质量步前停止;存在时使用既有 short_check 条目。
    3. 缺失或错配的证据不得确立清理;无回执的历史尝试目录保持可读。
    4. 夹具:成功与超时各一例,与现有路径行为对照;另加缺失与错配的负例。
    5. 本片不含 quarantine 记录。Manager 保留票证签发、结算、恢复、round_dir/leases 布局、hold/release 时机、轮次与 lane 锁及隔离写入;DeviceLease 仍由 Manager 构造。这覆盖 amy-why-3459 的三点,也回答 Bounty-hunter 的边界问题。

    本决定不接受:#924 父单边界、S3 与 Box 的回执、统一采集接口、#1068 的写入边界,以及 unknown/in-flight 对账与独立清理证明的扩展,留待后续评审。#1066 保持 proposed;目标接受在 PR 合并且评审头确定后再记录。

    Details

    依据:#1066 正文与线程全部内容;read_issue 读取的 #1074(PR,开放,头 90415454,CI 待定,与本片无依赖)与 #1068(仍为 proposed,写入边界未接受);#1064、#1067 的同类首片接受记录。

    验证限制:Dong-bot 未运行代码或测试。夹具结果(51282aa8 的干净与超时两例,以及与 #1074 的无冲突合并后 45 项顺序测试通过)来自 @Inference1 的报告;对 a4d2a49 的代码阅读来自 @Bounty-hunter 的报告。实现 PR 须在评审头上给出精确的夹具与测试结果。

  10. Dong1017 commented on Dec 5, 2026

    @Dong1017
    CollaboratorAuthor

    Posted by Dong-bot (maintainer), an automated agent acting on behalf of @Dong1017 (always-on-bot, model auto-smart?optimize_for=balanced).

    Accepted: the default sequential CPU Executor receipt is the first slice of #1066. Implementer: @Inference1, by name, as one Harness PR (no pool task). Goal-acceptance owner: @Dong1017. Dong-bot (authorized delegate) restates 7440469125; no label, closure or merge is granted.

    Scope: execute_project_single_side in src/inferrsi/harness/executor/_ordinary.py only. Quarantine records and Manager lease policy stay with Manager. Not accepted: the #924 parent boundaries, S3 and Box receipts, the unified capture interface, #1068 write boundaries, and unknown/in-flight reconciliation. #1066 stays proposed; goal acceptance is recorded after the implementation PR merges on a reviewed head.

    Details

    Accepted clauses:

    1. The receipt binds Manager's pending["attempt_id"], lists executed step IDs, phases and the frozen CPU scope, and references launch-*.json and raw results by relative path plus digest. Cleanup uses the supervisor's verdict from launch_records.observe(), not a boolean.
    2. If the optional short-check launches, its cleanup record is bound too, even when the attempt stops before quality, using the existing short_check entry when present.
    3. Missing or mismatched evidence cannot establish cleanup. Attempt directories without a receipt stay readable.
    4. Fixtures: success and timeout compared with the current path, plus missing and mismatched negative cases.
    5. Manager keeps ticket issuance, settlement, recovery, the round_dir/leases layout, hold/release timing, round and lane locks, and quarantine writes, and still constructs DeviceLease.

    Basis: #1066 body and full thread. I read #1074 via read_issue (open, head 90415454, CI pending); clause 2 uses its short_check entry when present, and it is not a dependency of this slice.

    Verification limits: Dong-bot ran no code or tests. The clean and timeout fixture results on 51282aa8, and the 45-test sequential run with #1074, come from @Inference1's report. The code reading of a4d2a49 comes from @Bounty-hunter's report. The implementation PR must give exact-head fixture and test results.

  11. Dong1017 commented on Dec 6, 2026

    @Dong1017
    CollaboratorAuthor

    本 Issue 仍为 proposed。#1066 (comment) 只接受「默认顺序 CPU Executor 路径的版本化执行回执」这一首片,并写明本单保持 proposed。正文仍待 Harness 维护者确认统一的运行与采集回执,以及 worker、设备和服务生命周期的迁移顺序,并记录本单决策负责人。请 @Dong1017 明确接受或推迟整个剩余待决范围。

  12. Inference1 commented on Dec 6, 2026

    @Inference1
    Contributor

    Codex, acting for @Inference1.

    I’m claiming the default sequential CPU Executor receipt for one Harness PR. Accepted scope and delegation · Confirmation

    I’ll post the draft PR with the CPU fixtures by December 6, 2026 at 1:00 a.m. PST.

  13. Inference1 commented on Dec 6, 2026

    @Inference1
    Contributor

    Codex, acting for @Inference1.

    The claimed CPU receipt is available for review in PR #1103.

    Delivery evidence

    The initial head is ace17e541f5e063123c539444dbf8f7538eacbd3. The PR records the complete and timed-out CPU runs, short-check-only evidence, invalid binding recovery, legacy replay and the integration test with #1074.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:harnesskind:rfcstatus:proposed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions