Skip to content

fix: harden extractTouchedFiles bash-redirect parsing — junk tokens in the partial narrative (#87) - #95

Merged
rz1989s merged 2 commits into
mainfrom
fix/87-files-touched-parser-noise
Aug 30, 2026
Merged

rz1989s merged 2 commits into
mainfrom
fix/87-files-touched-parser-noise

Conversation

@rz1989s

@rz1989s rz1989s commented Aug 30, 2026

Copy link
Copy Markdown
Member

Closes #87.

Root cause

The garbled "Files modified before the cut" list was not a truncation artifact — the bash redirect/tee heuristic in extractTouchedFiles captured any token containing / or ., so > characters inside quoted strings, heredoc bodies, and echoed code text yielded junk (cache.load(name,,,, [...active],,), and the char class swallowed trailing punctuation from code-y commands (/tmp/e2e-out.txt),). The budget-cut framing was incidental: the affected task was E2E-heavy (lots of heredoc bash), so the junk accumulated.

Fix

New shapeToken filter on every redirect/tee capture:

  • strip wrapping quotes, then trailing quote/punct junk until stable (handles interleaved '/tmp/x.txt',)
  • require a real path shape: contains /, dotted filename (name.ext), or leading-dot file (.gitignore)
  • exclude /dev/* pseudo-devices — /dev/null was silently listed as a touched file before

extractTouchedFiles is now exported + unit-tested (7 tests pin the verbatim reported junk tokens). The advisory-only nature of the list bounds all heuristic trade-offs (nothing is written from these names; controllers re-inspect).

Deliberately out of scope (issue suggestion 1 — an injected final state-note turn): a larger engine change (the session is already disposed at the budget branch); happy to see it re-filed standalone if wanted.

Verification

810/810 tests (+7), typecheck clean. Review: approve (regression audit incl. globs/env-var targets, claude-path parity, m[1] guards).

…n the partial narrative (#87)

Root cause of the #87 garbling: the redirect/tee heuristic captured any
token containing / or . — so ">" characters inside quoted strings, heredoc
bodies, and echoed code text yielded junk ("cache.load(name,,",
"[...active],,"), and the char class also swallowed trailing punctuation
from code-y commands ("/tmp/e2e-out.txt),"). The budget-cut framing was
incidental; the junk accumulated because the affected task was E2E-heavy.

New shapeToken filter: strip wrapping quotes, trim trailing punctuation,
require a real path shape (contains "/", dotted filename, or leading-dot
file), and exclude /dev pseudo-devices (/dev/null was silently listed as
a touched file before — arguably wrong too).

extractTouchedFiles is now exported + unit-tested (6 tests pin the verbatim
reported junk tokens, punctuation trimming, quote unwrapping, and the
/dev/null exclusion).
@rz1989s
rz1989s merged commit 2074682 into main Aug 30, 2026
1 check passed
@rz1989s
rz1989s deleted the fix/87-files-touched-parser-noise branch August 30, 2026 08:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

subagent: turn-budget partial result still garbled on mid-fix exhaustion (refs #25, #49)

1 participant