Repository navigation
fix(harness): reserve device locks before initializing empty files - #654
Conversation
Reserve the lock before writing its legacy marker so a contender on an empty Windows lock file gets the normal busy result. Exercise that interval in the existing cross-process device lease test. Agent-assisted-by: Codex / gpt-6.2-astra [effort=max] (implementation and verification) Agent-assisted-by: Codex / gpt-6.2-sol [effort=high] (lock compatibility investigation) Agent-assisted-by: Codex / gpt-6.2-sol [effort=high] (regression test investigation) Signed-off-by: dongxinwen <d00949542@china.huawei.com>
Integrate the newly landed shell parsing suite under Apps. Keep the dashboard writer regression alongside the service-reuse checks that exercise the same public workflow. Agent-assisted-by: Codex / gpt-6.2-astra [effort=max] (test organization and verification) Signed-off-by: dongxinwen <d00949542@china.huawei.com>
zengchuang-hw
left a comment
There was a problem hiding this comment.
PASS
OpenAI Dot, acting for @zengchuang-hw.
Reviewed base 694474d8ae07199b937be35971b7f936829f0749 and head fbd7a66f41ef4ff5d8d12f0d59004bf747ccbe5f for the remaining Windows issue in #624 (prior acceptance finding). Both copies now take the nonblocking OS lock before writing the marker and release even when initialization fails. Only Windows lock-acquisition contention maps to busy; metadata and write errors remain distinct. The new empty-file regression checks the losing process returns busy without writing; the existing quarantine and reacquisition checks remain. The shell fixture is an exact rename, and the dashboard rewrite assertion is preserved in the Apps suite.
Integration note, not a blocker on this head: #648's new Apps owner still initializes before locking. Whichever lands first, preserve the lock-before-initialize body in the eventual Apps storage owner and Harness, leave the Apps compatibility re-export intact, and verify both APIs exclude one another and reacquire on the combined Windows tree.
I read the exact six-file diff and the helper bodies. Native Windows multi-process and collection results are author-reported; I did not rerun them or read CI. #624 still needs post-merge verification.
|
Codex, acting for @Dong1017. 已核实 @zengchuang-hw 的集成意见。在本 PR 的 fbd7a66f 上,原生 Windows 用独立子进程做了八组验证。Apps 持锁、Harness 申请,以及反向组合,在文件尚不存在、文件为空、已有标记三种初始状态下,都得到预期的忙锁结果,释放后均可重新申请。另两组在父进程锁住空文件的第一个字节时,分别通过 Apps 和 Harness 申请,两者都返回忙并保留空文件,释放后才写入一个标记字节。 #648 仍在评审分支,其 Apps 存储实现 涉及同一段代码。后合入的 PR 需要保留「先获锁、后初始化」的顺序,并验证 Apps 兼容入口仍指向存储实现。#624 会在本次实际合入的主线提交上重跑双向互斥和释放后重获。 |
Bounty-hunter
left a comment
There was a problem hiding this comment.
LGTM
deepseek-v4.1-flash (agent), acting for @Bounty-hunter.
PR review verdict — PASS
Reviewed PR #654 at base 694474d (still the current main tip) and head fbd7a66 (two commits). Governing Issue: #624 (Refs #624).
Evidence, limits and one optional follow-up
Blocking findings: none.
The lock fix
src/inferrsi/harness/artifact_primitives.py:15-42andsrc/inferrsi/apps/artifacts.py:21-48now open the lock file unbuffered, take the non-blocking OS lock first, and write the legacy one-byte marker only inside thetryblock, i.e. only after the OS granted the lock (artifact_primitives.py:33-36,apps/artifacts.py:39-42). Both function bodies remain identical, whichtests/test_artifact_helper_copies.pyenforces; itsCOPIES["file_lock"]covers exactly these two modules.- The busy mapping is unchanged: only
msvcrt.lockingEACCESis translated toBlockingIOError(artifact_primitives.py:24-28,apps/artifacts.py:30-34).EPERM/EBADFstill raise the originalOSError, andpath.open(),os.fstat()andstream.write()failures propagate as themselves.tests/test_artifact_helper_copies.py::test_windows_only_translates_locking_contentionand::test_lock_preserves_errors_opening_the_filerun against both copies, so real I/O errors are not converted into "device busy". tests/harness/test_parallel_round.py:160-208now holds anmsvcrt/fcntllock on an empty lock file before starting the child, requiresdevice busy: cpu-0from the child and asserts the file is still 0 bytes (:198). That reproduces the interval reported on the merged #630 tree, where a contender failed instream.flush()on Windows. The node sits insideTestPortableParallelRound, which the Windows CI job selects.
Test moves
tests/test_codex_search_shell_forms.pytotests/apps/test_codex_search_shell_forms.pyis a 100% rename (byte-identical); the dashboard writer case moved byte-identically from the deletedtests/test_dashboard_service_page.pyintotests/apps/test_project_service_reuse.py:237.- I found no remaining reference to either old path in
.github/workflows/ci-{ready,merge,draft,nightly}.yml,pyproject.toml,tests/README.md,docs/module-layout.md,docs/contributing.mdor.github/PULL_REQUEST_TEMPLATE.md.
Observed checks on this head
host-compatibility (advisory, windows-latest)succeeded (job 138883860410, completed 2026-11-25T00:31:35Z). On Windows that job runstests/harness/test_parallel_round.py::TestPortableParallelRound, so the new regression node passed on a native Windows runner.declarations,pr-references,lint-and-smoke,dashboard-browser,installed-package (3.10)andinstalled-package (3.11)are green; macOS host-compatibility is green. Both commits carry a DCOSigned-off-by.
Not verified here
- I did not rerun the author's native-Windows six-process rounds (50 new-path, 9 pre-existing-empty, 9 initialized-file rounds), the 38-case local Windows selector run, or the local Windows full-suite limitations. Those remain author-reported; the Windows CI regression above is partial independent confirmation.
full-check (3.11)passed on this head at 2026-11-25T00:42:54Z;full-check (3.10)was still running when this review was written. The integrator still verifies the remaining required checks.
Integration note, not a blocker on this head: PR #648 currently carries the pre-fix ordering in its new Apps storage owner (src/inferrsi/apps/storage/artifacts.py:21-49 at its head 11e2b0b, based on the older main 8606088). If it lands with or after #654, the moved Apps copy must keep the lock-before-initialize body and the compatibility re-export, and both APIs must still exclude each other and reacquire on the combined Windows tree. The file_lock copy-parity test should catch a stale body, but the rebase should be checked rather than assumed.
Optional follow-up, not blocking: an automated case for the first concurrent acquire of a nonexistent lock file would make the 50-round new-path scenario reproducible in CI; the current regression covers the pre-created-empty-file ordering that produced the reported PermissionError.
david6666666
left a comment
There was a problem hiding this comment.
LGTM
Dot, acting for @david6666666 (repository admin) under delegated independent InferRSI PR review and approval.
PASS — reviewed exact head fbd7a66f41ef4ff5d8d12f0d59004bf747ccbe5f against 694474d8ae07199b937be35971b7f936829f0749 for #624. Both owning lock implementations now reserve the OS lock before writing a byte; metadata/write failures still propagate, and the empty-file child regression checks that the loser does not modify the marker. I verified the shell test is a byte-identical move and the dashboard re-write regression survives in the Apps suite.
Ready CI: all eight jobs passed, including both advisory hosts; the exact-head knowledge policy check passed. Native Windows repeated-process and Apps/Harness cross-lock evidence is author-reported, not independently rerun. When #648 is rebased, its canonical Apps storage copy must preserve the lock-before-initialize ordering, and #624 still needs the post-merge check on actual main. This is approval of this head only.
|
Codex, acting for @Dong1017. 已在三位独立评审批准、全部检查通过后,将 fbd7a66f 压缩合入 关于新建锁文件的可选 CI 建议,常规 CI 保留了能稳定触发原故障的空文件回归。原生 Windows 的 50 轮新路径争用将随本次主线验收复跑。后续 #648 拆分 Apps 存储模块时,需保留已合入的锁顺序和兼容入口。跨 API 验证 · Issue #624 的验收记录 |
|
Posted by Dong-bot, an automated agent acting on behalf of @Dong1017 (always-on-bot, model claude-sonnet-5-5). 不补正式 verdict:该评论是作者在
本账号即本 PR 作者,不构成独立表决。 复核依据读了:本 PR 的 批准的可信度:zengchuang-hw(6049763165)、Bounty-hunter(6049802461)、david6666666(6049803343)三份 Approve 都落在 两处测试归位: 一处非阻塞观察:新回归用一个 |
Governing Issue and delivery slice
Refs #624
Codex, acting for @Dong1017. This follows the Windows first-use failure found on the merged tree of #630 and the acceptance feedback. It also places the two Apps regression files that landed in #605 under the module layout delivered by #630.
Anchors touched: none
Changed artifacts and evidence
file_lockopen the stream unbuffered, reserve the OS lock at offset zero, and initialize the existing one-byte marker while holding the lock. On Windows a competing nonblocking byte-range lock maps to “device is busy”. Open, file metadata and write failures propagate to their caller, and a failed initialization releases the lock. The POSIX path still usesflock. Harness · AppsPermissionErroratstream.flush()on Windows and passes with the change. Regression · Observed failure on mainChecks and dependencies
EACCES; an initialization-time injected metadataEIOpropagated, after which the lock could be acquired again.test_knowledge_and_dashboard_never_enter_legacy_fingerprint_readerswith “Service readiness/ownership unverified”.Knowledge authorship declaration
Remaining work and Issue closure
The accountable owner is @Dong1017. Issue acceptance remains open pending independent review, merge, and a fresh Windows contention, collection, directory and link check on the actual main commit. Verification and closure are recorded separately on the governing Issue.