mirror of
https://github.com/garrytan/gstack.git
synced 2026-09-09 22:48:57 +02:00
find ... | xargs ls -t runs ls with NO operands when find matches nothing — GNU xargs still invokes the command once, and ls -t with no operands lists the current directory. Three sites misfired on fresh installs (no ceo-plans / checkpoints / plans yet), exactly where a wrong answer is least likely to be recognized: review.ts's plan fallback silently adopted a random cwd .md as "the plan", and Context Recovery listed unrelated cwd files as RECENT ARTIFACTS / LATEST_CHECKPOINT. All three now use xargs -r ls -t, mirroring the shape the sibling bin/gstack-codex-session-import fix (#2482) landed with: -r pins the BSD skip-on-empty behavior on GNU too, and BSD xargs accepts -r as a no-op. test/empty-find-fallthrough.test.ts pins it four ways: no bare xargs ls -t in scripts/ or bin/, both rendered Context Recovery sites guarded, a live execution proving an empty checkpoints dir yields no checkpoint (not a decoy cwd file), and a rendered-SKILL.md sweep. Re-derived from PR #2483 onto current code. Contributed by @tranthanhnhatkhoa. Fixes #2483 Co-authored-by: tranthanhnhatkhoa <tranthanhnhatkhoa@users.noreply.github.com> Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>