Repository navigation
fix(pstack): make worktree-audit's LAST_CHAT work with GNU stat and date - #707
Open
surlymochan wants to merge 1 commit into
Open
surlymochan wants to merge 1 commit into
surlymochan wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
worktree-audit.shfinds the newest chat transcript for each worktree withstat -f '%m %N'and turns it into a day withdate -r <epoch>. Both are BSD spellings. With GNU coreutils (Linux, or macOS with Homebrew's gnubin first onPATH),stat -fprints file system status anddate -rexpects a file, soLAST_CHATcomes out empty andrecentis alwaysno. A worktree a chat used today then lands inreviewinstead ofverify-recent-chat, which is the bucket the cleanup playbook treats as "check before deleting".What changed
stat -c %Y /. GNU getsstat -c '%Y %n'anddate -d "@<epoch>"; otherwise the existingstat -f '%m %N'anddate -r <epoch>stay.Scope
pstack/skills/poteto-mode/scripts/worktree-audit.shand its regenerated Claude Code copy.xargs statline for paths with spaces; whichever lands second needs a one-line rebase.Blast Radius
Only the
LAST_CHATcolumn and theverify-recent-chatbucket of a read-only audit. On BSDstatthe commands run are the same as before.Verification
Scratch repo with one extra worktree (one commit) and a fake
HOMEwhoseagent-transcripts/chat1.jsonmentions that worktree path, run with-b mainon Linux (coreutils 9.7):statshim onPATHthat rejects-c, the probe falls back to the BSD flags (output matches the old script, as expected on GNU), so macOS keeps its current path.bash -npasses,node scripts/generate-pstack-harness-trees.mjs --checkreports the harness tree up to date,node scripts/check-pstack-docs.mjsreports 0 problems, andbun testinpoteto-mode/scriptsstill passes (68/68).Note
Low Risk
Read-only audit script only; BSD/macOS path is unchanged when the GNU probe fails.
Overview
Fixes
LAST_CHATand theverify-recent-chatbucket on Linux (and macOS when GNU coreutils win onPATH), where BSD-onlystat -fanddate -rfailed to read transcript mtimes.worktree-audit.shnow probes once withstat -c %Y /and sets sharedstat_fmtplusfmt_dayfor either GNU (stat -c '%Y %n',date -d "@epoch") or BSD (unchanged behavior). The transcript scan uses those instead of hard-coded flags.Reviewed by Cursor Bugbot for commit a617232. Bugbot is set up for automated code reviews on this repo. Configure here.