Fix handoff capturing grep shell-code lines as file paths (3.0.2)#6
Conversation
A grep context line carrying shell code (e.g. SKILL="$DIR/x.sh") was captured whole as a handoff file path. A resolved path token never contains quote/$/=/redirect/glob chars; reject candidates that do. Regression test T-56. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f1b676518c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if any(ch in _PATH_TOKEN_JUNK for ch in candidate): | ||
| return None |
There was a problem hiding this comment.
Preserve valid path punctuation in grep results
When a Glob/Grep result contains a real filename with characters such as = or ' (for example fixtures/a=b.json or docs/John's-note.md), this new blanket check drops the candidate even though those are valid path characters on normal filesystems. That regresses Tier-B handoff coverage for repos with generated/config files that commonly include = in names; the shell-junk filter should target assignment/code-shaped lines without rejecting all legitimate paths containing these characters.
Useful? React with 👍 / 👎.
Codex PR review: = and the single-quote char are valid in real filenames (e.g. a=b.json); the blanket denylist over-dropped them. Keep only quote/backtick/$/redirect/glob, which still catch the observed shell-junk. T-56 now also asserts a real =-named path is kept. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
What
The Stop hook's Tier-B path extractor captured grep/glob result lines that carry shell code as if they were file paths. A grep context line like
357-SKILL="$SCRIPT_DIR/../skills/prep-compact/SKILL.md"(no:to split on, so the whole line became the candidate) was stored verbatim in the handoff'srecent_files/cumulative_files. Spotted in a live handoff while dogfooding 3.0.1.Fix
first_path_tokennow rejects a candidate containing any shell/glob punctuation ("'`=$<>|*?) — a resolved path token never carries those. Clean paths are unaffected:src/foo.tsfromsrc/foo.ts:42:match, bare glob results, etc.Testing
bash test/run-tests.sh: 129 assertions, green on Windows Git Bash. New regression test T-56 (junk line rejected, real path kept); existing T-28b (legit grep/glob extraction) still passes unchanged.Notes
My Documents/report.docx) or stripping the<num>-grep prefix (would corrupt date-prefixed filenames like2026-05-23-foo.md). Tier-B is best-effort with Tier-ARead/Editas the backstop.🤖 Generated with Claude Code