Repository navigation
Conversation
Normalize the Windows nonblocking acquire error in both session lock helpers. Keep the retryable export error consistent across platforms and cover both lock directions. Agent-assisted-by: Codex (author) Signed-off-by: Inference1 <3617237115@qq.com>
Dong1017
left a comment
There was a problem hiding this comment.
LGTM
PR review verdict — PASS
Reviewed base 9466bc8d910c9fef55d4a9e23ee1a82950280c30 and head cc6b0ff0cbec003aecafdfd28417f77be31aade2 (full diff, first review). No prior formal reviews and no outstanding CHANGES_REQUESTED were seeded. This Approve is the only review on this head. I also read #494, the governing issue.
What I verified in the diff
- Fix location:
apps/artifacts.pyandharness/artifact_primitives.pyget the same change, so both directions of the shared.session.lockare normalized. This follows david6666666's and amy-why-3459's request on #494. There is no Harness→Apps/Infra import, and the copy-sync convention is kept. - Narrow translation: only a
PermissionErrorwitherrno == EACCESraised bymsvcrt.locking(..., LK_NBLCK, 1)is converted toBlockingIOError(EAGAIN, ..., path), chained withfrom error. Other errnos are re-raised unchanged. Theopen()call is outside thetry, so open and path errors are not translated. This matches the #494 acceptance criteria and the "after the lock file opened" scoping. - Unit coverage (
tests/test_artifact_helper_copies.py), parametrized over everyCOPIES["file_lock"]module:- EACCES becomes
BlockingIOErrorwith errno EAGAIN and__cause__set. - EPERM and EBADF pass through as the identical exception object.
- A failed acquire calls
lockingexactly once, so there is no unlock or partial-lock state. - A retry then acquires and releases, with call args
[(NBLCK,1),(NBLCK,1),(UNLCK,1)]. FileNotFoundErroron a missing directory andPermissionErrorfromopen()are preserved.
- EACCES becomes
- Real cross-process tests:
test_session_lock_across_processes.pynow asserts the exact result{"acquired": False, "error": "BlockingIOError"}instead of onlyacquired is False. This holds for every parametrized holder/contender pair, so it covers both directions plus the release/re-acquire step.session_lock_probe.pynow asserts that the export returns a "writer is active" error. This replaces the old comment that allowed either exception type. - Stale references removed: the docstring pointer to #494 as a separate assertion is gone, consistent with the fix.
Not verified here (no execution in this review)
- I did not run the tests, and I did not see CI results.
- I did not run anything on real Windows. The EACCES-on-contention mapping rests on the #494 reproduction and on the mocked
msvcrttests. The real-lock tests run on Windows only if the Windows CI jobs include them. #494 asked for Windows and POSIX verification, so please confirm a Windows run oftests/test_result_delivery.py::test_progress_uses_committed_control_and_a_fixed_clockand the cross-process tests before merge. - I did not see
COPIES["file_lock"]or the fullfile_lockbody. I could not confirm that no other copy offile_lockexists that needs the same change. The copy-equality test would catch that in CI. EDEADLOCKis not reachable with the non-blockingLK_NBLCKmode, and the PR leaves it unmapped. I did not check other callers for reliance onPermissionError. This is optional follow-up context for the PR description.
Non-blocking: the merge ruleset still needs two eligible approvals and passing required checks.
Posted by Dong-bot, an automated agent acting on behalf of @Dong1017 (always-on-bot, model claude-sonnet-5-5).
zengchuang-hw
left a comment
There was a problem hiding this comment.
NO PASS
首次独立检视:9466bc8d910c9fef55d4a9e23ee1a82950280c30…cc6b0ff0cbec003aecafdfd28417f77be31aade2,对照 #494 的范围。代码方向正确:两份锁实现一致,只把 Windows 非阻塞取锁时的 EACCES 转成 BlockingIOError(EAGAIN),Apps 再映射成现有的 SnapshotBusy;打开、解锁和其他错误不走这条转换路径。
批准前还缺 #494 明确要求的原生 Windows 行为证据:让一个独立进程持有 .session.lock,确认 managed export 返回 writer is active 且不发布目录;释放后重试应成功发布。已有探针覆盖这些断言,可直接提供该场景在本提交上的结果。这里缺的是目标平台行为实测,不是 CI 状态,也不需要为了本次检视再改代码。
本轮已读五个变更文件,核对异常传递与两份实现;在隔离临时目录对提取的原实现验证了模拟 Windows 的 EACCES、EPERM、EBADF 和重新取锁,也实际验证了 Linux 跨进程争锁与释放后重取。未运行原生 Windows 或重跑完整导出套件。
|
First complete review: The two helper copies apply the same narrow translation: only a Blocking: #494 still requires native Windows evidence. The description reports Linux pytest results only. The new tests mock I read the five changed files and both helper bodies. I did not run a real Windows host. |
|
@zengchuang-hw @amy-why-3459 The native Windows run verifies the managed export case on the current review head,
Please re-review |
zengchuang-hw
left a comment
There was a problem hiding this comment.
PASS
同一提交 cc6b0ff0cbec003aecafdfd28417f77be31aade2 的证据增量复审,没有新代码提交。上轮 NO PASS 缺的是 #494 要求的原生 Windows 管理导出争锁验证;本次复审请求 已补齐。
我直接读取了专门的 Windows 验证任务日志:任务校验了完整 SHA 和原生 Windows,pytest 在 win32 / CPython 3.12.10 报告 22 passed,包含真实跨进程争锁的两个方向、管理导出及原始回归。对照固定测试源码,管理导出用例确实检查持锁时返回 writer is active、不发布目录,释放后重试并能回读 progress。本轮是独立核验证据,不是我在本机重跑 Windows;POSIX 行为沿用上轮的独立锁验证。未查看上游 Ready CI,也不判断合入。
|
@zengchuang-hw Thank you for checking the Windows evidence and recording your independent Approve on |
|
The approval stands for |
|
@Dong1017 Please confirm the applicable review format for @amy-why-3459 The native Windows log and the managed export assertions you requested are linked in the follow-up. Please record your independent verdict on |
|
Posted by Dong-bot, an automated agent acting on behalf of @Dong1017 (always-on-bot, model claude-sonnet-5-5). Decision: the applicable format is the repository rule. An approving review counts only if the first non-empty line is exactly
|
amy-why-3459
left a comment
There was a problem hiding this comment.
LGTM
PR review verdict — PASS
Same-head re-review of cc6b0ff (PR base 9466bc8), triggered by the native Windows evidence and re-review request in #546 (comment).
The previously blocking #494 request is resolved. I read the job log at https://github.com/Inference1/InferRSI/actions/runs/44885312620/job/136789214446: the follow-up commit a84c9b8 only adds the verification workflow, whose parent is this PR head; the job checked out and asserted HEAD cc6b0ff0cbec003aecafdfd28417f77be31aade2 on windows-latest (Windows Server 2025, CPython 3.12.10, platform win32) and reported 22 passed in 1.73s. That selection includes both cross-process lock directions, test_an_apps_export_of_a_valid_session_is_refused_while_a_harness_process_holds_it (the probe asserts writer is active, no destination directory, and a retry that publishes progress), and the original delivery regression. No new code was pushed to this PR head. I did not rerun a Windows host myself.
This Approve covers the Windows lock-translation change and the linked evidence, not a merge decision. I did not re-check the upstream Ready workflow.
There was a problem hiding this comment.
Technical / third-party verify (cursor App permission none — not write+ / dual / merge-ready).
Tip already has Dong1017 always-on + amy + zengchuang Approves — skipping tip re-Approve (dual-clean, head unchanged).
Fork Ready was stuck in action_required; tip Ready run was approved so the Ready lane can finish. Await Ready green; steward merge remains write+ / Dong-bot.
There was a problem hiding this comment.
Technical / third-party tip COMMENT (cursor App permission none — not re-Approve; tip already dual-clean Dong + amy + zeng).
Ready blocker: Ready full-check FAIL on test_recovered_attempt_does_not_trust_a_rewritable_declaration / retired inferrsi.infra.artifacts.digest (run 44884610073). Unrelated to Windows session-lock retryable mapping.
Unblock: #556 MERGED. Rebase/update onto main + Ready re-run, then write+ steward merge when green.
Bring in InferMatrixLab#556, which restores the recovery test to the Harness digest. The five-file Windows session lock patch is identical to the reviewed change. Agent-assisted-by: Codex (author) Signed-off-by: Inference1 <3617237115@qq.com>
zengchuang-hw
left a comment
There was a problem hiding this comment.
PASS
Incremental review: cc6b0ff0cbec003aecafdfd28417f77be31aade2 → 52c9e19288e3a69e286e4821ce03781c3b483cad. Previous review. The new head merges main@10ba7a55; the five PR files are byte-identical to the previously approved head, and all other changes match that base. The managed export entry point and lock path are unchanged; the added delivery test covers unrelated token projection, and the managed-export regression is unchanged.
For #494, I reran six focused cases with the exact lock helpers and a simulated Windows locking API: both copies translate EACCES to retryable EAGAIN, preserve EPERM/EBADF, and release after reacquisition. The earlier native Windows run on cc6b0ff0 still supports the unchanged cross-process and managed export paths; it is not a native Windows run of this new head. No new code blockers or non-blocking findings. I did not rerun native Windows or the full suite, or inspect CI.
Governing Issue and delivery slice
Refs #494
This patch follows the proposed lock-acquisition boundary and cross-process acceptance cases in the Issue. Apps and Harness now own separate copies of the lock helper after #535. Issue review
Problem
On Windows, a writer holding the managed campaign's
.session.lockcausesmsvcrt.locking(..., LK_NBLCK, 1)to raisePermissionError(EACCES). Delivery catchesBlockingIOErrorand the export returns a generic publication error for this case.What
Translate the Windows nonblocking lock-acquisition error to
BlockingIOError(EAGAIN)in both helper copies. Assert the error type and reacquisition in the existing cross-process test, and assert the retry message in the managed export probe.Why needed
An export can run while a campaign is committing evidence. Callers need the documented retry signal so they can wait for that commit and export a consistent snapshot.
Design and implementation
Only
EACCESraised at theLK_NBLCKcall is translated. The CRT reportsEDEADLOCKafter exhausting retries in the blocking modes. Opening the lock file, releasing the lock, and other failures keep their original error paths. Both helpers keep the same source and lock byte, and Apps continues to translate contention throughSnapshotBusy. CRT locking return codesKnowledge authorship declaration
Not applicable. The patch touches the Apps and Harness lock helpers and their tests.
Checks and dependencies
windows-latest, Python 3.12) oncc6b0ff0. 22 passed. The run covered the artifact helpers, both cross-process contention directions, reacquisition and the managed export regression. Native Windows jobruff check src tests toolsandgit diff --checkpassed.Remaining work and Issue closure
Independent review and the upstream Ready workflow are pending. Issue acceptance stays with its owner.