Repository navigation
fix(harness): preserve evaluation limits and replay original attempts (PR-3) - #564
Conversation
Adapt the authorized pool draft and freeze the null-timeout binding vector. Agent-assisted-by: Codex (author) Signed-off-by: zengchuang <zengchuang3@huawei.com>
Verify candidate and worker declarations against fixed preparation bytes. Preserve ordinary command behavior and leave evaluation startup disabled until entry verification is implemented. Agent-assisted-by: Codex (author) Agent-assisted-by: Unknown PR Pool agent (draft contributor) Signed-off-by: zengchuang <zengchuang3@huawei.com>
Agent-assisted-by: Codex (author) Signed-off-by: zengchuang <zengchuang3@huawei.com>
Resolve standalone source entries under an explicit trusted root without imports. Retain the actual bytes and digest and preserve existing snapshots. Agent-assisted-by: Codex (author) Signed-off-by: zengchuang <zengchuang3@huawei.com>
Capture the configured standalone source entry after registration, retain observed code identity, and commit fixed zero-start refusals for missing or mismatching bytes. Execute matching entries from their retained source snapshot. Agent-assisted-by: Codex (author) Signed-off-by: zengchuang <zengchuang3@huawei.com>
Clarify mismatch argv and the single-step source target. Refresh the binding-vector guide and assert unstarted step facts alongside the resolved command. Agent-assisted-by: Codex (author) Signed-off-by: zengchuang <zengchuang3@huawei.com>
Apply existing attempt state and digest conflicts before fresh preparation IO or target support checks. Snapshot the saved request before host callbacks and preserve original records without new registration or execution. Agent-assisted-by: Codex (author) Signed-off-by: zengchuang <zengchuang3@huawei.com>
Intercept the supervisor used by Harness rather than the legacy execution wrapper in zero-start binding tests. Agent-assisted-by: Codex (author) Signed-off-by: zengchuang <zengchuang3@huawei.com>
Carry the corrected pre-registration guard and intercept the real Harness supervisor for T37 refusals. Positive controls observe a real process ID at the same boundary. Agent-assisted-by: Codex (author) Signed-off-by: zengchuang <zengchuang3@huawei.com>
Stop known expired or cancelled evaluation requests before source capture. Cover real null-timeout expiry, cancellation and descendant cleanup, durable cross-process replay, live owners, commit failure and registration races. Agent-assisted-by: Codex (author) Signed-off-by: zengchuang <zengchuang3@huawei.com>
Agent-assisted-by: Codex (author) Signed-off-by: zengchuang <zengchuang3@huawei.com>
Dong1017
left a comment
There was a problem hiding this comment.
LGTM
PR review verdict — PASS
Reviewed base 15f1703 and head d34a045. This is a full main-target diff, so it includes the unmerged #561/#562 units. No formal reviews are seeded for this head and there is no outstanding CHANGES_REQUESTED.
Status of this vote. It comes from Dong-bot (authorized delegate) on Dong1017's queue. The PR body names Dong as the accountable Harness parent, so this is a technical check. It is not an independent vote and should not count toward the two required independent write+ approvals.
Verified by reading the diff and the surrounding code
- Replay ordering.
execution_service.executeruns_validate_fieldsand then snapshots the spec withcopy.deepcopy. It computes the digest and callsstore._reenter_if_registered. Only after that does it run_validate_fresh(preparation read, target support), thenstore.claim._reenter_if_registeredselects on the samerequest_idcolumn thatclaimuses. It reuses_reenter, so the digest-first table is identical: RequestConflict, finished record, AttemptInProgress, RecoveryRequired.- The lookup registers nothing. The atomic
claimafter the preparation read still arbitrates a registration race, andtest_registration_race_after_lookup_still_uses_the_atomic_claimexercises that path. - Lookup failures raise
ExecutionPersistenceErrorwithstarted=None, so no start state is invented.
- Pre-registration binding.
prepared_binding.readbounds reads tosize+1bytes, closes the stream, re-checks size and sha256, and passesdict(ref)to the reader.projectandverifyuse exact field sets and refuse unknown rule revisions. Malformed bindings raise beforeclaim, which the tests assert by checking the store is empty. - Source entry (T37).
entry_code.capture_moduleaccepts only[A-Za-z_]\w*module names. It opens throughopen_regular, which rejects symlinks and paths outside the root. It never imports the module, refuses to overwrite an existing snapshot, and re-hashes the copy.- A matching entry runs as
python -I -B <captured path>, so the workspace,PYTHONPATHand later edits to the origin cannot replace the bound code. - A mismatch or an unavailable entry produces a fixed
not_startedrecord, withentry_code_identityset tofailedornot_performed. The mismatch record references the observed bytes. No process is launched. - A capture write failure raises
_RetentionFailure, which becomesExecutionPersistenceErrorwithstarted=False.
- A matching entry runs as
- Limits and budget. Evaluation checks cancellation and the deadline before source capture. The absolute deadline is used when
timeout_secondsis null (bound = deadline)._budgetis unchanged and still rejects policy, dimension and enforcement requests before binding. Replay never re-admits a budget. - Ordinary mode.
- Ordinary-mode
_argvis unchanged and records no code digest. - The ordinary runtime bindings are still recorded only for launched steps.
_step_errorsstill requires a nullexpected_code_sha256in ordinary mode and a non-null one in evaluation (V32).- The
test_harness_execute.pyexpectation change toInvalidExecutionSpecfollows from that V32 rule.
- Ordinary-mode
- Tests and packaging.
- The tests intercept the real
local_process._superviseand use a positive control with real PIDs. - They cover completed and refused replay after the source is repaired or the target is retired.
- They cover digest conflicts, a live owner, an abandoned owner, and commit failure after a real start.
- They cover null-timeout expiry, caller cancellation with a descendant, a fresh-process replay and a registration race.
check_installed.pyand theNEW_H_CLOSUREupdate keep the new modules free of Apps and Benchmark imports.- The docs and the migration JSON are consistent with the new test files. I checked the
consumersregistration by readingtest_apps_module_migrations.py, not by running it.
- The tests intercept the real
Not verified here
- I did not execute any tests, and current-head CI had not completed per the PR body. The author's reported counts (111 core tests; 297 passed, 2 POSIX-only skips on Windows) are unverified.
- The process-domain and null-timeout cases depend on the supervisor fixes in #562 and the separate #552 launch-boundary fix. I did not audit those here.
- Two items are optional follow-ups, not blockers. First,
_capture_inputstill hands the readeritem["source_ref"]from the internalctx.spec. That is pre-existing and not covered by the new snapshot-isolation claim. Second, the merge order is #561 → #562 → #564, so this PR needs a re-sync and green current-head CI before squash.
I will re-read if the author pushes after a rebase onto the integrated dependencies.
Posted by Dong-bot, an automated agent acting on behalf of @Dong1017 (always-on-bot, model claude-sonnet-5-5).
amy-why-3459
left a comment
There was a problem hiding this comment.
LGTM
PR review verdict — PASS
Reviewed increment 73c30b8...d34a045 (PR-3 unit on the current #562 head). The main-target base is 15f1703 and the head is d34a045; that full diff still includes the unmerged #561/#562 units already reviewed on those heads. Immediately before this vote I re-fetched the PR reviews and comments: the only formal review on this head is Dong1017 APPROVED (6005639524), which the review itself marks as a non-independent parent technical check. There is no CHANGES_REQUESTED or other blocking comment.
Verified by reading the increment and the surrounding execute / RunStore paths:
- Static field checks run first; the request is snapshotted before reentry, preparation IO, budget admission, source binding or a worker start.
_reenter_if_registeredreuses the existing digest-first_reentertable and does not register or refresh an attempt. A finished record returns the original RecordRef; a digest mismatch is RequestConflict; a live owner is AttemptInProgress; an unfinished attempt with no owner is RecoveryRequired. Lookup failures are ExecutionPersistenceError withstarted=None.- Fresh preparation and target-support checks still precede
claim. The atomic claim remains the registration-race arbitrator, as covered bytest_registration_race_after_lookup_still_uses_the_atomic_claim. - Reentry does not re-admit a budget, reset the clock, open preparation, capture entry code or call
_supervise. Replay coverage includes a repaired or missing source, a retired target, and a fresh controller without the original archive or reader. - Fresh evaluation requests keep the original absolute deadline when
timeout_secondsis null (bound = deadline). Known expiry or cancellation is refused before source capture; mid-run expiry and caller cancellation reuse the process-domain supervisor and keep cleanup and lease-release facts separate. - The documented rejection of unsupported budget policy, dimensions or enforcement is the existing
_budgetpath on a fresh claim, not a new admission model. Replay never re-enters that path. - Ordinary-mode field rules and
_argvare unchanged; the evaluation-only pre-capture limit checks do not change ordinary launch ordering.
Ready lint-and-smoke, installed-package (3.10/3.11), declarations, pr-references, dashboard-browser and advisory host-compatibility have passed on this head. full-check (3.10 and 3.11) is still in progress (https://github.com/InferMatrixLab/InferRSI/actions/runs/44910395728). I did not run the tests locally. Merge should wait for green current-head Ready CI, the #561 → #562 → #564 integration order, a re-sync plus a second independent write+ LGTM on the synced head, and the separate #552 launch-boundary fix before whole CPU acceptance. This vote does not close #429 or #371.
|
当前 @david6666666 请与 Amy 一起完成独立检视,有意见先处理。#561 → #562 的前置合入后仍要同步并复核最终头;#552 继续由 Inference1 修复。新 #565 已被 owner 作为单独生产证据桥接任务接受,不混入本 PR,不把当前源代码小用例等同于完整生产验收。 |
There was a problem hiding this comment.
LGTM
PR review verdict — PASS
Reviewed base 15f17037afb6a57a7a51348f73979f81f5e0721f and head d34a0451f0d4edd76c604632b44d673f4f5d43ae.
Identity: cursor[bot] independent third-party / technical verify only (collaborator permission none). Not write+ / dual-tip / merge-ready. Stacked on #561/#562 (+ #552 launch-boundary prerequisite per PR body); resync after those land before squash.
Clean-code / repo style: PASS
- Replay path splits cleanly:
_validate_fields→ digest →_reenter_if_registered(no registration) →_validate_fresh→ atomicclaim; deepcopy snapshot isolates later host mutation of the caller's mapping. - Deadline/cancel checks precede entry capture on evaluation; null
timeout_secondsuses absolute deadline; budget still refused before binding and never re-admitted on replay. run_store._reenter_if_registeredreuses_reenterdigest table; lookup faults map toExecutionPersistenceErrorwithstarted=None(no invented start state).- Ordinary mode argv/runtime binding behavior preserved; evaluation fields retained in fixed records. Tests cover completed/refused replay, races, null-timeout, and supervisor boundary. Layering/migrations/
check_installedremain consistent with prior units.
Verified: tip Dong1017 + amy Approves; Ready green. Read tip delta (execute/_validate_*, _reenter_if_registered, evaluation-replay tests) — not CI alone.
jiangkuaixue123
left a comment
There was a problem hiding this comment.
这不是 Approve。#562 仍是前置条件,还没有进入 main。
我检视的是正文声明的 PR-3 增量:838607925faeede9d83db395e7f9038b75511c3b → a1bff61b01af926b7a1881bd526a4c35775c84fe,9 个文件、+499/−23,与声明一致。当前头仍是 a1bff61b01af926b7a1881bd526a4c35775c84fe,已经和 #562 的 83860792 对齐。针对 main 的完整 diff 仍混有未合入的 #562(15 个文件、+1001/−48),所以现在不能把「对 main 的差异」当成这一份增量来批准。
这组增量做的是:再次提交一份已保存的评估请求时,先查已有状态,再去打开准备产物、占用预算或绑定目标。已经完成或已被拒绝的尝试,直接返回原来那份固定 RecordRef(固定记录的引用);摘要变了就是冲突;还活着的所有者不会被隐式接着跑;新的评估请求保留原来的绝对截止时间和预算,包括步骤超时为空的情况。
在这份隔离增量里,我没有发现影响正确性、安全或所声称行为的问题:
execute先做静态字段检查并快照请求,再调用RunStore._reenter_if_registered(不登记、不改钟、不重新占用预算),然后才做新鲜的准备检查和原子claim。查找失败是ExecutionPersistenceError,started=None,不会编造启动状态。- 已完成的正向结果和 T37 拒绝记录都会被回放;事后修好或删掉源文件、或把当前目标换成已退役的,都不会变成一次新的执行。测试覆盖了这些路径,以及跨进程回放。
- 摘要变化(截止时间、预算范围、准备引用)在做产物 IO 之前就是
RequestConflict。还活着的所有者是AttemptInProgress;所有者没了,或启动后提交失败且没有记录,是RecoveryRequired,不会偷偷重跑。 - 评估请求在抓源文件前先看取消和绝对期限。
timeout_seconds为空时,步骤边界仍是整次尝试的期限(bound = deadline);这是已合入的 #552 行为,本增量保留。不支持的预算策略在绑定工人前拒绝,回放不会再做一次 admission(准入/占预算)。 - 查找之后、准备读取期间若另有调用方完成登记,仍由原子
claim裁决;test_registration_race_after_lookup_still_uses_the_atomic_claim覆盖了这条路径。
当前头 Ready CI 45029500358 已成功。我是读隔离增量和周围代码检视的,没有在本机重跑测试。
请先等 #562 进入 main,再同步最终头、跑最终头检查,并在干净的最终头上重新求两份独立批准。我核对时 main 也已比同步点多了 #579,与本增量文件没有交集,但最终头仍应再对齐一次。Dong 已开启 squash 自动合入;在完成上述同步之前,我不会在这个头上点 Approve,以免提前满足合入条件。
|
@jiangkuaixue123 请加入当前 @amy-why-3459 @david6666666 原有独立请求仍有效。Root 是作者,Dong 是负责 Harness 的父责任人,均不计独立票。#562 真正入 main 后仍须同步主线、刷新最终头验证/CI/独立检视;本次检视不表示前置依赖满足,不将未合入的开发栈当作生产验收。 |
|
@Dong1017 刚核实并取消了你先前开启的 squash 自动合入:原生 API 现在 本 PR 必须先 #562 真正入 main,再同步、刷新新头 CI 与两份合格独立检视。原生通用两票队列不能表达这些前置依赖及 author/parent 排除条件,故继续由 integrator 在全部实际条件满足后立即 squash。现有 Jiang 6013174474 是明确的 COMMENT-only 增量检视,不计 Approve;已接受他先等实际主线再最终批准的结论。当前不要求提前批准,也不再开启会提前触发的自动队列。 |
Refs #429 and #564. Agent-assisted-by: Codex (author/integrator) Signed-off-by: zengchuang <zengchuang3@huawei.com> # Conflicts: # docs/contracts/harness-entry-verification.md # docs/contracts/harness-prepared-binding.md # docs/operations.md # src/inferrsi/harness/execution_service.py # tests/fixtures/harness-prepared-binding/README.md # tests/test_harness_entry_verification.py
|
@jiangkuaixue123 @david6666666 @amy-why-3459 @linyueqian @hsliuustc0106 前置 #562 已实际进入 main,现已完成同步并推送新头 |
jiangkuaixue123
left a comment
There was a problem hiding this comment.
LGTM
结论:Approve(当前头 e0eb7eea)
身份:jiangkuaixue123;由 InferRSI 动态推送例程代交独立检视。检视对象是已同步实际 main(53251477,前置 #562 已合入)后的限定 PR-3 增量:9 文件 / +499 −23。旧头上的 COMMENT(#6013174474)不再适用。
改了什么
这次改的是「评估模式」(evaluation:带固定准备引用的执行请求)在 Harness(本地执行编排器)里的重入/回放路径:
- 先静态字段检查,再查已有登记,最后才读准备产物
execute把校验拆成_validate_fields(只看请求形状)和_validate_fresh(读固定准备字节、核对目标是否支持)。中间用RunStore._reenter_if_registered按同一套 digest/状态表回放,不登记、不刷新时钟/预算。 - 已完成或已拒绝的尝试 直接返回原来的固定
RecordRef(记录引用),即使源文件被修好/删掉、目标已退役,也不会再绑源、再占预算、再起工人。 - digest 变了(截止时间、预算范围、准备引用等)→ 在产物 IO 前就是
RequestConflict。
还活着的所有者 →AttemptInProgress;所有者没了或启动后提交失败且无记录 →RecoveryRequired,不会偷偷重跑。 - 期限与取消
timeout_seconds为空时,步骤边界仍是整次尝试的绝对期限(bound = deadline,保留 #552 行为)。评估路径在抓源文件前先看取消和期限;拒绝记录通过_cancellation如实记下「调用方取消」。不支持的预算策略仍在绑工人前拒绝,回放不会再做 admission。 - 并发
查找之后、准备读取期间若另有调用方完成登记,仍由原子claim裁决;测试test_registration_race_after_lookup_still_uses_the_atomic_claim覆盖了这条路径。调用方在准备读取期间改写请求对象也不会改已快照的 digest(deepcopy)。
契约文档 harness-evaluation-replay.md 与相邻合同/操作说明的交叉引用与上述行为一致;新增 tests/test_harness_evaluation_replay.py 覆盖完成/拒绝回放、digest 冲突、活所有者/所有者消失、真实运行中回放与取消、空超时期限、抓源前拒绝、跨进程回放与登记竞态等。
问题与风险
未发现影响正确性、安全或声明行为的实质缺陷。
非阻塞小建议:
execution_service.py文件头仍写「evaluation replay/limit acceptance are later slices」,本 PR 落地后可顺手改成已交付本切片,避免读者误判范围。- 契约已写明:完整 CPU 验收仍依赖独立的 launch-boundary 交付;本票按 PR-3 边界 Approve,不把整 Issue 生产验收算在这里。
审查时 required CI 中 lint/installed-package/declarations 等已绿,full-check 仍在跑;合入前请确认当前头 CI 全绿。本票不合并。
Dong1017
left a comment
There was a problem hiding this comment.
LGTM
Posted by Dong-bot, an automated agent acting on behalf of @Dong1017 (always-on-bot, model claude-sonnet-5-5).
PR review verdict — PASS
Reviewed base 5325147786d0b5bb2b78b3f7ce461c6289c26b2e and head e0eb7eea81204f60b570c7b8565fafefc8391c64. The diff is the nine-file / +499 −23 main-target increment, and diffComplete is true. Earlier approvals on the older heads (d34a0451, a1bff61b) are not inherited.
Status of this vote. This comes from Dong-bot (authorized delegate) on Dong1017's queue. Dong1017 is the accountable Harness parent, so this is a technical check, not an independent vote. It does not count toward the two required independent write+ current-head approvals, per my earlier #550/#552/#585 decisions. The only independent Approve on this head in the seeded record is @jiangkuaixue123 (e0eb7eea). A second distinct independent LGTM and green required CI are still needed before squash.
Verified by reading the diff and execution_service.py / run_store.py at the head
- Ordering in
execute(execution_service.py ~1078–1089)._validate_fieldsruns first. It covers the schema version and static fields, and does no artifact IO.- The spec is then snapshotted with
copy.deepcopy(dict(spec)), and the digest and attempt are taken from the snapshot. store._reenter_if_registeredruns next, and only after it do_validate_fresh(preparation read, target support) andstore.claim.- A finished record is returned through
flattenwithout any preparation read, target resolution or worker launch.
RunStore._reenter_if_registered(run_store.py ~1070–1096).- It selects on the same
request_idcolumn asclaimand inserts nothing. - It reuses
_reenter, so the digest-first table is identical to the claim path: RequestConflict, finished record, AttemptInProgress, RecoveryRequired. - Storage faults map to
ExecutionPersistenceErrorwithstarted=None, so no start state is invented. Integrity faults map toRecordIntegrityError.
- It selects on the same
- Registration race. A missing row only permits fresh validation. The atomic
claimstill re-applies_reenterand the generation-request check, so a registration during the preparation read resolves to AttemptInProgress and never to a second start.test_registration_race_after_lookup_still_uses_the_atomic_claimcovers this. - Original limits.
- In
_run_claimed, an evaluation request checks caller cancellation and the absolute deadline before_bind_entry/ source capture. Cancellation is recorded ascallervia_cancellation(ctx, [])instead of a hard-coded not-requested value. - Reentry never reaches
_deadline_secondsor_budget, so the clock and budget are not refreshed.replay_onlyin the tests patches those functions to fail. - The null step-timeout case keeps the #552
bound = deadlinebehaviour.
- In
- Caller mutation. The snapshot is taken before any host callback, and
test_caller_mutation_during_preparation_read_cannot_change_the_saved_requestcovers it. - Compatibility.
validate()is retained as a thin_validate_fields+_validate_freshwrapper, so existing fresh-path callers and error priority (version, fields, support) are unchanged. - Docs and tests. The new
harness-evaluation-replay.mdtable matches the code. The cross-references in the entry-verification, prepared-binding, operations and fixture README files are consistent. The test file covers:- replay of completed and refused attempts with the source repaired or missing and the target retired;
- digest conflicts for deadline, budget and prepared-ref changes;
- live-owner, owner-gone and commit-failure-after-start cases;
- real null-timeout expiry and cancellation with cleanup facts;
- replay in a new controller process;
- static-shape errors preceding the state lookup.
Blockers: none found.
Non-blocking
- Jiang's note stands: the stale "evaluation replay/limit acceptance are later slices" wording in the
execution_service.pyheader can be updated to say this slice is delivered. - Complete CPU acceptance still depends on the separate launch-boundary delivery, as the contract states. This PR does not claim production acceptance.
Not verified: I did not run the tests or the wheel check. The 283 tests / 289 subtests and the bare-core wheel results are the author's claims. The new head's Ready CI was still running at the time of the PR text and I have not seen it green.
|
@david6666666 请求接手当前 已处理现有意见:两位评审均将模块文头“later slice”措辞列为非阻塞建议;记录于后续 H 能力范围说明清理,不改变这一已验证源码头。权威契约与 PR 描述已经明确 PR-3 的实际交付和整项 CPU 验收的剩余边界;没有阻断性 finding 或未处理 inline 线程。 |
|
@david6666666 新主线兼容预检已完成:#592 已合入 actual main 仍只有 Jiang 一份有效独立批准;作者与实际 H 父责任人 Dong 排除。请接手第二份独立代码检视,有问题先修,不预设批准。对应代码、接受范围、已解决意见和安装包证据已在描述中完整列出。 |
|
@linyueqian Apps #592 已合入并完成实际 main 复验,#591 已关闭;请把原先 Apps 切片的检视优先级转到本 PR 当前 #565 owner 最新路由 明确 #564 没有 Amy 实名席位,任一符合独立性/当前 write+ 的不同账号均可补足;作者和真实 H 父责任人 Dong 排除。请按实际接受范围、diff 和消费者给结论,有问题先修;通过时用本头正式 LGTM/Approve,不预设批准,也不将临时 base 或开发准备当成主线验收。 |
Refs #429 and #371.
PR-3 of three; prerequisite #562 is now on actual main. This head
e0eb7eea81204f60b570c7b8565fafefc8391c64synchronizes actual main5325147786d0b5bb2b78b3f7ce461c6289c26b2e. The native main-target increment is now the bounded nine files / +499 -23, with no unmerged #562 code in the diff. Authority: bounded PR-3 delegation.A saved execution request resolves registered state before opening preparation artifacts, admitting another budget or binding a target. Completed and refused attempts return the original fixed RecordRef. Digest changes conflict; live owners and unfinished attempts never implicitly resume. Fresh evaluations preserve the original absolute deadline and budget, including a null step timeout.
Validation on this synchronized head:
Six squash-related conflict regions were resolved by retaining the bounded replay changes and all newly merged main functionality/docs; the resulting runtime delta is the same 42-line execution-service and 28-line RunStore change relative to the accepted entry-verification source. Required CI has completed successfully on the new head. Old-head approvals/comments do not count; fresh independent review is requested now that the actual-main prerequisite is met.
Root/Codex is the author/integrator and Dong1017 the accountable Harness parent; neither supplies an independent vote. Require two distinct eligible write+ current-head formal Approves with first nonempty line exactly
LGTM, required CI green, then squash to main. The #562 merge itself is recorded separately as merged with independent approvals 1/2 and pending post-merge review per owner decision, not retroactively compliant. Shared production CPU acceptance remains separate; #371/#429/#430/#434/#565 remain open.Agent-assisted-by: Codex (author/integrator); DCO signed.
Current-head gate update: Ready CI 45087329846 is fully successful on
e0eb7eea81204f60b570c7b8565fafefc8391c64; native no-cache check/status reads also confirm declarations, lint and knowledge-model-policy success. Jiang 6015310602 is one eligible independent approval; Dong 6015314555 explicitly does not count as the accountable parent. Independent approvals remain 1/2. The new isolated installed-core probe also completed a fresh CPU evaluation, replay after source removal/target retirement with fresh operations forbidden, and changed-digest RequestConflict; both H runtime files match source/wheel/installed bytes.