Repository navigation
Description
Surfaced by the review of #366 (per-session handoff) as an adjacent finding, graded reasoned, not observed. Filed rather than fixed there because it spans the file rather than the one new line.
Symptom
On a Windows console using cp1252, four lines this hook prints contain a U+2014 em-dash. What the reader sees is unestablished: either mojibake (—) in a message whose whole job is to be read by a human at a broken-store moment, or, if any consumer decodes that stream with the console codepage rather than UTF-8, a decode failure on output the hook had already produced.
Location
scripts/session-start-hook.sh, on printed lines only — the file's ~94 other em-dashes are in comments and never reach a stream:
87: echo "session-start-hook: ERROR — failed to source $PLUGIN_ROOT/scripts/log.sh" >&2
774: echo "remember: your previous session was not captured. ... that is expected — capture starts now. ..."
865: echo "(handoff_mode is \"per_session\", but no session_id reached this hook — writing to the shared file above, not a per-session one.)"
986: echo "[already delivered ${DELIVERIES} times since ${FIRST_DELIVERED:-an earlier session} — no new handoff has been written since, ...]"
Line 865 is new in #366. The other three predate it.
Mechanism, and the part that is genuinely open
The review reported this as a possible UnicodeEncodeError. That specific mechanism is doubted here and the doubt is reasoned, not measured: UnicodeEncodeError is a Python failure — Python encodes str to bytes using the console codepage and raises when a character has no mapping. bash's echo performs no such encode; it writes the source file's bytes through unchanged, so there is no encode step in this path to fail.
That leaves two candidate outcomes and no evidence selecting between them:
- Cosmetic — the UTF-8 bytes reach a cp1252 console and render as mojibake. Bad in a diagnostic, not fatal.
- Fatal one layer up — some consumer of this hook's stdout decodes it with the console codepage instead of UTF-8 and raises there. This hook's stdout is injected into a session, so the consumer is not this repository's code and its decoding is not established here.
Both the agent's claim and this counter-claim are reasoned. Neither was observed, because no Windows machine was available to either.
What would settle it
On Windows with a cp1252 console (chcp 1252), Git Bash:
bash scripts/session-start-hook.sh < /dev/null | xxd | grep -i 'e2 80 94'
Three outcomes and they are three: the bytes pass through and render as mojibake (case 1 — decide whether a diagnostic may be mojibake); something in the chain raises (case 2 — blocking, and the fix is ASCII on every printed line); or the hook produces no such line on that path (the fixture did not reach it, and the check has not run).
If either of the first two holds, the fix is file-wide rather than per-line: decide once whether this file may print non-ASCII to a stream at all, then apply it to all four. Fixing only the newest line leaves the file's own convention inconsistent, which is why #366 did not.
Activity
Prune stale per-session delivery records; keep session-start-hook.sh'…
test(#900): source-text pins skip a compiled hook; harness pins see t…
test(#900): source-text pins skip a compiled hook; harness pins see t…
test(#900): source-text pins skip a compiled hook; harness pins see t…
test(#900): source-text pins skip a compiled hook; harness pins see t…