Skip to content

true-check: skip non-regular *.json in gate-passes without blocking (D11) - #87

Merged
rymiwe merged 2 commits into
mainfrom
true-check-fifo-d11
Nov 24, 2026
Merged

rymiwe merged 2 commits into
mainfrom
true-check-fifo-d11

Conversation

@rymiwe

@rymiwe rymiwe commented Nov 24, 2026 •

Copy link
Copy Markdown
Owner

Follow-up to #86. Paul's cc6d61c probe D11: a FIFO named *.json in the gate-passes dir hangs true-check eval and verify. os.open(O_RDONLY|O_NOFOLLOW) blocks on the FIFO before the S_ISREG check runs.

Change

  • gate_pass: lstat each *.json entry first. Anything that is not a plain file (FIFO, device, link, dir) is skipped with the reason enforced_by GATE: NAME is not a plain file; skipped.
  • The record open adds O_NONBLOCK. fstat re-checks S_ISREG after the open, so swapping in a FIFO after the lstat cannot block either.
  • The consumed.log open also adds O_NONBLOCK, as a defensive portability guard, not a Linux fix. POSIX leaves O_RDWR on a FIFO undefined; on Linux that open already returns without blocking, and fstat already refuses anything that is not a plain file.
  • Nothing else changed. The interface, exit codes and the other holds are the same.

Evidence

Fail-first, new tests on main d2cbaa2 (no fix):

test_d11_fifo_record_is_skipped_without_hanging ... FAIL
test_d11_fifo_consumed_log_is_refused_without_hanging ... ok
subprocess.TimeoutExpired: Command '['python3', '.../bin/true-check', 'eval', ...]' timed out after 20 seconds
AssertionError: true-check eval hung on a FIFO in the gate-passes dir (D11)
Ran 2 tests in 22.636s
FAILED (failures=1)

The consumed.log FIFO test already passes on main, because on Linux O_RDWR does not block on a FIFO and main already refuses it via fstat. That O_NONBLOCK hunk and its test stay as a portability guard.

Same tests on this branch:

test_d11_fifo_record_is_skipped_without_hanging ... ok
test_d11_fifo_consumed_log_is_refused_without_hanging ... ok
Ran 2 tests in 2.829s
OK

Full tests/test_true_check.py: Ran 113 tests OK. tests/test_lint_scorecard.py: Ran 35 tests OK. Local unittest discover: 281 tests, 3 setUpClass errors (test_guild_update, test_pr_gate_contract, test_release_lifecycle). All three need ~/code/bridgekeeper, which this box doesn't have, and they error the same way on main. CI runs them.

Paul's probes (2026-11-24-guild86-5071246-probes.sh rev 2), on a /tmp ledger copy with wes-colleague-approve set to approved. Diff from main to branch, the only two lines that change:

< D7 record file is a symlink  eval exit=11 allowed=False reason='...: enforced_by wes-approve-gate: no PASS record'
> D7 record file is a symlink  eval exit=11 allowed=False reason='...: enforced_by wes-approve-gate: a.json is not a plain file; skipped'
< D11 a FIFO 0.json sorted before a valid record (no hang, 30 s cap) eval exit=124 unparsed
> D11 a FIFO 0.json sorted before a valid record (no hang, 30 s cap) eval exit=0 allowed=True reason='gate row wes-colleague-approve approves approve on <work repo>' pass_record='not consumed: ...'

D7 still holds. Only the reason is more specific.

Paul's re-audit (2026-11-24, 10:55 AM PT) passed. The one nit was to label the consumed.log O_NONBLOCK hunk as a guard; that is a comment-only follow-up on this branch, with no behavior change.

Scans on the diff: gitleaks no leaks found, name-guard rc 0, secret-guard rc 0, employer-name grep: no hits.

Builder: Grok Bot (Code Cole executor session); underlying model unknown.

…D11)

A FIFO named *.json in the gate dir hung eval and verify: os.open(O_RDONLY|O_NOFOLLOW)
blocks on a FIFO before the S_ISREG check runs. Now each entry is lstat'ed first and
anything that is not a plain file is skipped with the reason "NAME is not a plain file;
skipped". The record open and the consumed.log open add O_NONBLOCK, and fstat re-checks
S_ISREG after the open, so a swap after lstat cannot block either.

Tests: a FIFO 0.json alone holds with that reason; a FIFO before a valid record still
allows, and verify consumes once; a FIFO consumed.log is refused. Both run under a 20 s
cap so a hang fails instead of stalling CI.

Builder: Grok Bot (Code Cole executor session); underlying model unknown
The flag is not a Linux fix: POSIX leaves O_RDWR on a FIFO undefined, and on
Linux the open already returns without blocking while fstat already refuses a
non-file. Comment only; no behavior change.

Builder: Grok Bot (Code Cole executor session); underlying model unknown
@rymiwe
rymiwe marked this pull request as ready for review November 24, 2026 21:33
@rymiwe
rymiwe merged commit a109865 into main Nov 24, 2026
1 check passed
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