You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
lib-slug.sh disagrees with the decoder on malformed UTF-8 mid-string, and Linux allows such paths #186
Found during adversarial review of #157/#158/#174 (PR pending). Narrow, but it is the exact class of bug that work exists to remove, so it should be written down rather than left in a comment.
The divergence
scripts/lib-slug.sh's UTF-8 byte table emits one dash per byte for a lead byte that is not followed by the continuations it requires. The real decoder folds that into a single replacement character by the maximal-subpart rule, which is one dash.
Same for a truncated 4-byte lead (\xf0\x90 followed by ASCII).
Why the existing comment understates it
lib-slug.sh says the only divergent shape is a truncated sequence at the end of the string, and that it "cannot arise from a path a filesystem would hand us: macOS enforces well-formed UTF-8, Windows paths come from UTF-16."
Both halves are too generous:
It is not only end-of-string. It happens wherever a partial multi-byte lead is followed by a non-continuation byte, anywhere in the path.
Linux is not covered by that argument. ext4 and friends do not enforce UTF-8 in filenames — every byte except / and NUL is legal. A legacy-encoded (Latin-1, Shift-JIS) or corrupted directory name gets there without anything exotic.
Consequence
On Linux, a small class of non-UTF-8 project paths still resolves to a slug Claude Code never created: no transcript found, nothing saved. Since #156 the hook logs a warning when the session directory is missing, so it is not fully silent — but it is the same shape as #144/#166.
Fix
Expressing maximal-subpart in the sed table is not possible — it needs the decoder's state machine. Options, roughly in order of appetite:
Have the shell side call pipeline/slug.py for any path containing a byte >= 0x80 that fails a cheap well-formedness check, the way it already calls out for the over-200 hash. Costs a subprocess only for paths that are already unusual.
Or accept the divergence and narrow the comment to the truth, which is what the pending PR does.
Either way the comment should not claim a guarantee the table does not provide.
Activity
fix(slug): one session-directory slug, and make it truncate (#187)
fix: close the three follow-ups from the review pass
fix: close the three follow-ups from the review pass
fix: close the three follow-ups from the review pass (#195)