Repository navigation
fix(scripts): keep format-docs output tails UTF-8 safe - #110825
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 20, 2026, 8:34 AM ET / 12:34 UTC. Summary PR surface: Tests +45, Other 0. Total +45 across 6 files. Reproducibility: yes. at source level: a UTF-8 string whose retained byte suffix begins on a continuation byte produces a replacement character in the pre-change decode path, and the supplied regression cases encode that exact boundary. Review metrics: none identified. Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Merge the shared helper after the current required checks complete successfully, then close the narrower overlapping generated-module-only PR as superseded by this integrated implementation. Do we have a high-confidence way to reproduce the issue? Yes, at source level: a UTF-8 string whose retained byte suffix begins on a continuation byte produces a replacement character in the pre-change decode path, and the supplied regression cases encode that exact boundary. Is this the best way to solve the issue? Yes. A shared helper is the narrowest maintainable fix because both formatter-output owners used the same unsafe byte-suffix decoding pattern; preserving each caller’s existing cap and message layout avoids a broader behavior change. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 756de70e84d1. Label changesLabel justifications:
Evidence reviewedPR surface: Tests +45, Other 0. Total +45 across 6 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
Review history (7 earlier review cycles)
|
84a480b to
d6412a4
Compare
d6412a4 to
ea61001
Compare
ea61001 to
538c945
Compare
538c945 to
d6f6ff0
Compare
When formatter (oxfmt) error output exceeds the 16 KiB tail cap and the retained byte window starts inside a multibyte UTF-8 character, the diagnostic tail would begin with a replacement character (�). Add a decodeUtf8Tail helper that skips leading UTF-8 continuation bytes before decoding the byte suffix, matching the existing pattern in scripts/run-additional-boundary-checks.mjs (openclaw#109167). Keep the existing 16 KiB cap and ASCII behavior unchanged.
Co-authored-by: 陈志强0668000989 <[email protected]>
d6f6ff0 to
369d2e8
Compare
|
Merged via squash.
|
* origin/main: (128 commits) fix(codex): keep stressed inference turns isolated and observable (#115893) feat(skills): review interrupted deep turns in experience review (#115887) fix: reject malformed UTF-8 in proxy gateway error response bodies (#111852) fix(browser): stabilize atomic download staging (#115892) fix(google): cancel unread response body on video download error (#110045) refactor(ui): give Memory the shared hub header with hoisted agent scope (#115884) fix(test): stop asserting exact video deadline budgets (#115883) feat(gateway): expose MCP tool identity in effective tools (#115870) fix(skills): verify workshop migration without recovery refactor: replace context-engine retry proxy with declared params (#115872) fix: reject malformed UTF-8 in hosted official plugin catalog feed responses (#111768) fix(codex): harden app inventory invalidation and targeted publishes (#115866) fix(browser): uploads fail when the browser runs on a remote node (#115291) fix(scripts): keep format-docs output tails UTF-8 safe (#110825) fix(skills): recover complete apply transitions fix(macos): reap timed-out shell process groups (#115859) refactor(ollama): unify model inspection and setup (#115879) fix(ui): muted theme text below WCAG AA contrast in webchat (#114586) fix(test): restore isolated memory manager tests (#115880) fix(skills): revalidate rollback targets ...
…discovery * origin/main: (72 commits) fix(codex): keep stressed inference turns isolated and observable (#115893) feat(skills): review interrupted deep turns in experience review (#115887) fix: reject malformed UTF-8 in proxy gateway error response bodies (#111852) fix(browser): stabilize atomic download staging (#115892) fix(google): cancel unread response body on video download error (#110045) refactor(ui): give Memory the shared hub header with hoisted agent scope (#115884) fix(test): stop asserting exact video deadline budgets (#115883) feat(gateway): expose MCP tool identity in effective tools (#115870) fix(skills): verify workshop migration without recovery refactor: replace context-engine retry proxy with declared params (#115872) fix: reject malformed UTF-8 in hosted official plugin catalog feed responses (#111768) fix(codex): harden app inventory invalidation and targeted publishes (#115866) fix(browser): uploads fail when the browser runs on a remote node (#115291) fix(scripts): keep format-docs output tails UTF-8 safe (#110825) fix(skills): recover complete apply transitions fix(macos): reap timed-out shell process groups (#115859) refactor(ollama): unify model inspection and setup (#115879) fix(ui): muted theme text below WCAG AA contrast in webchat (#114586) fix(test): restore isolated memory manager tests (#115880) fix(skills): revalidate rollback targets ...
* origin/main: (95 commits) fix(codex): keep stressed inference turns isolated and observable (#115893) feat(skills): review interrupted deep turns in experience review (#115887) fix: reject malformed UTF-8 in proxy gateway error response bodies (#111852) fix(browser): stabilize atomic download staging (#115892) fix(google): cancel unread response body on video download error (#110045) refactor(ui): give Memory the shared hub header with hoisted agent scope (#115884) fix(test): stop asserting exact video deadline budgets (#115883) feat(gateway): expose MCP tool identity in effective tools (#115870) fix(skills): verify workshop migration without recovery refactor: replace context-engine retry proxy with declared params (#115872) fix: reject malformed UTF-8 in hosted official plugin catalog feed responses (#111768) fix(codex): harden app inventory invalidation and targeted publishes (#115866) fix(browser): uploads fail when the browser runs on a remote node (#115291) fix(scripts): keep format-docs output tails UTF-8 safe (#110825) fix(skills): recover complete apply transitions fix(macos): reap timed-out shell process groups (#115859) refactor(ollama): unify model inspection and setup (#115879) fix(ui): muted theme text below WCAG AA contrast in webchat (#114586) fix(test): restore isolated memory manager tests (#115880) fix(skills): revalidate rollback targets ...
…d-fingerprint * origin/main: (36 commits) fix(codex): keep stressed inference turns isolated and observable (#115893) feat(skills): review interrupted deep turns in experience review (#115887) fix: reject malformed UTF-8 in proxy gateway error response bodies (#111852) fix(browser): stabilize atomic download staging (#115892) fix(google): cancel unread response body on video download error (#110045) refactor(ui): give Memory the shared hub header with hoisted agent scope (#115884) fix(test): stop asserting exact video deadline budgets (#115883) feat(gateway): expose MCP tool identity in effective tools (#115870) fix(skills): verify workshop migration without recovery refactor: replace context-engine retry proxy with declared params (#115872) fix: reject malformed UTF-8 in hosted official plugin catalog feed responses (#111768) fix(codex): harden app inventory invalidation and targeted publishes (#115866) fix(browser): uploads fail when the browser runs on a remote node (#115291) fix(scripts): keep format-docs output tails UTF-8 safe (#110825) fix(skills): recover complete apply transitions fix(macos): reap timed-out shell process groups (#115859) refactor(ollama): unify model inspection and setup (#115879) fix(ui): muted theme text below WCAG AA contrast in webchat (#114586) fix(test): restore isolated memory manager tests (#115880) fix(skills): revalidate rollback targets ...
…ocess-probes * origin/main: (56 commits) fix(codex): keep stressed inference turns isolated and observable (#115893) feat(skills): review interrupted deep turns in experience review (#115887) fix: reject malformed UTF-8 in proxy gateway error response bodies (#111852) fix(browser): stabilize atomic download staging (#115892) fix(google): cancel unread response body on video download error (#110045) refactor(ui): give Memory the shared hub header with hoisted agent scope (#115884) fix(test): stop asserting exact video deadline budgets (#115883) feat(gateway): expose MCP tool identity in effective tools (#115870) fix(skills): verify workshop migration without recovery refactor: replace context-engine retry proxy with declared params (#115872) fix: reject malformed UTF-8 in hosted official plugin catalog feed responses (#111768) fix(codex): harden app inventory invalidation and targeted publishes (#115866) fix(browser): uploads fail when the browser runs on a remote node (#115291) fix(scripts): keep format-docs output tails UTF-8 safe (#110825) fix(skills): recover complete apply transitions fix(macos): reap timed-out shell process groups (#115859) refactor(ollama): unify model inspection and setup (#115879) fix(ui): muted theme text below WCAG AA contrast in webchat (#114586) fix(test): restore isolated memory manager tests (#115880) fix(skills): revalidate rollback targets ...
* fix(scripts): keep format-docs output tails UTF-8 safe When formatter (oxfmt) error output exceeds the 16 KiB tail cap and the retained byte window starts inside a multibyte UTF-8 character, the diagnostic tail would begin with a replacement character (�). Add a decodeUtf8Tail helper that skips leading UTF-8 continuation bytes before decoding the byte suffix, matching the existing pattern in scripts/run-additional-boundary-checks.mjs (openclaw#109167). Keep the existing 16 KiB cap and ASCII behavior unchanged. * refactor(scripts): share UTF-8-safe output tails Co-authored-by: 陈志强0668000989 <[email protected]> * test(scripts): prove real formatter UTF-8 failures --------- Co-authored-by: Peter Steinberger <[email protected]>
What Problem This Solves
Fixes an issue where
scripts/format-docs.mjscould render a replacementcharacter (�) in failure diagnostics when a formatter (oxfmt) error
output exceeded the 16 KiB tail cap and the byte window started inside a
multibyte UTF-8 character.
Why This Change Was Made
outputTailtook a byte-bounded suffix withbytes.subarray(-N).toString("utf8")before decoding. When the retainedbyte window started at a UTF-8 continuation byte the tail began with a
replacement character. A new
decodeUtf8Tailhelper now skips anyleading continuation bytes, matching the existing pattern from the sibling
fix in
scripts/run-additional-boundary-checks.mjs(#109167).User Impact
Docs formatting failure diagnostics stay readable when capped output
contains multibyte text (e.g. oxfmt errors on CJK documentation pages) at
the retention boundary. No behaviour change for ASCII-only output.
Evidence
node -econfirmed that the last 4 bytes ofBuffer.from("你好")(boundary at continuation byte 0xA0) produced aleading
�."好"— the continuation byteis skipped and the intact character follows.
node scripts/run-vitest.mjs test/scripts/format-docs.test.ts -- -t decodeUtf8passed with 3 tests (continuation-byte skip, ASCII passthrough, empty
buffer).
oxfmt --checkpassed on both changed files.