Description
The sleep-polling-loop audit detector flags long sleep calls (busy-waiting), but its regex
silently drops the explicit-seconds form sleep 30s. The unit alternation omits s, and the
trailing \b then fails on the trailing s (both 0 and s are word characters), so the
entire match fails rather than falling back to the bare number.
src/audit/detectors/sleep-polling-loop.ts:23:
const match = /\bsleep\s+(\d+(?:\.\d+)?)(m|h|d)?\b/.exec(cmd);
Steps to Reproduce
Run an audit over a transcript containing sleep 30s (or sleep 45s). The detector does not
fire, even though the duration is at/above the 30s threshold.
/\bsleep\s+(\d+(?:\.\d+)?)(m|h|d)?\b/.exec("sleep 30s"); // => null
/\bsleep\s+(\d+(?:\.\d+)?)(m|h|d)?\b/.exec("sleep 30"); // => matches
/\bsleep\s+(\d+(?:\.\d+)?)(m|h|d)?\b/.exec("sleep 1m"); // => matches
Ironically the docstring boasts that sleep 0.5m (= 30s) "isn't dropped", while the far more
common sleep 30s is.
Expected Behavior
sleep 30s / sleep 45s should be detected exactly like sleep 30 and sleep 0.5m.
Failproof AI Version
0.0.14-beta.1
Node.js / Bun Version
Bun 1.3+
Operating System
macOS
Additional Context
One-character fix: add s to the unit group — (s|m|h|d)?. Add a test for sleep 30s next to
the existing cases in the detector's test file.
Description
The
sleep-polling-loopaudit detector flags longsleepcalls (busy-waiting), but its regexsilently drops the explicit-seconds form
sleep 30s. The unit alternation omitss, and thetrailing
\bthen fails on the trailings(both0andsare word characters), so theentire match fails rather than falling back to the bare number.
src/audit/detectors/sleep-polling-loop.ts:23:Steps to Reproduce
Run an audit over a transcript containing
sleep 30s(orsleep 45s). The detector does notfire, even though the duration is at/above the 30s threshold.
Ironically the docstring boasts that
sleep 0.5m(= 30s) "isn't dropped", while the far morecommon
sleep 30sis.Expected Behavior
sleep 30s/sleep 45sshould be detected exactly likesleep 30andsleep 0.5m.Failproof AI Version
0.0.14-beta.1
Node.js / Bun Version
Bun 1.3+
Operating System
macOS
Additional Context
One-character fix: add
sto the unit group —(s|m|h|d)?. Add a test forsleep 30snext tothe existing cases in the detector's test file.