Repository navigation
feat(harness): 離線集群 RSI 并行轮协调器 - #268
Conversation
Dong1017
left a comment
There was a problem hiding this comment.
Independent source review of head 56a40049148ced7bb80e60249a8f5df40d5c1587, against API base / observed main f93df0548a26714f6514337a8525c7c14108acad. Requesting changes for three current execution-contract defects, detailed inline: protected read/environment exposure, claim persistence after execution, and incomplete absolute-deadline enforcement.
I traced prepare/submit/serve, lane-budget transitions, confinement, leases, the CLI and all added tests against the existing architecture and #249 discussion. The attempt-scoped digest and permanently retained reservation charge are useful; they do not clear the inline execution-boundary findings. The Draft/partial-delivery description is appropriately explicit. Existing M0–M2 assignment/scope acceptance remains a maintainer decision, separate from this code review.
Verification was source and existing hosted-status inspection only. I did not execute this branch, tests, namespaces, models, devices or a paid workflow. Current hosted evidence contains the declaration check; no Ready full-check/installed-package result was observed for this head. Fixture results and author-reported tests do not qualify OS confinement or a campaign outcome. Next for the existing author @NumberWan: fix the three boundaries and supply the corresponding targeted evidence, preserving unknown/failed execution states and the Draft scope. No pilot, device use, incumbent advance, merge or Issue closure is authorized by this review.
Dong1017
left a comment
There was a problem hiding this comment.
Incremental review of the existing Draft head 56a40049: one previously unraised file-deletion handling gap in the offline submit path (inline). Existing confinement, execution-claim, and deadline findings remain in their original threads; this review does not repeat or resolve them. Scope: static inspection of parallel_round.py, its caller and fixture tests against #249; no tests, namespace checks, model calls, or device experiments were run. This is not approval or M0–M2 acceptance.
Dong1017
left a comment
There was a problem hiding this comment.
One additional blocking file-boundary finding at 56a40049: submission can copy a coordinator-readable external file through a lane-controlled symlink. This intake path is distinct from the existing candidate-execution confinement finding and must be closed before accepting untrusted lane submissions.
Verified with a disposable synthetic external canary and the exact pinned function bodies; no real private file or candidate command was accessed/executed. Existing findings remain in their threads; no duplicate findings or broader feature requirements are added.
Verification boundary
Function-level reproduction used AST-extracted prepare/submit and necessary helpers/artifact functions, standard library only, with a sanitized environment. Allowed path knobs/a.txt was replaced by a symlink to a synthetic sibling file outside work. Result: submitted=true, outside=[], source_is_symlink=true, outbox_is_regular_copy=true, copied_external_canary=true. This is not a full CLI or OS-confinement qualification; no model/hardware/network execution or repository modification occurred.
|
Addressed the five findings on 56a4004 in 9b4b08b.
Still out of scope: OS confinement on this host (user namespaces are unavailable, so the default backend fails closed), M3, incumbent advance, and shared drivers. |
Dong1017
left a comment
There was a problem hiding this comment.
Incremental static review of head 9b4b08b9 following the author's five targeted fixes: one newly identified expected-failure reporting gap in the unshare backend (inline). Existing confinement, deadline, claim and symlink findings remain on their original threads; this does not repeat, dismiss or approve them. I inspected the new confinement.py, parallel_round.py, CLI caller and available fixture tests; no real namespace, test, model or device run was performed. This is not an M0–M2 acceptance or launch authorization.
Dong1017
left a comment
There was a problem hiding this comment.
Changes requested at 9b4b08b9: the new filesystem view still lacks the runtime files needed to start a dynamically linked Python command.
- One new P2 startup defect is detailed inline. It affects the real namespace backend on an otherwise namespace-capable Linux host.
- The existing deadline follow-up and timeout-receipt finding remain applicable; this review does not repeat them.
- The persisted pre-launch claim and explicit deletion refusal improve the earlier paths. They do not establish native confinement qualification or complete the parent task. Next action remains with @NumberWan: repair the current blockers and provide bounded software evidence.
Evidence and scope
Reviewed head: 9b4b08b9f7b4bde0f18d6e3db80d8e47cf059539; API base: f93df0548a26714f6514337a8525c7c14108acad; assessed main: 919ed42c0d01dc0aa3b613085b9041d735d2d4db.
Inspected the six-file repair delta, current prepare/submit/serve and CLI consumers, runtime-root/mount/exec paths, and relevant fixture tests against the existing execution contract. Current per-head evidence contains successful declaration checks; no Ready full-check or installed-package success was observed. Verification was source and existing hosted evidence only: no repository tests, namespaces, model/device runs or paid evaluation were executed. This review did not implement the PR and grants no launch, merge or goal-acceptance authorization.
|
Addressed the three findings on 9b4b08b in fc9d232.
Still out of scope: OS-confinement qualification on this host, M3, incumbent advance, and shared drivers. |
There was a problem hiding this comment.
Reviewed commit: fc9d232
Coverage: Snapshot: 2221 files, 35993584 bytes; skipped 0 entries; Initial model context: 22 files; other accepted files available through tools; Git workspace contains a fixed snapshot, not full upstream history
| assert "SECRET_CANARY" not in plan["env"] | ||
|
|
||
|
|
||
| @pytest.mark.skipif(not namespaces_available(), reason="user namespaces are unavailable") |
There was a problem hiding this comment.
F2 — high, must-fix, test gating — the live namespace smoke fails instead of skipping when unprivileged user namespaces are blocked
- Where:
tests/test_confinement.py:135 - Problem: the guard only reads
/proc/sys/user/max_user_namespaces. When that value is positive but namespace creation is denied, the test runs and errors:UnshareBackend().run→ConfinementUnavailable: unshare: unshare failed: Operation not permitted. Executed in this container:PYTHONPATH=src python -m pytest tests/test_round_budget.py tests/test_confinement.py tests/test_parallel_round.py→1 failed, 23 passed, the failure beingtest_unshare_starts_python_and_hides_a_private_canary. Heremax_user_namespaces= 498239 andkernel.apparmor_restrict_unprivileged_userns= 1, whileunshare --user truereturns EPERM. - Conditions: unprivileged containers (default seccomp profiles) and AppArmor-restricted unprivileged-userns hosts, which is the default on Ubuntu 24.04+ and therefore on common GitHub-hosted runners. This is unrelated to whether the host has namespaces at all.
- Impact: the repository's full
pytest(ready and nightly lanes) goes red on such hosts, and the PR's statement that the smoke "skips where user namespaces are unavailable" is wrong, so this test cannot serve as the confinement qualification evidence it claims to be. - Fix: probe the syscall rather than the sysctl, e.g.
subprocess.run(["unshare", "--user", "true"], ...)and skip on a non-zero return, or wrapUnshareBackend().run(...)intry/except ConfinementUnavailableandpytest.skip(str(exc)).
There was a problem hiding this comment.
已在 cf22cb50 处理:namespaces_available() 除了读 max_user_namespaces,还实际执行一次 unshare --user --map-root-user --mount -- true,失败、超时或找不到程序都视为不可用,现场测试改为跳过。测试:test_blocked_unshare_reports_namespaces_unavailable。
|
This PR adds the offline parallel-round coordinator (prepare/submit/serve/status), lane attempt budgets, a fail-closed confinement backend and its tests. Two blocking defects: the Reviewed commit: fc9d232 |
|
Review at head
|
|
Coverage review at head
Reviewed commit range: |
|
Dong1017 在
|
|
增量 review: 已核对、确认修好的:
还需要处理的:
小问题(不阻塞): |
There was a problem hiding this comment.
PR review verdict — DO NOT PASS
Reviewed base f93df0548a26714f6514337a8525c7c14108acad and head cf22cb50f243b17227863f8e79f601b25faf5480 (full diff; no previous head was seeded). Two execution-contract blockers remain. I will re-read after the author pushes.
Blockers
-
P1 — The unshare supervisor cannot import
enter_namespaceon the layout this PR tests.UnshareBackend.run(src/inferrsi/infra/confinement.py:330) startssys.executable -c "from inferrsi.infra.confinement import enter_namespace"withenv=minimal_environment()(:346). The allowlist (:20) is onlyPATH,LANG,LC_ALL,LC_CTYPE,TZ, andPYTHONIOENCODING.PYTHONPATHis omitted, andcwdis the candidate tree, so the childsys.pathdoes not include the checkout that holdssrc/inferrsi. When that is the only way to importinferrsi, the child exits withModuleNotFoundErrorbeforeenter_namespace. Any non-zero status is raised asConfinementUnavailable(:358), andserve_ticketrecordsunsettledwithout running build or either trial.tools/parallel_round.pyserve usesselect_backend(), so a namespace-capable host takes this path.test_serve_cli_runs_without_a_caller_supplied_clocksetsPYTHONPATH=srcand acceptsunsettled, so it stays green when the jail never starts. Expected correction: put only the directory that contains theinferrsipackage (derived from this module's__file__) on the supervisor environment. Keep the candidateexecvpeenvironment on the allowlist. Add a test that the supervisor environment can importinferrsiand still omits secrets such asSECRET_CANARY. -
P2 — Restart does not treat an existing ledger row for this ticket as the same attempt.
_claimed_entry(src/inferrsi/harness/parallel_round.py:343) matches onlyphase == "claimed". Otherwiseserve_ticketalways callsadmit_attempt, which mintsordinal = len(entries)+1(:431).- Trigger A:
_save_ledgerpersistsreserved(:434) before_materialize(:437) and beforeclaimedis saved (:444).copytree/copy2raising, or a stop in that window, leaves no receipt. The next serve allocates another attempt. When the new charge exceedscap, the ticket is recordedrejectedfor budget exhaustion and never launches. When the cap has room, the same ticket runs under a second permanent charge while the first row staysreserved. - Trigger B:
_save_ledgeroffinished(:464) happens before_recordwritesresults/<ticket>.json(:465). A stop in that window has noclaimedrow, so the next serve launches build, candidate, and incumbent again.
Expected correction: a persistedrun_idending in@ticketis that attempt. Resumereservedwithout a new charge. Forclaimedorfinished, write a terminal receipt and do not launch.
- Trigger A:
Closed on this head (source inspection)
- Submit refuses symlinks via a no-follow walk, and refuses an in-glob deletion instead of hashing a missing path.
serve_ticketdrops the caller'snowand re-readsclockordatetime.now(timezone.utc)for admission and each stage. Submit checksdeadline_utc. A stageTimeoutExpiredbecomes anunsettledreceipt.claimedis saved before_launch. A laterclaimedrow with no receipt is recordedunsettledand is not launched again. Thereservedandfinishedwindows above are what remains of that contract.- The namespace plan is built from the writable set, the readable set,
runtime_roots(), andruntime_files()(PT_INTERP,lddlibraries, and/etc/ld.so.cache). Source/is refused. The coordinator environment is reduced to the allowlist.namespaces_available()probesunshare, and the live test is skipped when that probe fails. nowis optional onserve_ticket, so the CLI serve call matches the signature. A completed trial with an unreadable latency file becomesunsettled.
Follow-ups (non-blocking)
- Each stage still uses
min(seconds_remaining(...), 30)(parallel_round.py:357), so a stage stops at 30s while the lane deadline still has time left. - A symlink present at scan time is rejected.
_scanand_read_nofollowdo notfstatthe opened fd and do not open withO_NONBLOCK, so a regular file replaced by a FIFO afterstatcan block the coordinator inos.read.
Verification
Static read of parallel_round.py, round_budget.py, confinement.py, device_lease.py, tools/parallel_round.py, and the new tests, checked against the earlier threads on #268. Not verified here: pytest, unshare, namespaces, models, devices, or a paid workflow. Loader mounts and OS confinement are not qualified by this pass. Synthetic latency in this harness is not a campaign result. M0–M2 scope acceptance stays with the maintainer.
Dong-bot will re-read after the author pushes.
|
|
|
增量 review: 这次改动,已核对
这次新发现的问题
上次的问题,还没处理 以上是静态 review(diff 加 head 上的相关代码),我没有在本地跑测试。 |
|
回复 @amy-why-3459 的增量 review,新 head
本地: |
|
增量 review: 已解决,已核对
仍未关闭 以上是静态 review(diff 加 head 上的相关代码),我没有在本地跑测试。这次是校验和文档改动,不涉及精度和性能对比。 Reviewed: |
|
@zengchuang-hw 上一则说的 submit 竞态已经补上,head 是 票据摘要仍来自扫描。写入 outbox 前对每个变更文件做同一次读取,用同一套内容加执行位重新计算摘要;和扫描不一致就拒绝,reason 是 |
zengchuang-hw
left a comment
There was a problem hiding this comment.
NO PASS
dot, acting for @zengchuang-hw
增量:f6c982e74d729897b05d3ff125dcfd981a949aca → e2ff2ba40eb48bcc45c5d528cb6300af5fd3852f,base 214fb400b678db7f03f2d865e3b80c1fbf97d6bd。上轮代码检视 · 本轮作者 @。
上轮阻塞已修复。 写 outbox 前用同一次读取拿到内容、执行位与摘要,和初扫不符就拒绝;新增了内容变化、只变执行位两条回归。
批准前需避免全量指纹扫描占用整份文件内存。 _scan 现在调用的 _digest_file 为每个文件收集全部块再拼接,但扫描只取摘要。原来是固定 1 MiB 分块,当前峰值随最大文件增长,且连未改的大文件也会载入;提交阶段还同时保留所有改动文件内容。请恢复只算摘要时的流式读取;可边复制边校验到磁盘暂存,所有摘要匹配后再发布票据。保留两条变化拒绝的回归,并覆盖分块读取的大文件。
静态核对了本轮两文件差异、扫描调用链和测试源码,未跑测试或硬件,也未查看 CI;f6c982e7 的 Ascend03 回放不属于当前 head。
A tree scan only needs the digest, so it no longer keeps each file in memory. Submit copies to a staging directory in chunks and publishes the ticket only when every digest still matches. close composed entries are always ticket and lane objects, and the system-Python root test skips interpreters older than 3.10. Signed-off-by: NumberWan <wantszkin2003@gmail.com>
|
|
zengchuang-hw
left a comment
There was a problem hiding this comment.
NO PASS
dot, acting for @zengchuang-hw
增量:e2ff2ba40eb48bcc45c5d528cb6300af5fd3852f → b8f1580ad9626dec6cff69a47501dabee2729429,base 214fb400b678db7f03f2d865e3b80c1fbf97d6bd。上轮检视 · 作者 @。
上轮内存阻塞已修复。 扫描恢复 1 MiB 流式摘要,改动文件边复制到磁盘暂存边校验,且保留内容和执行位漂移回归;新增跨分块用例。也核对了 composed 返回形状与低于 Python 3.10 的宿主测试跳过。
批准前需补齐票据发布失败后的恢复。 当前发布路径 先移动载荷,再写票据 JSON。如果 JSON 写入失败(例如磁盘满),代码返回 symlink 拒绝,却留下目标目录;重试只看目录存在就跳过写 JSON、返回成功,而 serve 仍读不到完整票据。这个双文件发布缺口在旧流程也有,本轮改写没有修复。请把状态发布做成完整提交,或在失败时清理且在重试前核验两部分;补一条普通元数据写入失败后可重试、且不会报告假成功的回归。
本轮静态核对了三文件增量和故障路径,未运行测试、设备或 CI;旧 Ascend03 结果不属于当前 head。
Dong1017
left a comment
There was a problem hiding this comment.
PR review verdict — DO NOT PASS
Posted by Dong-bot, an automated agent acting on behalf of @Dong1017 (always-on-bot, model claude-sonnet-5-5).
Reviewed base 214fb400b678db7f03f2d865e3b80c1fbf97d6bd and head b8f1580ad9626dec6cff69a47501dabee2729429 (the three changes announced in the 2026-11-23T08:35Z comment). This is Dong-bot, authorized delegate for @Dong1017. I did not execute anything.
Blockers
- The seeded diff is incomplete.
diffComplete: false, and the patch is cut off insidetests/test_parallel_round.py. I could not seetools/parallel_round.py, any docs, or the other changed files. I read the fulltests/test_parallel_round.pyat the head throughread_repo_file. I did not read the rest of the PR from the repo, so I can't PASS the whole change. - No formal APPROVED review exists on this head. The
cursor[bot]CHANGES_REQUESTED on026f686d(review 5931222199) is still listed as outstanding. Its two blockers were hostgitreading a writable.git, and a validationConfinementUnavailablebeing recorded as a measured FAIL. The visible code still addresses both:_tree_identityis used for snapshots, and_confined_trialmaps non-timeoutConfinementUnavailabletoerror. The regressionstest_build_planted_git_hooks_do_not_run_on_the_hostandtest_validation_confinement_failure_stays_unsettledare still there. A formal verdict from that reviewer, or a maintainer dismissing it, is still needed. - No Ready/full-check on this head, and the namespace evidence is for an older head. The author says the Ascend03 run on
f6c982e7does not cover this head. Upstreamubuntu-latestskips the namespace tests under AppArmor. GPU isolation is still unverified. - A second independent current-head LGTM is still missing. My own review is not an independent vote.
Checked in the visible code and tests (not run)
- Streaming digest.
_digest_fdand_stream_copyread in 1 MiB chunks and keep only the digest. The digest covers the executable bits plus the content, so it matches_snapshot. - Submit staging.
submitcopies each changed file intosubmit-staging/<ticket>. It refuses withchanged during submitif the copy's digest differs from the scan, and removes the staging directory infinally. The outbox entry is moved into place only after every file matches. - New tests.
test_submit_streams_a_file_larger_than_one_chunk,test_submit_refuses_a_file_that_changes_after_the_scanandtest_submit_refuses_an_executable_bit_that_changes_after_the_scanmatch the described behavior. composedshape. Everycomposedlist built inclose_roundis now{"ticket", "lane_id"}dicts. That covers the deadline,devices unavailable,device_modelqualification and unreaped paths. Early refusals (missing receipts, unsettled tickets, frozen-incumbent mismatch) carry nocomposedkey at all, so there is no string-ticket case left. No test asserts the dict shape on the deadline, device-shortage or qualification paths. That is non-blocking, but worth adding.- System-Python skip.
test_runtime_roots_under_system_python_exclude_usrnow probes/usr/bin/python3and skips when it is older than 3.10.
I found no new code defect in the part I could read. The blockers above are the incomplete diff and the open merge gates. I will re-read once the cursor[bot] state is resolved, Ready/full-check has run on this head, and a second independent LGTM is in. My earlier decision accepting joint single-rerun close as the bounded offline slice stands. It is not #249 M0–M2 acceptance.
|
@amy-why-3459 请再看一次当前 head 你上次完整阅读是 这颗 head 另外包括:incumbent 摘要核对、PASS 时晋升实测过的 joint 树、可执行位进摘要并保留、submit 在扫描后内容或执行位变化时拒绝、扫描按 1 MiB 流式计算摘要、 Ascend03 的 live namespace 实跑目前停在较早的 |
david6666666
left a comment
There was a problem hiding this comment.
One final promotion-boundary issue on the current head.
| successor = round_dir / "successor" | ||
| if successor.exists(): | ||
| shutil.rmtree(successor) | ||
| shutil.copytree(joint, successor) |
There was a problem hiding this comment.
Please make promotion copy only the verified snapshot entries and use a no-follow copy. The post-build tree is writable, but the scan excludes repository metadata while this host-side copy traverses it. That makes the promoted tree larger in scope than the verified snapshot. Please assert that excluded metadata is not published and that links are rejected without being followed.
There was a problem hiding this comment.
Fixed on 510c5a1f01c480ea2e4661c8cc207accd06126e6. Promotion copies only the regular files the snapshot verified, with a no-follow copy. .git is not published, so a symlink planted inside it is not followed. A symlink the scan reports refuses promotion and removes the destination. Covered by test_promotion_does_not_publish_or_follow_repository_metadata and test_promotion_refuses_a_symlink_without_following_it.
|
@cursoragent PTAL |
A metadata write that fails must not leave an outbox directory that a retry treats as success. Promotion must copy the files the scan verified, not repository metadata or the target of a symlink. Signed-off-by: NumberWan <wantszkin2003@gmail.com>
|
@zengchuang-hw @david6666666 兩則都在 @zengchuang-hw 出箱目錄和旁邊的 metadata 現在是一次發布。metadata 寫失敗會把兩邊都刪掉並回拒絕,重試不會在 @david6666666 successor 只複製掃描驗證過的普通檔,複製不跟隨連結。 本機跑了這幾條測試。這顆 head 還沒有在 Ascend03 上跑過。 |
zengchuang-hw
left a comment
There was a problem hiding this comment.
NO PASS
dot, acting for @zengchuang-hw
增量:b8f1580ad9626dec6cff69a47501dabee2729429 → 510c5a1f01c480ea2e4661c8cc207accd06126e6,base 214fb400b678db7f03f2d865e3b80c1fbf97d6bd。上轮 · 作者增量说明。
上轮误报成功已修复。 票据 JSON 写入失败会清理载荷和元数据,重试会识别并重建不完整票据。新增回归覆盖失败后重试;普通写入错误仍标成 symlink,建议改成实际发布错误。
批准前需将 successor 绑定到评估用的摘要。 runner 已留存评估确认的候选指纹,但 close 在 PASS 后只传入目录。新发布函数按后来重扫的快照复制,并不比对评估留存的指纹。正常文件修改若发生在测量结束之后、发布扫描之前,发布内容可与受测内容不同。请在发布时核对该次评估的候选指纹;不匹配就拒绝并不留下 successor。用普通文件变动覆盖这条回归。
静态核对了增量、运行器留存证据和测试源码;未独立执行测试、硬件或 CI。
david6666666
left a comment
There was a problem hiding this comment.
One incomplete-ticket recovery case on the current head.
| except (OSError, UnicodeError, json.JSONDecodeError): | ||
| return False | ||
| return stored == record | ||
|
|
There was a problem hiding this comment.
Could retry also validate the published payload against the manifest before returning success? A ticket with a matching sidecar but a missing or truncated payload file passes this predicate; retry discards the freshly verified staging copy and returns a ticket that cannot reproduce its submitted content. Please cover a valid sidecar with a missing or modified file and either repair the payload or refuse the ticket.
There was a problem hiding this comment.
Fixed on eb918d0a61dfe786b98078919fc652ad545094d7. Retry now hashes every manifest file in the outbox. A matching sidecar with a missing or modified payload is unpublished: the incomplete ticket is removed and replaced from the staging copy that just matched the scan, and only then does submit return success. test_retry_repairs_a_payload_that_does_not_match_the_manifest covers a truncated file and a deleted file.
…d payload A retry must not accept a sidecar whose payload no longer matches the manifest. Promotion must refuse when the tree no longer matches the candidate fingerprint recorded for that evaluation. Signed-off-by: NumberWan <wantszkin2003@gmail.com>
|
@zengchuang-hw @david6666666 兩則都在 @david6666666 重試會核對 manifest 裡每個檔案的摘要,不再只看 sidecar。sidecar 對得上但檔案缺失或被改過時,這張票視為未發布:清掉不完整的出箱,用剛核對過的暫存重新發布,然後才回成功。 @zengchuang-hw 晉升會讀 本機 |
zengchuang-hw
left a comment
There was a problem hiding this comment.
PASS
dot, acting for @zengchuang-hw
Reviewed base 214fb400b678db7f03f2d865e3b80c1fbf97d6bd and head eb918d0a61dfe786b98078919fc652ad545094d7; 增量自 510c5a1f01c480ea2e4661c8cc207accd06126e6。上轮。
上轮阻塞已修复:晋升以 runner 留存的本次候选摘要为准,逐文件校验内容和执行位,评估结束后文件变化会拒绝发布且不留 successor。重试也实际核验已存载荷与 manifest,截断或缺失可重建;两条新增回归覆盖这些分支。普通写错误仍可能显示为 symlink,可后续改善诊断,不阻塞这轮。
本轮静态核对了两个增量文件、摘要来源和测试源码。作者报告的本地测试未独立复跑;之前的 Ascend03 回放不是当前 head 的实机验证。未查看 CI,本次仅批准离线 joint single-rerun 切片,不验收 #249 的 stepwise composition,也未合入。
amy-why-3459
left a comment
There was a problem hiding this comment.
Codex,受 @amy-why-3459 委托做技术复审,非正式批准。
静态复核 base 214fb400 → head eb918d0a,针对上次 29c5aa66 的三点:当前代码和回归用例已覆盖同一 lane 只保留一个胜出 ticket、submit 与 close 互斥、以及阶段间核对冻结的 incumbent 摘要。这几个路径没有发现新的阻塞问题;我没有独立运行测试。
先不 Approve:当前头的 Ready CI 45146659658 为 action_required,未见执行的 jobs;已有 Ascend03 实跑也不是这个 head。请补当前头的 Ready CI 结果,并分别说明该结果覆盖离线 joint rerun 的哪些部分、哪些隔离验证仍只能引用旧版本实跑。不要把旧实跑当作本头证据。
david6666666
left a comment
There was a problem hiding this comment.
One evidence-integrity finding on the current head.
serve and close must check overlay bytes while staging the candidate, before reserving an attempt or running a command. Signed-off-by: NumberWan <wantszkin2003@gmail.com>
|
@david6666666 這則在
|
zengchuang-hw
left a comment
There was a problem hiding this comment.
NO PASS
dot, acting for @zengchuang-hw.
增量 eb918d0a61dfe786b98078919fc652ad545094d7 → 6b6906bb360ee614a0c98c8ac605aaa084ed9219,base 214fb400b678db7f03f2d865e3b80c1fbf97d6bd。上轮检视
已修复: 截断载荷在 serve 新尝试入账前被拒绝;close 不会拿它做联合测量,也不会留下候选或写入 close 结果。新增回归覆盖两条路径。
批准前必修: materialize() 现在用 _stream_copy() 覆盖从 incumbent 拷贝来的已有文件。截断不会清除目标旧执行位,而复制只添加源文件的执行位,不会删掉多余的位。普通的“可执行变为不可执行”改动因此能通过按源模式计算的摘要,却以错误的目标模式参加测量。请精确设置目标执行位,并核对落盘的内容和模式;补 serve 和 close 的权限降级回归。
已静态核对两文件增量、复制调用链和测试定义;未运行测试、Ascend03 或 CI。
Truncating an incumbent file kept its old executable bits, and the copy only added bits from the source. A downgrade could match the source digest and still be measured with the old mode. Signed-off-by: NumberWan <wantszkin2003@gmail.com>
zengchuang-hw
left a comment
There was a problem hiding this comment.
PASS
dot, acting for @zengchuang-hw.
增量 6b6906bb360ee614a0c98c8ac605aaa084ed9219 → 8eae202d04ce85cd74552cdddb23c6274b29de5e,base 214fb400b678db7f03f2d865e3b80c1fbf97d6bd。上轮检视
执行位问题已修复:复制结束后精确替换目标执行位,再从落盘文件重算内容加执行位摘要并比对。新增回归覆盖带旧执行位的 incumbent,确认 serve 候选与 close 的 successor 都保留降级后的权限;截断载荷的两条拒绝路径保持不变。
静态核对两文件增量、摘要和测试定义。未运行测试、Ascend03 或 CI。批准仅适用于本次离线 joint single-rerun 改动,不等于 #249 整体完成。
|
@zengchuang-hw @amy-why-3459 目前 head
兩個 SKIPPED:
其餘 178 條 PASSED,包括 |
amy-why-3459
left a comment
There was a problem hiding this comment.
LGTM
Codex, acting for @amy-why-3459.
PR review verdict — PASS
审阅范围与验证
base 214fb400b678db7f03f2d865e3b80c1fbf97d6bd,head 8eae202d04ce85cd74552cdddb23c6274b29de5e。本次批准覆盖 #249 的离线联合复测。已复核同一 lane 的胜出选择、提交与关闭互斥、冻结基线校验,以及 serve 和 close 使用载荷前的完整性检查。复制会精确替换目标执行位,再从落盘文件读取模式及内容核对摘要;回归用例覆盖从可执行降级为不可执行的情形。
当前提交的 Ready CI 八项均通过。作者另报告 Ascend03 同版本运行通过 178 项,跳过 2 项;跳过项是旧系统 Python 的路径验证和需要 NVIDIA GPU 的隔离验证。本次审阅未验证真实 GPU 隔离。逐 lane 重测仍由 #249 单独跟踪。
Refs #249
问题
当前 campaign 每轮只推进一个候选:从 incumbent 建一个隔离目录,改动一个声明的 plane,再与 incumbent 做 AB/BA 比较。多 Agent harness 想以集群方式在同一轮并行探索几个独立方向时,缺少以下保障:多个候选争用同一设备;工作目录不保证来自同一 incumbent;各自的改动范围可能互相覆盖;失败的尝试没有记在同一份账本里。
本 PR 明确不做
本 PR 先不做 #249 的 stepwise composition。不会在每叠上一条 PASS lane 之后,从干净 checkout 再测一次。
本 PR
close的目标就是 joint single-rerun:把这一轮所有verdict==PASS的 lane 按lane_id叠到同一个候选上,对 incumbent 只再测一次。联合结果为 PASS 则写successor/,否则保留原 incumbent。逐步逐条重测留在 #249,不在这张 PR 的合入范围里。本 PR 的行为
本 PR 是 #249 的一个离线切片,做一轮里的
prepare/submit/serve/status/close,以及测量命令所在的隔离环境。测量按 #249 的要求复用现有 harness 的run_experiment循环,以及 v0 判定门禁(benchmark.legacy_run_v0.evaluate)和qualify_devices,不另写 runner;本 PR 注入隔离版execute,并用目录摘要做源指纹(_tree_identity,不在 build 后对候选跑 hostgit/repository_identity,避免候选里被写入的diff.external在宿主机执行)。report端口为空操作,产物以evaluation.json/events.jsonl为准,不依赖report.html。这里的「集群」指同一轮里多个 Agent 各占一条 lane、从同一个 incumbent 并行改动,测量统一交给serve。入口是python tools/parallel_round.py,不往主 CLIinferrsi加子命令。prepare)。 计划列出可用设备device_ids,并声明要比较的指标metric(名称、better: lower或higher、每次测量重复几次repeats、判定 PASS 所需的最小改进min_improvement_pct,默认 0);可选的validation是在候选上跑一次的质量检查命令,可选的device_model要求测量前检查设备型号。每条 lane 声明 id、对应的搜索计划条目、唯一的 plane(harness / model / infra)、允许修改的路径 glob、每次测量要几张设备(device_count,默认 1)、attempt 上限和截止时间。以下计划会被拒绝:两条 lane 的 glob 重叠(包括同时匹配 incumbent 中的同一文件)、lane 覆盖 protected 路径、两条 lane 对应同一条目、所有 lane 的device_count加起来超过device_ids的项数。通过后写入round-plan.json,digest 覆盖校验后的计划正文。submit)。 只比较该 lane 允许修改的文件,把差异复制到 outbox,并返回 ticket。相同 manifest 总是返回相同 ticket。这一步不占设备,集群里的 Agent 不必等测量完成。符号链接、FIFO 和其他非常规文件在读取内容前拒绝;范围内的删除在计算哈希前拒绝;改到 lane 范围外的文件、命中 protected、与其他 lane 的具体路径重叠(含新建文件),或已过截止时间,都拒绝提交。serve)。 每次调用测量一个 ticket:一次取得该 lane 所需数量的空闲设备,取不齐就全部放回,不会只占一部分。同一条 lane 的 ticket 由 lane 锁依次测量,避免同时改写同一份账本。lane 锁被占用或设备不够(包括被隔离的设备)时,ticket 保持queued,不扣 attempt;计划写了device_model时,取得设备后先用qualify_devices检查型号、以及卡上有没有其他计算进程,不通过也保持queued(收据带reason),不扣 attempt;排队时已过截止时间则记为rejected。取得设备后才 reserve,账本先记为claimed,再执行第一条命令。build(可选)在候选上跑一次;之后由run_experiment测量:incumbent 与候选的trial按 AB/BA 交替各跑repeats次,有validation时在候选上跑一次,再由evaluate给出PASS/FAIL/INCONCLUSIVE。run_experiment的产物(events.jsonl、evaluation.json等)写在<round-dir>/runs/<ticket>/,收据记下verdict、improvement_pct、reasons、每次的值、中位数和run_dir。所有命令都在隔离环境中执行;隔离不可用时拒绝执行,不回退为普通子进程。截止时间每次读取当前时钟。任何一次 trial 没有得到有效指标(失败、超时、结果文件没有计划声明的指标、或指标不是正的有限数值)时,记录unsettled,账本保持claimed。status)。 返回 ticket 的收据;还没有收据时为queued。close,joint single-rerun MVP)。 要求每个 outbox ticket 都有终态收据,且没有unsettled。把verdict==PASS的 lane 按lane_id顺序叠到同一个候选上,再对 incumbent 做一次run_experiment。联合结果为PASS时写入successor/(accepted=true);否则保留原 incumbent(retained=true)。这不是 task: parallel optimization rounds with orthogonal lanes for multi-agent harnesses #249 的逐步 composition,也不是 Claude/Codex driver 或 SwarmFlow。serve中途被杀掉后再调用同一个 ticket:账本停在reserved时沿用同一次 attempt 继续,不另扣;停在claimed或finished但没有收据时记为unsettled,不再执行;停在cancelled时记为rejected。improvement_pct一律以正数表示候选更好。verdict沿用 v0evaluate的规则:没有validation时为INCONCLUSIVE(原因写在reasons)。源完整性用目录摘要,不要求 incumbent 是 git 仓。单票收据不推进 campaign;可选的close只在本 round 目录写下successor/或明确 retain,不是 #249 的逐步合入,也不串多轮、不改调用方工作区里的「现任」路径。测试中的指标是 fixture 输入,不是 campaign 结果。Agent 自报的数字和外部 harness 的投票不作为判定依据。没有集群与有集群的控制流
阶段名沿用 dashboard 的 agent stage(
diagnosis/knowledge/search/execution/validation/review,见docs/dashboard.md)。两张图只说明一轮内的工作如何调度,不是本 PR 的性能结果。没有集群时,一轮只有一个候选。候选测量完、决策完,下一轮才开始。
有集群时,决策 Agent 在
search一次选出几个互不重叠的改法,prepare把它们冻结成几条 lane。各 lane 的 Agent 只负责在自己的范围内改出候选,交给submit,不自己测量。每条 lane 的 validation 由serve在这条 lane 自己的设备上做,不同 lane 同时进行:各 lane 的设备需求加起来不超过总设备数,所以 L1 在设备 0 上测量时,L2 可以同时在设备 1、2 上测量,互不等待。测法由计划统一规定(同一条trial命令、同一个指标、同样repeats次 AB/BA、同一个判定门槛),lane Agent 不能自己选,这样各 lane 的收据才能互相比较。review仍由决策 Agent 读收据来做。蓝色是本 PR 实现的部分;lane Agent 本身(例如 Claude Code、Codex 或脚本)由调用方启动,本 PR 不内置。几条 lane 在同一台主机上同时测量时,会共用 CPU、PCIe 和内存带宽,延迟类指标的噪声可能变大。每条 lane 的候选与 incumbent 在同一组设备上交替测量,可以抵消大部分漂移,但抵消不了 lane 之间的干扰;本 PR 没有量化这部分影响。
repeats用来压住这类噪声。单个 ticket 的状态流转
flowchart TB prepareNode[prepare 冻结轮次计划] --> submitNode[submit 提交候选并返回 ticket] submitNode --> free{lane 锁和设备都拿到了?} free -->|否,未过截止时间| queued[queued 不扣 attempt] free -->|否,已过截止时间| rejectedQ[rejected 不扣 attempt] queued --> free free -->|是,且 device_model 检查通过| deadline{reserve 后仍在截止时间前?} deadline -->|否| rejected[rejected 取消本次预留] deadline -->|是| claimed[账本记为 claimed] claimed --> runNode[隔离执行 build,再由 run_experiment AB/BA 交替跑 trial] runNode --> readable{每次 trial 都有有效指标?} readable -->|否| unsettled[unsettled 账本保持 claimed] readable -->|是| measured[measured 记录 evaluate 的 verdict、improvement_pct、每次的值与中位数]全部 ticket 终态后可另调
close(上图未展开):只合 PASS → 联合再量一次 →successor/或 retain。CLI 用法:启用并行 Agent
入口和前提
python tools/parallel_round.py <子命令>(pip install -e .后用仓库内该脚本)。主 CLIinferrsi不增加子命令;Apps 入口已在main演进,本离线切片仍留在tools/,避免绑死公共 CLI。pip install -e .。unshare --user --map-root-user --mount --pid --kill-child true能成功)。不能时,测量一律记为unsettled,不会退回普通子进程。并行几个 Agent 由什么决定
没有「开几个 Agent」的开关。计划里有几条 lane,就可以同时跑几个 Agent,每条 lane 一个。lane 数受设备限制:
device_ids:这一轮可用的设备。device_count:这条 lane 每次测量要几张设备,默认 1。例如 TP=2 的 benchmark 写 2。所有 lane 的
device_count加起来不能超过device_ids的项数,否则prepare拒绝,也就是设备用满就不再加 lane。例如 3 张设备:L1 要 1 张、L2 要 2 张,这一轮就是这两条 lane。这样每条 lane 提交后都有自己的设备可用,不用排队;代价是 Agent 在改代码时,它的设备会闲置。最小例子:两个 Agent 并行跑一轮
1. 准备 incumbent 目录(被优化的项目,
bench.py是 benchmark):2. 写轮次计划
plan.json:两条 lane,各自只能改一个文件。{ "round_id": "r1", "incumbent_id": "demo", "device_ids": ["cpu-0", "cpu-1"], "metric": {"name": "latency_ms", "better": "lower", "repeats": 3}, "protected": ["bench.py"], "trial": ["/usr/bin/python3", "bench.py", "{result}"], "lanes": [ {"id": "L1", "entry": "D-01", "plane": "infra", "globs": ["knobs/batch.txt"], "cap": 1, "per_attempt_worst_case": 1, "deadline_utc": "2026-11-13T00:00:00+00:00"}, {"id": "L2", "entry": "D-02", "plane": "harness", "globs": ["knobs/threads.txt"], "cap": 1, "per_attempt_worst_case": 1, "deadline_utc": "2026-11-13T00:00:00+00:00"} ] }3. 冻结计划,两个 Agent 各在一份 incumbent 副本里改:
4. 各自提交,再同时测量:
serve返回queued时(设备被占用),稍后对同一个 ticket 再调用即可。收据写在round-r1/results/<ticket>.json,包括verdict、improvement_pct、每次的值、中位数、run_dir和用到的设备。close写入round-r1/close.json;若联合 PASS,另有round-r1/successor/。子命令一览
prepare--spec --incumbent --round-dirsubmit--round-dir --lane --incumbent --workserve--round-dir --ticket --incumbentstatus--round-dir --ticketclose--round-dir --incumbent计划字段
device_ids{device}(build/trial/env里都可用),例如1,2。metricbetter为lower或higher;repeats(默认 1)是候选和 incumbent 各跑几次,取中位数;min_improvement_pct(默认 0)是evaluate判 PASS 的最小改进百分比。trial{result}写入{"metrics": {"<metric.name>": <正数>}}。第一个元素建议写解释器的绝对路径。validation{device};不写时 verdict 为INCONCLUSIVE。device_modelL20X。写了就在测量前对取得的设备跑qualify_devices。build{device}。command_timeout_secondsdevice_pathsshared_device_paths/runtime_paths/envprotectedlanes[]id、对应搜索计划条目entry、唯一的plane、可改路径globs、每次测量的设备数device_count(默认 1)、attempt 上限cap、单次 attempt 预算per_attempt_worst_case、截止时间deadline_utc。GPU benchmark 要多写的字段
{ "device_ids": ["0", "1", "2"], "command_timeout_seconds": 1800, "device_paths": {"0": ["/dev/nvidia0"], "1": ["/dev/nvidia1"], "2": ["/dev/nvidia2"]}, "shared_device_paths": ["/dev/nvidiactl", "/dev/nvidia-uvm", "/dev/null", "/dev/urandom"], "runtime_paths": ["/lib/x86_64-linux-gnu"], "env": {"HOME": "/tmp"} }runtime_paths写驱动用户态库(libcuda.so)所在目录,可用ldconfig -p | grep libcuda查。目前的限制
close只做 joint single-rerun(PASS 合成一次再量),不做 task: parallel optimization rounds with orthogonal lanes for multi-agent harnesses #249 的逐步 composition,也不串多轮 campaign;lane Agent 由调用方启动,不在隔离环境里。只有 build / trial /(close 时的)联合 trial 在隔离环境里执行。/proc)已实现,但还没有在真实 GPU 上验证,见下方「验证与限制」。隔离边界
unshare --pid --kill-child),并在独立 session 中启动。命令超时时杀掉unshare所在的 session,并直接杀掉 namespace 的 PID 1(PID 1 可能已经setsid离开 session);等到进程组清空、PID 1 已退出或成为 zombie 才返回,之后才放回设备。杀掉 PID 1 会拆掉整个 PID namespace,所以命令setsid出去的子进程也一并结束。serve在还持有设备的时候写入<round-dir>/leases/<device>.quarantined(内容是 ticket 和原因),然后才放回设备;只放开文件锁不够,因为单次运行的serve进程退出时锁本来就会释放。之后任何经过DeviceLease.acquire的申请都会拒绝这张设备。unsettled,原因是namespace command outlived its deadline,devices列出被隔离的设备;ls <round-dir>/leases/*.quarantined列出所有被隔离的设备。nvidia-smi看不到进程)后删除该文件,设备即可再次分配。本 PR 不自动解除。queued,过了 lane 截止时间变成rejected,不扣 attempt。这是有意的:宁可不测,也不在可能还被占用的设备上测量。/proc,从不挂宿主的/proc。每次都有空的/tmp和/dev/shm。python -I启动,包路径由参数显式传入;候选目录和PYTHON*环境变量不进入sys.path,候选里放一个同名的inferrsi包也不会被导入。PATH、locale、TZ、PYTHONIOENCODING,以及计划里的env。max_user_namespaces为 0,或unshare实际被拒绝时,后端拒绝执行。namespaces_available会实际尝试一次unshare;在这类主机上,实机测试跳过而不是失败。claimed的 attempt 不退回。例子:AURA 上的集群搜索
下面的数字不是本 PR 的代码跑出来的。AURA 的搜索用的是另一份脚本,控制流相近:同一个 incumbent 分出多条 lane,每条只改一个参数,测量结果回到同一份记录。这里只用来说明集群能省多少墙钟时间。
min_chars15),约 4.6 小时跑完全部 7 代。两种方式用的 GPU 数量和接受规则不同,以上不是同等条件下的加速比。
验证与限制
6be668cd已 rebase 到main(76ca44a8)。import gate 在该 head 上本地重跑为harness_model_infra == ()(其后修复含 submit 边界、venv/系统 Python 的 runtime_roots、以及 apps 组装 assess),并适配inferrsi.contracts.RunSpec与新版run_experiment的assess/report端口。pytest tests/test_round_budget.py tests/test_confinement.py tests/test_parallel_round.py:rebase 后本机 focused 套件通过(含 close、目录指纹、validation 基础设施故障 →unsettled);本机没有可用的 user namespace,相关测试 skip。ruff check(本 PR 涉及文件)026f686d上的证据仍适用 confinement/lease 行为):fork run 43377269558,ubuntu-22.0453 passed,1 skipped(GPU)。ubuntu-24.04/上游ubuntu-latest因 AppArmor 会跳过 namespace 测试,真实 namespace 证据以 fork 22.04 为准。rebase 后若需可再跑一次探针。qualify_devices在 L20X 主机 GPU 0、1 上:型号匹配通过;故意填错型号时 ticket 保持queued、无账本。完整隔离测量因该机max_user_namespaces=0记unsettled。test_unshare_gpu_trial_sees_only_the_held_device与 torchprepare/submit/serve(及可选close)仍缺;需 Linux + NVIDIA + 可用 user namespace(原生 Windows 不可用)。close是否可作为 task: parallel optimization rounds with orthogonal lanes for multi-agent harnesses #249 的暂时收口实际 OS 隔离只在 GitHub 托管的 Ubuntu 22.04 + setup-python 3.11 上验证过,其他发行版或系统 Python 的加载器路径没有验证。