Skip to content

lib/report-directory.sh cannot distinguish a failed walk from an empty one, so callers needing the distinction must duplicate its listing

Id: TD-PPagop-26082837 · Status: resolved · Filed: 2026-08-28 · Resolved: 2026-09-28 · Ref: https://github.com/Pullwright/agent-ops/pull/1902

_report_directory_walk degrades a failed gh api to return 0 with no output — byte-identical to what ‘no directory matched’ produces — and report_directory_most_recent inherits that: an empty result means either ‘no report directory exists’ or ‘the read failed’, and the API cannot say which. This already bit once: PR #896’s first iteration read the ambiguity as the definite empty in gather-project-review.sh –current-date, which would have irreversibly retired every review--R-NN void in a repository on a rate limit; the fix had to duplicate listing-level detection in the caller (the jq probe of listing_json against report_directory_regex at scripts/gather-project-review.sh:193-202) because the library offers no status channel. Any future caller needing definite-vs-failure — and requirement 34n-style ‘a fact nothing clears’ consumers are exactly that shape — faces the same trap, and the workaround only covers the format’s first dynamic segment, deciding nothing for deeper ones. Suggested fix: give the walk a way to signal ‘a listing failed somewhere’ (a distinct exit status on report_directory_most_recent, or an out-file like the gather scripts’ .ok-marker convention) so a caller can tell a definite emptiness from a degraded one without re-listing, then fold gather-project-review.sh’s duplicated probe back onto it. The existing silent-degrade contract for callers that don’t care (review-cycle.sh, lib/eligibility.sh’s prefetch, default-mode gather-project-review.sh) must stay the default.

Noticed while the Approver was judging https://github.com/Poetic-Poems/agent-ops/pull/896.

Migrated to https://github.com/Poetic-Poems/agent-ops/issues/1024.