fix(cli): keep UTF-8 log tails valid#101029
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed July 6, 2026, 1:54 PM ET / 17:54 UTC. Summary PR surface: Source +12, Tests +22. Total +34 across 2 files. Reproducibility: yes. from source inspection: current main can retain stdout beginning with a UTF-8 continuation byte and then decode that suffix with Review metrics: none identified. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land the narrow helper fix after the contributor adds redacted terminal output, logs, a screenshot, or a linked artifact showing a truncated non-ASCII log tail no longer emits a replacement character. Do we have a high-confidence way to reproduce the issue? Yes from source inspection: current main can retain stdout beginning with a UTF-8 continuation byte and then decode that suffix with Is this the best way to solve the issue? Yes, this appears to be the narrowest maintainable fix: normalize only the truncated stdout tail before decoding, leaving stderr and untruncated output behavior alone. The remaining issue is proof, not the code shape. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against bb5979064602. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +12, Tests +22. Total +34 across 2 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
|
Land-ready review completed on exact head I rewrote the initial stdout-only decoder patch into one bounded byte-tail implementation shared by stdout and stderr. It now tracks truncation independently, trims only discarded leading UTF-8 continuation bytes, preserves complete 2/3/4-byte code points, and keeps the existing 64 KiB stderr cap. The regression suite covers every partial-width boundary, an exact boundary, and stderr truncation. Proof:
No known proof gaps. Thanks @ly85206559 for finding and fixing the invalid UTF-8 tail behavior. |
|
Merged via squash.
|
* fix(cli): keep UTF-8 log tails valid * fix(cli): share UTF-8-safe byte tails --------- Co-authored-by: Peter Steinberger <[email protected]>
* fix(cli): keep UTF-8 log tails valid * fix(cli): share UTF-8-safe byte tails --------- Co-authored-by: Peter Steinberger <[email protected]>
What Problem This Solves
Fixes an issue where bounded CLI log tails could show a UTF-8 replacement character
when trimming kept the newest bytes starting in the middle of a multibyte character.
Why This Change Was Made
execFileUtf8Tailnow keeps stdout and stderr in a shared byte-tail representationand decodes truncated tails from the next valid UTF-8 boundary. The existing result
contract is unchanged:
truncatedstill reports stdout truncation for the journalcaller, while stderr remains independently bounded for diagnostics.
User Impact
Users reading bounded CLI journal output get valid UTF-8 text when the byte limit cuts
through a character. Failure diagnostics receive the same boundary-safe decoding.
Evidence
€zproducesbytes
[130,172,122], which currentmaindecodes as"��z".node scripts/run-vitest.mjs src/cli/logs-cli.runtime.test.ts src/cli/logs-cli.test.tsgit diff --check origin/main...HEADpython3 .agents/skills/autoreview/scripts/autoreview --mode branch --base origin/main