Skip to content

lane-worktrees report never blocks on a FIFO or aborts on a NUL path - #70

Merged
mergify[bot] merged 5 commits into
mainfrom
fix/lane-worktrees-report-fifo-l3
Nov 15, 2026
Merged

mergify[bot] merged 5 commits into
mainfrom
fix/lane-worktrees-report-fifo-l3

Conversation

@brettheap

@brettheap brettheap commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Lane: openRepoTools-3
Claim: none (lane 3's own lane-tooling fix; Brett's per-PR word, Q5, opensoft/openRepoTools#165 6866656915)

Lane tooling, outside feature 007's task sets. The estate report of lane-worktrees (sweep --all --dry-run --report) could sit for most of a day in a plain open() of a FIFO, and on the real estate it also stopped with "INTERNAL ERROR" on a .git pointer that names a path holding a NUL byte. This PR makes the report open only regular files, and read every record or answer that names a NUL-byte path as one it could not read, so a report completes and says what it skipped. Brett Heap gave his word for this PR on 2026-11-13, and it lands through the openrepotools-code merge queue once it has the gates in "Landing".

Head 279aae82, base main c62ba9c, 0 behind. The review of this PR at 62fe17f0 found one BLOCKING finding, one SHOULD and one NIT, and 7d2b3ee9 fixes all three. Part 3 of "What" has the fixes, and "Body corrections" lists each thing this body now says that it did not before.

What

1. A FIFO held two reports for most of a day (af9bcd4). Two sweep --all --dry-run --report runs that lane-start detached, from 2026-11-11T21:27Z and 2026-11-12T01:32Z, sat in wait_for_partner, which is the kernel holding an open() of a FIFO until its other end opens. They had no child and no regular file open, so nothing timed them out. Every file the report opens itself was a plain open(): sweep.conf, a .git pointer, commondir, a git config, alternates, a lane's snapshot and inventory records, a sandbox's .lock and run marker, an archive's MANIFEST.sha256, the workspace's .gitignore and the --post target. On a scratch estate, a FIFO at each one of them held the report until timeout ended it.

The fix is open_regular. It refuses what stat says is a FIFO, a socket or a device before any open, and opens the rest O_NONBLOCK and asks fstat again, so one swapped in between cannot hold the read either. That swapped-in one is opened, for its fstat alone, and closed unread, so a row says "skipped, never read" and not "never opened" (7d2b3ee9, the review's NIT). The refusal is an OSError (NotRegular), which each of those readers already catches as a read that failed. load_conf and _lock_pid then go on as they do for an absent file, so the report's own row is what tells the two apart: every path refused is a row of "Records the report could not read". A directory, or a path stat cannot answer, still goes to open() and fails exactly as before. A --post target that is a FIFO is the documented exit 1, with the report printed. The change moves 13 call sites to open_regular.

2. A NUL byte turned the whole report into an internal error (f12e8d4). With the FIFOs skipped, a read-only replay of the report's walk and pointer reads over the real estate went on to the 37,875th of 60,968 repositories. Its .git holds a gitdir: line with a NUL byte inside the path, and the replay stopped there with "ValueError: embedded null byte". The OS refuses such a path with a ValueError and not an OSError, so no reader caught it, and main turned it into "INTERNAL ERROR, nothing was changed", exit 2, with no report. The replay met 20 such records, gitdir: lines and commondir files, which are test fixtures left in the estate.

Each place where a path read out of a file meets the OS now takes that ValueError as a record it could not read. _nul_record names it in SKIPPED (a row of "Records the report could not read") and in unread where one is kept, so a leaning it may hide is unknown and never none:

  • git_common_dir: a gitdir: line naming such a path is no pointer, and is unreadable.
  • dependents_map: such a path in commondir, in an alternates line or in a remote's URL leaves the repository's leaning unknown.
  • archive_ledger: a rescues.tsv row holding a NUL byte is not origin, branch, sha, so the archive is kept, as any malformed row keeps it.
  • Report._record: an inventory record whose path holds a NUL byte is a record not read, where os.path.isdir's False read as a tree that is gone.
  • The workspace hygiene row: a .gitignore that is not a regular file is said to be one, and no printf ... >> .gitignore is offered, since onto a FIFO it would hang whoever pasted it.

The replay over the real estate, run again with this code, completed: 60,984 repositories, 6 FIFOs and 20 NUL-byte records skipped, no exception. That figure is from f12e8d4's message. It is a read-only replay that is not in the test suite, and none is recorded for the later fix: part 3 is verified by the tests and mutants below.

3. The review of this PR at 62fe17f0 and its fix (7d2b3ee9). The review found one BLOCKING finding, one SHOULD and one NIT.

  • BLOCKING, the workspace root. lanes-edit.sh workspace-root's answer went unchecked to real() and git -C, so an answer holding a NUL byte still ended the report "INTERNAL ERROR", exit 2 (at 62fe17f0 the first to raise is register_lane_dirs' git -C). Helper.workspace_root (lane-worktrees:706-724) now asks the helper once and checks the answer before any caller makes a path of it. An answer holding a NUL byte is dropped: the root is '', which is the workspace not found, and every caller already reads that. _nul_record names the answer in "Records the report could not read". _foreign, _closed_lanes, _workspace_hygiene, register_lane_dirs, MergeEvidence.landed and fetch_register all read that one checked root.

  • The same search over the rest of the report's path for any value from outside that can reach a path operation holding a NUL byte found four more. Each is now named, and none is silent:

    • project_legs (lane-worktrees:2139-2144): a NUL byte in the helper's answer makes the manifest one not read. Before, Leg's real() raised it to INTERNAL ERROR.
    • archive_ledger (5283-5286): a NUL byte in a MANIFEST.sha256 row keeps the archive, with a reason. Before, the row was printed with its raw NUL byte.
    • Report._recorded_parents (5466-5472): a lane's recorded dir holding a NUL byte is named as unread. Before, it was dropped in silence. Git prints a log's lines past its first 8000 bytes as text, so such a dir can reach this point.
    • Report._closed_lanes (5744-5752): a lane log that git grep reads as binary is named, and whether its lane ended is unknown. Before, its ENDED line was missed in silence.

    The gitdir:, commondir, alternates, remote-URL, rescues.tsv and inventory-path cases were already handled at 62fe17f0 (f12e8d4).

  • NIT, the wording. "skipped, never opened" was false for a FIFO swapped in after the stat. The row now says "skipped, never read", and open_regular's docstring and the existing FIFO test's assertion match it.

  • SHOULD, the tests. The tests held a FIFO with no writer, a gitdir: line and commondir, so dropping the socket or device checks, O_NONBLOCK, or most of the NUL catches left every test green. The new tests are listed under "Tests".

Two files change against main, +731 and -26: lane-worktrees (+179, -26) and tests/test_lane_worktrees_report.py (+552, -0).

The commits

The head is five commits ahead of main c62ba9c: three of the PR's own and two merges that refresh its base for the code queue.

  • af9bcd4: open_regular, its use at each reader, and the FIFO test.
  • f12e8d4: the NUL-byte records, the .gitignore row (the FIFO test now holds it), and the NUL-byte test.
  • 62fe17f0: the merge of main a15a6b54. It changes nothing in the PR's two paths.
  • 7d2b3ee9: the fix for the review at 62fe17f0: the workspace root, the four more NUL-byte readers, the wording, and the new tests.
  • 279aae82: the merge of main c62ba9c, which is code#69's merge. It changes nothing in the PR's two paths.

The queue merges with merge_method: merge (.mergify.yml:97), so main keeps the five commits as written.

Why

Found by lane 3 on 2026-11-12. The first sign was the two stuck daily reports: both sat in wait_for_partner, with no child and no regular file open. A scratch estate with a FIFO at each file the report reads reproduced the hang. The replay over the real estate, run read-only with the FIFOs skipped, then found the NUL-byte records. The review of this PR at 62fe17f0 then found the one outside value still unchecked (workspace-root's answer), four more NUL-byte readers by searching for the same fault, a skip row that claimed more than was true, and tests that left each guard unheld. 7d2b3ee9 is that fix.

Tests

Eight test functions in tests/test_lane_worktrees_report.py are this PR's, which are 18 items. The first two are from af9bcd4 and f12e8d4. The other six, 16 items, are from 7d2b3ee9.

  • test_a_fifo_where_the_report_reads_a_file_is_skipped_and_named_never_waited_on (af9bcd4; its assertion is reworded to "never read" by 7d2b3ee9). It makes a FIFO at eight paths: a lane's snapshot record, an inventory record, a .git that is no directory, a sandbox's .lock, an archive's MANIFEST.sha256, sweep.conf, the workspace's .gitignore and the --post target. It runs sweep --all --dry-run --report with a 120-second limit and fails if the report blocks. It requires exit 1 (the documented --post refusal) with the report printed, a "a FIFO, not a regular file: skipped, never read" row for each path but the --post one, a hygiene row that says the .gitignore is a FIFO and offers no printf or >>, and the estate unchanged afterwards. A git config, commondir or alternates is git's own read too, where a FIFO costs git's timeout, so none is in this test.
  • test_a_git_pointer_naming_a_nul_byte_path_is_unreadable_never_an_internal_error (f12e8d4). One pointer's gitdir: line holds a NUL byte, and so does the commondir another pointer leads to. Each is a row of "Records the report could not read", the report exits 0 with no "INTERNAL ERROR", no NUL byte reaches its output, and the estate is unchanged.
  • test_a_file_swapped_for_a_fifo_between_its_check_and_its_open_is_skipped_unread (new). The race. A hook on the os.stat call that open_regular itself makes for a lane's snapshot swaps a FIFO with no writer in for the regular file, after the stat and before the open(). It is deterministic, with no timing loop. The report must end, name the snapshot "a FIFO, not a regular file: skipped, never read", and exit 0. Without O_NONBLOCK the open waits for ever, and without the fstat check the FIFO reads as an empty snapshot with no row.
  • test_a_socket_device_or_fifo_with_data_where_the_report_reads_a_file_is_never_read (new, 4 items: socket, character device, block device and FIFO holding data). Each kind stands at four files the report reads: sweep.conf, a lane's snapshot, a .git that is no directory and the workspace's .gitignore. The socket is a real one; the character and block devices are links to /dev/null and to a block device under /dev (that item is skipped, named, where the host has none); the FIFO is one the test holds open with bytes in it. The report must end, name each path skipped and never read, offer no >> .gitignore, change nothing, and leave every byte in the FIFOs unread.
  • test_open_regular_opens_reads_and_writes_a_regular_file_exactly_as_open_does (new). open_regular against the plain open() it replaced, over every read mode the report uses (UTF-8 strict, surrogateescape, replace, and rb, each by read and readline) on every kind of path it meets: UTF-8, Latin-1, NUL bytes in the content, empty, large, a directory, a file it may not read and a missing path. It also compares --post's write over a new file, an old file and a directory. Each pair must give the same data, the same exception (type, errno, strerror, filename), the same file left behind with the same mode, and a descriptor in the same state: blocking and not inherited. Nothing is recorded as skipped.
  • test_the_report_over_regular_files_is_the_report_plain_open_gave (new). One estate is reported twice and --posted: once as it is, and once with every open_regular given back the plain open() its reader called before this PR. Its regular files go every way a read can: a byte that is not UTF-8, an empty .git, a record that names no path, a directory where a record is read, a snapshot it may not read, and an older report the post writes over. The exit, the stderr, the stdout and the posted report must be the same, every line but the first, which carries the time.
  • test_a_workspace_root_holding_a_nul_byte_is_named_asked_once_never_an_internal_error (new). The helper answers workspace-root with a NUL byte in it. The report exits 0 with no "INTERNAL ERROR" and no NUL byte printed, names the answer as a record it could not read, reads no workspace through it, changes nothing, and the helper log shows workspace-root asked exactly once.
  • test_each_record_holding_a_nul_byte_is_named_never_an_internal_error (new, 8 items, one source each: alternates, remote-url, inventory-path, rescues-row, manifest-row, project-legs, register-dir and register-binary-log). Each record is named where the report says what it could not read or keep. The report exits 0 with no "INTERNAL ERROR" and no NUL byte printed, and the estate is unchanged. The register-dir source puts its NUL byte past the first 8000 bytes that git grep sniffs for binary.

Verification

Every run is through tests/run.sh, with the selector lane_worktrees or repo_hygiene unless it says otherwise. Targeted verification is "feedback, never full integration or release acceptance" (.github/ci/task-set-delivery.md:39-40). The four full gates in "Landing" are the acceptance.

  • 62fe17f0, the head before the fix, with its own tests: 382 passed, 18 skipped, 5020 deselected, in 289 s.

  • The new tests on 62fe17f0's code (its lane-worktrees with the new test file, selecting the six new functions and the FIFO test): 10 failed, 6 passed, 1 skipped, 5419 deselected.

    • The 10 failures are the FIFO test on its new wording, the race, the socket, character-device and FIFO-with-data cases, the workspace root, and the manifest-row, project-legs, register-dir and register-binary-log cases.
    • The 6 passes are the two parity tests and the four NUL cases 62fe17f0 already handled: alternates, remote-url, inventory-path and rescues-row. The skip is the block device.
  • 7d2b3ee9's code, with its own tests (lane-worktrees sha256 5f18a3bd2dd2dfc4d39ccb7fb40a83c11f71e19a69eef95078f9d2782f3fd83e, the test file's 9ec0d006fd67490b2990290fede9ec8e2e02d3445bfe864cb0b49de651179863, both the same blobs at the head): 397 passed, 19 skipped, 5020 deselected, exit 0, in 463 s. Against the baseline that is +15 passed and +1 skipped, the 16 new items, with no failures. The skip is the block-device item: that host has no block device under /dev.

  • Ten mutants of that code, each removing one guard, in three runs: all ten killed, none survived.

    Mutant The guard it removes Killed by
    M1 O_NONBLOCK on the open the race test, which timed out in the open()
    M2 the fstat check after the open the race test, which found no row
    M3 the socket check the socket case
    M4 the character-device check the character-device case
    M5 setting the descriptor blocking again the open_regular parity test
    M6 the NUL catch on the alternates read the alternates case, and the git-pointer test, whose commondir NUL byte meets that read first
    M7 the NUL catch on a remote's URL the remote-url case
    M8 naming an inventory record's NUL path the inventory-path case
    M9 refusing a rescues.tsv row with a NUL byte the rescues-row case
    C1 every text read forced to surrogateescape both parity tests

    The workspace-root, project-legs, manifest-row, recorded-dir and lane-log fixes are held by the new tests failing on 62fe17f0's code (above), not by a mutant.

  • The independent review's run at the exact head 279aae82, in a clean clone: 409 passed, 19 skipped, 5068 deselected, exit 0, in 324.62 s (log sha256 66ddc535571af1fc0113713f8fd73706d22721633b40472cfa7a10ccf27aa74d). Of this PR's 18 items, 17 passed and 1 skipped (the block device, for the same reason). The 12 more passes than the run above are the 12 items of test_the_escaped_quote_rule_flags_the_old_quoted_line_and_not_the_new_one in tests/test_repo_hygiene.py, which main gained with code#69 and the selector's repo_hygiene takes in. The skips outside this PR are the 18 that were there before.

  • History, superseded. https://github.com/opensoft/openRepoTools-code/actions/runs/43254453700, on verify/l3/lwt-fifo-f12e8d4 (head e6262ecc, a commit that carries only trailers on f12e8d4 and has the same tree), PostgreSQL off: 382 passed, 0 failed, 18 skipped. It is cut from aa93f99, so it was over aa93f99's tree, before 7d2b3ee9 and before either refresh merge.

  • The head is the merge with main. git rev-list --left-right --count c62ba9c...279aae82 prints 0 5, and git diff --stat c62ba9c 279aae82 lists the two paths above and nothing else (+731, -26). The reviewer's run is over that tree, 4a6e1a6256c82a067e8cfc7e6bf53dceead863f9. Main c62ba9c is an ancestor of the head (git merge-base --is-ancestor), so merging the head into main while main stays at c62ba9c gives that same tree.

Task-set fields

.github/ci/task-set-delivery.md:57-59 says to "assign each task to one set and one PR. Record set ID, outcome, task IDs, immediate predecessor, fast verification command and safe intermediate state." This change has no task in a tasks.md, and the fields are recorded anyway.

  • Set ID: none — lane tooling, outside 007's task sets.
  • Outcome: the estate report opens no FIFO, socket or device and aborts on no NUL-byte path, whether the path comes from a file the report reads or from the answer of lanes-edit.sh (workspace-root, project-legs), a MANIFEST.sha256 row, a lane's recorded dir or a lane log that git grep reads as binary. It names each such path as a row of "Records the report could not read", and a report that could hang or exit 2 on one ends with its other rows and exit 0 (or the documented exit 1 for a --post that cannot be written).
  • Task IDs: none.
  • Immediate predecessor: code main c62ba9c, the merge of lane tools: quoted() and lane-end read a single quote back on bash 3.2 #69 at 2026-11-14T17:17:27Z. The head 279aae82 merges it, so the branch is 0 behind and 5 ahead. It was cut from aa93f99 and brought up to main twice: 62fe17f0 merged main a15a6b54 and 279aae82 merged main c62ba9c. Neither merge touched the PR's two paths: the 13 files main changed from a15a6b54 to c62ba9c do not include them, and git diff --stat aa93f99 c62ba9c -- lane-worktrees tests/test_lane_worktrees_report.py is empty, with the same blob for each at both commits.
  • Fast verification command:
    tests/run.sh -k "a_fifo_where_the_report_reads_a_file or a_git_pointer_naming_a_nul_byte_path or swapped_for_a_fifo_between_its_check or a_socket_device_or_fifo_with_data or opens_reads_and_writes_a_regular_file or report_over_regular_files or a_workspace_root_holding_a_nul_byte or each_record_holding_a_nul_byte"
    The eight words select this PR's eight test functions, which are 18 items, and no others under tests/. At the head (2,261 test functions in 80 files) that is counted with pytest's own Expression over each function's file and name, and the 18 items are the ones in the reviewer's run above.
  • Safe intermediate state: main at c62ba9c is safe with or without this PR. Nothing depends on it and it depends on nothing. For a regular file the read is the same open() with a non-blocking flag that _opener clears again, and the two parity tests hold that, byte for byte and descriptor for descriptor. The report is a dry run that every new test requires to leave the estate unchanged. Reverting the PR restores the hang and the abort, and nothing else.

Landing

  • It goes through the merge queue. It is an independent PR targeting main (task-set-delivery.md:47). Its two paths are a known root command (lane-worktrees) and a safe file path under tests/, which the openrepotools-code queue accepts (.github/ci/batching-pilot.md:139-140). Neither is a workflow, queue configuration, pin or gitlink, package-control file or unknown path, which "need separate normal reviewed landing, not this queue" (task-set-delivery.md:48-49; batching-pilot.md:141-143). The branch name and both paths also pass the conditions of the openrepotools-code rule in .mergify.yml:98-110 (head~= at 103, #files>=1 at 104, -files=src/openrepotools/_release.py at 105, -files~= at 106), read offline at c62ba9c and run over the branch name and the paths. The rule added at 119-142 in the same file, openrepotools-claude-current, takes only claude-current and tests/test_claude_current.py (138), so it is not this PR's queue. .mergify.yml, task-set-delivery.md and batching-pilot.md have not changed between 660459fa and c62ba9c, so the line numbers in this section are the ones this body gave at 660459fa, except for delivery-cutover.md below.

  • Brett Heap has given his word for this PR, and the gates are still to pass. On 2026-11-13, by dialog in lane 3's session, Brett answered Q5, on lane 3's two lane-tooling fixes, with "Open both, land on gates (Recommended)". The option read: "Open both PRs on opensoft/openRepoTools-code. Each lands through the merge queue once it has an independent READY, green full CI and your terminal Codex review (lane 3 sends one prompt per PR)." Lane 3 relayed it on Amendment 22 act 2: the SQL register under lanes-edit.sh — mode=primary writers in one transaction each, the estate switch and lanes/STORE, the write journal and the renderer (one mirror commit per write), exit 69, fail-closed readers, lanes-index import/rollback, SERIALIZABLE claim order, and the agreement tests openRepoTools#165 as comment 6866656915 (Amendment 22 act 2: the SQL register under lanes-edit.sh — mode=primary writers in one transaction each, the estate switch and lanes/STORE, the write journal and the renderer (one mirror commit per write), exit 69, fail-closed readers, lanes-index import/rollback, SERIALIZABLE claim order, and the agreement tests openRepoTools#165 (comment)). Opening this PR queues nothing: the queue is "not an automatic merge rule or fast-only CI" (batching-pilot.md:134-135). The gates, each at the exact head:

    1. An independent READY review at the exact head.
    2. Green full CI: the four gates below.
    3. Brett's own Codex review of the exact head, run from his terminal with lane 3's prompt, and accepted by the local-review receipt in the section "Exact-head local review receipts" of .github/ci/delivery-cutover.md (lines 237-305 at c62ba9c; main added 44 lines above the section after 660459fa). The receipt is a new top-level PR comment from an existing repository writer, and it names the head and base it reviewed (lines 243-244 and 253-254).

    After those gates comes the queue preflight in batching-pilot.md:145-154: merge authority and lane claims, the exact head, base and changed paths, all four full gates, exact-head Codex review, and unresolved threads. For this queue it is an operator attestation, not service-enforced Codex/SHA proof (lines 152-154). Only after it does a repository writer post the named queue command (lines 154-160; its text is not printed here).

  • The review prompt is not in this body. Lane 3 sends it to Brett, one prompt per PR, once the head is final. task-set-delivery.md:74-76 holds that "A quota response, Copilot, or old-head review is not approval", so a review of an older head does not count. The review at 62fe17f0, whose findings 7d2b3ee9 fixes, is one of those.

  • Full CI. guard-launch-mode, tests, tests-no-submodule and package run on this head and must pass (.mergify.yml:107-110). This PR is not in the claude-current scope that delivery-cutover.md:44-46 describes, so it keeps full CI: "All other work retains full CI" (task-set-delivery.md:6-9).

  • No Depends-On line. This PR has no predecessor in this repository.

Not in this PR

  • Plain open() calls that stay. Other calls stay as they were, among them the reads in sha256_of, Sweep._other_lanes, worktree_admin, reflog_shas and _gitdir_pointer, and three readers of /proc. This PR moves 13 call sites to open_regular and makes no claim about the rest.
  • No release, tag, pin or installed-copy change.
  • Lane 3's other lane-tooling fix, code#69 (fix/quoted-bash32-l3), has merged as main c62ba9c, and this head contains it. The two shared no file, and this PR's diff against main does not touch its five.

Body corrections

  • 2026-11-14, after the independent review at the head 279aae82 (its SHOULD-1). This body described f12e8d4 and had not followed the PR to 62fe17f0, 7d2b3ee9 and 279aae82. The code and the head did not change in this refresh. Corrected:
    1. Files and counts. It said "Two files change, +230 and -23". That was true of f12e8d4 over aa93f99. The head is +731 and -26 against main: lane-worktrees +179 -26, the test file +552 -0.
    2. Commits. It said "The two commits". The head has five: three of the PR's own (af9bcd4, f12e8d4, 7d2b3ee9) and two merges of main (62fe17f0, 279aae82).
    3. What. It omitted the fixes of 7d2b3ee9: the workspace root, the project legs, the manifest row, the recorded dir and the binary lane log, and the "never read" wording. Part 3 of "What" now has them.
    4. The skip row. It quoted "skipped, never opened". The code says "skipped, never read".
    5. Tests. It listed two tests. The PR has eight test functions, 18 items, and the list names each. The line "Each test passed by a direct run of its node id" is replaced by the runs under "Verification".
    6. Verification. It quoted one run, 382 passed on aa93f99's tree (GitHub run 43254453700). That run stays, marked as superseded, and the evidence is now the baseline at 62fe17f0 (382), the fix (397), the new tests on the old code (10 failed, 6 passed, 1 skipped), ten mutants all killed, and the independent review's run at the head (409 passed, 19 skipped).
    7. The trial merge. It said no test was run on the merged tree. The head is that merge, and the reviewer's run is over it.
    8. Immediate predecessor. It said main 660459fa, 14 behind, 2 ahead. It is main c62ba9c, 0 behind, 5 ahead.
    9. Fast verification command. Its two words selected only the two older tests. Eight words now select all eight functions, 18 items, and no others at the head.
    10. Line numbers. The lines cited in delivery-cutover.md moved when main gained 44 lines above the receipts section: 193-261, 199-200 and 209-210 at 660459fa are 237-305, 243-244 and 253-254 at c62ba9c. The other cited files were re-read at c62ba9c and did not change.
    11. "Not in this PR". It said this PR is independent of branch fix/quoted-bash32-l3. That branch has merged, as code#69, and the head contains it.
  • 2026-11-13, after the independent review at the same head f12e8d4. This body said each reader takes the refusal "never as a file that is absent". load_conf and _lock_pid return the same value for a refused file as for a missing one, and only the report's row tells them apart. The code and the head did not change.

🤖 Generated with Claude Code

brettheap and others added 2 commits November 12, 2026 14:39
…ecause a plain open() of a FIFO held two daily reports in wait_for_partner for most of a day

Two `sweep --all --dry-run --report` runs that lane-start detached, from
2026-11-11T21:27Z and 2026-11-12T01:32Z, sat in `wait_for_partner` - the
kernel holding an open() of a FIFO until its other end opens - with no
child and no regular file open, so nothing timed them out. Every file the
report opens itself was a plain open(): sweep.conf, a `.git` pointer,
`commondir`, a git config, `alternates`, a lane's snapshot and inventory
records, a sandbox's `.lock` and run marker, an archive's MANIFEST.sha256,
the workspace's `.gitignore` and the `--post` target. On a scratch estate a
FIFO at each one of them held the report there until `timeout` ended it.

`open_regular` refuses what `stat` says is a FIFO, a socket or a device
before any open, and opens the rest O_NONBLOCK and asks `fstat` again, so
one swapped in between cannot hold it either. The refusal is an OSError,
which each of those readers already takes as a read that failed and never
as a file that is absent, and every path refused is a row of "Records the
report could not read". A directory, or a path `stat` cannot answer, still
goes to open() and fails exactly as before. A `--post` target that is a
FIFO is the documented exit 1, with the report printed.

Test: tests/test_lane_worktrees_report.py::test_a_fifo_where_the_report_reads_a_file_is_skipped_and_named_never_waited_on
- passed by a direct `python3 -m pytest <node id>` (1 passed).

Lane: openRepoTools-3
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…s a NUL-byte path as unreadable, because past its FIFOs the real estate's first such `.git` made the whole report an INTERNAL ERROR, exit 2, with no report

With the FIFOs skipped (af9bcd4), a read-only replay of the report's walk and
pointer reads over the real estate went on to repository #37875 of 60,968,
whose `.git` reads `gitdir: ../m<NUL>x`, and stopped there with "ValueError:
embedded null byte" - the OS refuses a path holding a NUL with a ValueError,
not an OSError, so no reader caught it, and `main` turns it into "INTERNAL
ERROR, nothing was changed". The replay met 20 such records: `gitdir:` lines
and `commondir` files, test fixtures left in the estate.

Each place in the report's path where a path read out of a file meets the OS
now takes that ValueError as a record it could not read, named by
`_nul_record` in SKIPPED (a row of "Records the report could not read") and
in `unread` where one is kept, so a leaning it may hide is unknown, never
none:

- `git_common_dir`: a `gitdir:` line naming such a path is no pointer, and
  unreadable;
- `dependents_map`: such a path in `commondir`, in an alternates line or in a
  remote's URL leaves the repository's leaning unknown;
- `archive_ledger`: a rescues.tsv row holding a NUL is not origin, branch,
  sha, so the archive is kept, as any malformed row keeps it;
- `Report._record`: an inventory record whose path holds a NUL is a record
  not read, where `os.path.isdir`'s False read as a tree that is gone.

And the workspace hygiene row: a `.gitignore` that is not a regular file is
said to be one, and no `printf ... >> .gitignore` is offered, which onto a
FIFO would hang whoever pasted it.

The replay over the real estate, run again with this code, completed:
60,984 repositories, 6 FIFOs and 20 NUL-byte records skipped, no exception.

Tests, run by node id with a direct `python3 -m pytest`:
- tests/test_lane_worktrees_report.py::test_a_git_pointer_naming_a_nul_byte_path_is_unreadable_never_an_internal_error
  (new): passed.
- tests/test_lane_worktrees_report.py::test_a_fifo_where_the_report_reads_a_file_is_skipped_and_named_never_waited_on
  (now also holds the `.gitignore` row): passed.

Lane: openRepoTools-3
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@sourcery-ai

sourcery-ai Bot commented Nov 13, 2026

Copy link
Copy Markdown

Sorry @brettheap, you've used your own review budget of 250,000 diff characters for the last 7 days.

You can request another review in 18 hours and 27 minutes by commenting @sourcery-ai review. Upgrade to get a review now.

@sourcery-ai

sourcery-ai Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Implementation

Add regular-file-only opening and handle NUL-bearing paths throughout the estate report so special files and malformed records are reported instead of hanging or causing an internal error.

  • lane-worktrees L367-438, L707-724, L1397-1410 (+24 small edits)

Tests

Add coverage for FIFO and special-file handling, the stat/open race, regular-file parity, and NUL-bearing paths across report inputs.

  • tests/test_lane_worktrees_report.py L28-33, L750-1298

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

brettheap and others added 3 commits November 14, 2026 01:51
…resh its base for the code queue

Code main's tip is a15a6b5 (#74). The code queue's check needs the pull request's base to be main's tip and main to be an ancestor of its head (.github/ci/delivery_verify.py:296 and :299 at code 908d815, unchanged at a15a6b5). The merge is clean, and the pull request's own diff against main is unchanged: its patch-id is 956b970ef978932a6da4c0bde2008150de942894 before and after.

Lane: openRepoTools-3
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…nswer, manifest row, recorded dir or lane log holding a NUL byte, because one such workspace-root answer still ended it INTERNAL ERROR, exit 2

The review of #70 at 62fe17f found one BLOCKING
finding, one SHOULD and one NIT. Each is fixed here. Line numbers are this
commit's unless they say "at 62fe17f".

BLOCKING (lane-worktrees:5632 at 62fe17f). `lanes-edit.sh workspace-root`'s
answer went unchecked to `real()` and `git -C`. The OS refuses a path holding
a NUL with a ValueError, not an OSError, so no reader caught it, and the
report ended "INTERNAL ERROR", exit 2. On 62fe17f the first to raise is
`register_lane_dirs`' `git -C`, before line 5632. `Helper.workspace_root`
(lane-worktrees:707-724) now asks the helper once and checks the answer before
any caller makes a path of it. An answer holding a NUL is dropped, the root
is '' (the workspace not found, which every caller already reads), and
`_nul_record` names it in "Records the report could not read". `_foreign`,
`_closed_lanes`, `_workspace_hygiene`, `register_lane_dirs`,
`MergeEvidence.landed` and `fetch_register` all read that one checked root.

The rest of the report's path, searched for any other value from outside
that can reach a path operation holding a NUL:
- `project_legs` (2139-2144): a NUL in the helper's answer makes the manifest
  one not read. Before, `Leg`'s `real()` raised it to INTERNAL ERROR.
- `archive_ledger` (5283-5286): a NUL in a MANIFEST.sha256 row keeps the
  archive, with a reason. Before, the row was printed with its raw NUL.
- `Report._recorded_parents` (5466-5472): a lane's recorded `dir` holding a
  NUL is named. Before, it was dropped in silence.
- `Report._closed_lanes` (5744-5752): a lane log git grep reads as binary is
  named. Before, its ENDED line was missed in silence.
The `gitdir:`, `commondir`, alternates, remote-URL, rescues.tsv and inventory
path cases were already handled at 62fe17f (f12e8d4).

NIT (lane-worktrees:382). "skipped, never opened" is false for a FIFO swapped
in after the stat, which is opened O_NONBLOCK for its `fstat` alone. The row
now says "skipped, never read"; `open_regular`'s docstring (399-412) and the
existing FIFO test's assertion (tests/test_lane_worktrees_report.py:805)
match it.

SHOULD (tests/test_lane_worktrees_report.py:751 at 62fe17f). New tests, from
tests/test_lane_worktrees_report.py:850:
- the race: a hook (REPORT_SEAM) on `open_regular`'s own `os.stat` call swaps
  a FIFO in after the stat. It is deterministic, with no timing loop;
- a socket, a link to /dev/null, a link to a block device (skipped, named,
  where the host has none) and a FIFO held open with bytes in it, each at
  four files the report reads; the FIFO's bytes must survive unread;
- `open_regular` against plain `open` for every read mode and path kind the
  report meets, and `--post`'s write;
- the whole report over regular files against one where every
  `open_regular` is given back the plain `open()`;
- a workspace root holding a NUL, asked once;
- eight NUL-bearing record sources, one at a time.

Verification, every run through tests/run.sh:
- 62fe17f, -k 'lane_worktrees or repo_hygiene': 382 passed, 18 skipped,
  5020 deselected
- this commit, same selector: 397 passed, 19 skipped, 5020 deselected; the
  16 new items are the +15 passed and the +1 skip (no block device on the
  host)
- the new tests on 62fe17f's code: 10 failed, 6 passed, 1 skipped. The 10 are
  the socket, character-device and FIFO-with-data cases, the race, the
  workspace root, the project-legs, manifest-row, register-dir and
  register-binary-log cases, and the existing FIFO test on its new wording.
  The 6 that pass are the two parity tests and the four NUL cases 62fe17f
  already handled; the skip is the block device
- ten mutants of this commit, each removing one guard, in three runs: all
  ten killed, none survived. Batch A: M1 (no O_NONBLOCK) by the race test,
  which timed out in the open(); M3 (no socket check) and M4 (no
  character-device check) by their own cases; M6 (no NUL catch on the
  alternates read) by the alternates case and by the existing git-pointer
  test, whose commondir NUL meets that read first; M7 (remote URL), M8
  (inventory path) and M9 (rescues.tsv row) by their own cases. Batch B: M2
  (no fstat check) by the race test, which found no row; M5 (descriptor left
  non-blocking) by the open_regular parity test. Batch C: C1 (every text
  read forced to surrogateescape) by both parity tests

Lane: openRepoTools-3
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…resh its base for the code queue

Code main's tip is c62ba9c, the merge of #69 at 2026-11-14T17:17:27Z. The code queue's check needs the pull request's base to be main's tip and main to be an ancestor of its head (.github/ci/delivery_verify.py:296 and :299, the same blob at code eff8459 and c62ba9c). The merge is clean: the 13 files main changed since a15a6b5 do not include lane-worktrees or tests/test_lane_worktrees_report.py, so the pull request's change is unchanged from 7d2b3ee.

Lane: openRepoTools-3
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@sonarqubecloud

Copy link
Copy Markdown

@brettheap

Copy link
Copy Markdown
Contributor Author
{
  "schema_version": 1,
  "repository": "opensoft/openRepoTools-code",
  "pull_request": 70,
  "head_sha": "279aae829e604ecc7b1ad6e85b73d87313bb8a49",
  "base_sha": "c62ba9c364f0112cc3dd3730f373163ba9a0ae13",
  "reviewer": "codex-local",
  "skill": "pr-review",
  "status": "accepted",
  "unresolved_findings": 0,
  "findings": "No BLOCKING, SHOULD, or NIT finding remains at `279aae829e604ecc7b1ad6e85b73d87313bb8a49`. The reviewed two-file change is byte-identical to the earlier READY head, current main changes neither file, and no main-side change introduces an unsafe interaction.",
  "resolution": "No files were changed. The exact head is safe to request on the normal `openrepotools-code` queue, subject to lane 3\u2019s separately required live GitHub preflight and authority. Its being one merge behind `496710053e287d8771fa41be02375dd5bceb0f68` is not a queue-policy blocker; the clean candidate tree is `4d38ff946c5dca52dd8ba7d1aba8f33115c4927d`.",
  "validation": "Identity, parents, prior-report digest, clean refresh tree, unchanged patch ID and blobs, main-range non-overlap, every first-parent main diff, current-main mergeability, queue-policy lines, whitespace, focused report behavior, repository hygiene, and final worktree cleanliness were checked locally. Results: `39 passed, 1 skipped` for `lane_worktrees_report`; `252 passed, 18 skipped` for `repo_hygiene`."
}

@brettheap

Copy link
Copy Markdown
Contributor Author

@Mergifyio queue openrepotools-code

@mergify

mergify Bot commented Nov 15, 2026

Copy link
Copy Markdown
Contributor

queue openrepotools-code

⚠️ Naming a queue is deprecated. Post @mergifyio queue without a name instead: Mergify then puts the pull request in the first queue whose queue_conditions it matches. A future release will stop accepting the name.

@mergify

mergify Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

❌ Left the queue · openrepotools-batch-heavy fails with this pull request

6 min in the queue, 2 min of it CI.

So far

The failure is in this pull request. It failed tested alone on top of main.

Reason

The merge conditions cannot be satisfied due to failing checks

  • package

Failing checks:

To get back in the queue

  • Push a fix: the pull request is queued again once its queue conditions match.
  • If the failure is a flake, comment @mergifyio queue to queue it again as it is.

Merge conditions not met when it left the queue

  • check-success=@github-actions/package
  • check-success=@github-actions/tests
  • check-success=@github-actions/tests-no-submodule
  • any of · required by GitHub repository ruleset rule main: the four tests.yml jobs required (owner act 2):
    • check-neutral = @github-actions/openrepotools-delivery
    • check-skipped = @github-actions/openrepotools-delivery
    • check-success = @github-actions/openrepotools-delivery
3 merge conditions met

Times in UTC · dashboard · how the merge queue works

@mergify mergify Bot added the queued label Nov 15, 2026
@mergify mergify Bot mentioned this pull request Nov 15, 2026
19 of 35 tasks
@mergify mergify Bot added dequeued and removed queued labels Nov 15, 2026
@brettheap

Copy link
Copy Markdown
Contributor Author

@Mergifyio queue

@mergify

mergify Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

✅ Merged into main as c9c65cc at 01:31 UTC

42 min in the queue, 37 min of it CI.

So far

7 merge conditions met
  • check-success=@github-actions/guard-launch-mode
  • check-success=@github-actions/package
  • check-success=@github-actions/tests
  • check-success=@github-actions/tests-no-submodule
  • github-code-owner-review-satisfied · required by GitHub repository ruleset rule Require Code Owner Review
  • github-review-approved · required by GitHub repository ruleset rule Require Code Owner Review
  • any of · required by GitHub repository ruleset rule main: the four tests.yml jobs required (owner act 2):
    • check-success = @github-actions/openrepotools-delivery
    • check-neutral = @github-actions/openrepotools-delivery
    • check-skipped = @github-actions/openrepotools-delivery

Times in UTC · dashboard · how the merge queue works

@mergify mergify Bot added queued and removed dequeued labels Nov 15, 2026
@mergify
mergify Bot merged commit c9c65cc into main Nov 15, 2026
53 checks passed
@mergify mergify Bot removed the queued label Nov 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant