Skip to content

fix(config): preserve Unicode in validation received values#109664

Merged
steipete merged 2 commits into
openclaw:mainfrom
ZengWen-DT:fix/config-validation-received-value-utf16
Jul 17, 2026
Merged

fix(config): preserve Unicode in validation received values#109664
steipete merged 2 commits into
openclaw:mainfrom
ZengWen-DT:fix/config-validation-received-value-utf16

Conversation

@ZengWen-DT

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where users running openclaw config validate could see a replacement character () when an invalid received value was long enough for the diagnostic preview to truncate inside an emoji.

Why This Change Was Made

The validation diagnostic now uses the shared UTF-16-safe truncation helper before appending its existing ellipsis. The 160-code-unit preview limit and all non-truncated output remain unchanged.

User Impact

Long invalid configuration values are still summarized, but their diagnostics no longer emit malformed Unicode when the cutoff lands inside a surrogate pair.

Evidence

  • Real CLI before: openclaw config validate with an invalid gateway.bind value of 155 ASCII characters followed by 🎉tail emitted in the got: preview.
  • Real CLI after on 0e9db600595: the same command exits 1 as expected, while an output probe reports replacementCharacter=false and unpairedSurrogate=false.
  • Focused test: node scripts/run-vitest.mjs src/config/issue-location.test.ts — 54/54 passed.
  • Formatting: ./node_modules/.bin/oxfmt --check src/config/issue-location.ts src/config/issue-location.test.ts.
  • git diff --check passed.

AI-assisted: built with Codex.

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. labels Jul 17, 2026
@clawsweeper

clawsweeper Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed July 17, 2026, 1:19 AM ET / 05:19 UTC.

Summary
The PR changes config validation previews to truncate serialized received values on a UTF-16-safe boundary and adds regression coverage for an emoji at the cutoff.

PR surface: Source +1, Tests +11. Total +12 across 2 files.

Reproducibility: yes. Current main’s raw UTF-16 slice and the supplied gateway.bind value provide a high-confidence source reproduction path, and the PR body reports the corresponding real CLI failure and after-fix result.

Review metrics: none identified.

Stored data model
Persistent data-model change detected: serialized state: src/config/issue-location.ts. Confirm migration or upgrade compatibility proof before merge.

Merge readiness
Overall: 🐚 platinum hermit
Proof: 🐚 platinum hermit
Patch quality: 🐚 platinum hermit
Result: ready for maintainer review.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • none.

Risk before merge

  • [P1] The PR is behind current main and several exact-head CI checks remain in progress, so merge readiness should be confirmed after updating the branch; no diff-specific compatibility or runtime risk was found.

Maintainer options:

  1. Decide the mitigation before merge
    Land the shared-helper fix and focused regression test after refreshing the branch against current main and confirming the exact head passes required checks.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Next step before merge

  • No automated repair is needed; maintainers should refresh the branch, let exact-head checks finish, and merge through the normal review path.

Security
Cleared: The diff only changes local diagnostic string truncation and a focused test; it does not alter secrets, permissions, dependencies, workflows, persistence, or executable supply-chain surfaces.

Review details

Best possible solution:

Land the shared-helper fix and focused regression test after refreshing the branch against current main and confirming the exact head passes required checks.

Do we have a high-confidence way to reproduce the issue?

Yes. Current main’s raw UTF-16 slice and the supplied gateway.bind value provide a high-confidence source reproduction path, and the PR body reports the corresponding real CLI failure and after-fix result.

Is this the best way to solve the issue?

Yes. Reusing the repository’s shared UTF-16-safe truncation helper at the existing cutoff is the narrowest maintainable fix and avoids introducing a parallel truncation implementation.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 5199bfafea6b.

Label changes

Label changes:

  • add P3: The PR fixes malformed Unicode in a bounded validation diagnostic without changing configuration semantics or runtime behavior.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR body describes a concrete real CLI before/after run with the exact boundary-triggering value and explicit probes for replacement characters and unpaired surrogates.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body describes a concrete real CLI before/after run with the exact boundary-triggering value and explicit probes for replacement characters and unpaired surrogates.

Label justifications:

  • P3: The PR fixes malformed Unicode in a bounded validation diagnostic without changing configuration semantics or runtime behavior.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body describes a concrete real CLI before/after run with the exact boundary-triggering value and explicit probes for replacement characters and unpaired surrogates.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body describes a concrete real CLI before/after run with the exact boundary-triggering value and explicit probes for replacement characters and unpaired surrogates.
Evidence reviewed

PR surface:

Source +1, Tests +11. Total +12 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 2 1 +1
Tests 1 11 0 +11
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 13 1 +12

What I checked:

  • Current-main bug path: Current main truncates serialized validation values with slice(0, 157), which can leave a lone high surrogate when the cutoff falls inside a supplementary-plane character. (src/config/issue-location.ts, 5199bfafea6b)
  • Patch behavior: The PR replaces the raw slice with the existing truncateUtf16Safe helper while retaining the 160-code-unit preview budget and existing ellipsis behavior. (src/config/issue-location.ts:256, eb4c2afc3dad)
  • Regression coverage: The added test places an emoji across the truncation boundary and rejects both unmatched high and unmatched low surrogates in the resulting diagnostic. (src/config/issue-location.test.ts:252, eb4c2afc3dad)
  • Shared helper contract: UTF-16-safe truncation is already an established repository pattern for bounded user-facing strings, and the normalization-core entrypoint is included in the current build surface. (formatika.de) (packages/normalization-core/src/utf16-slice.ts, 5199bfafea6b)
  • Real CLI proof: The PR body gives a concrete before/after CLI run: an invalid gateway.bind value with 155 ASCII characters followed by 🎉tail previously produced malformed output, while the after-fix probe reported no replacement character or unpaired surrogate. (eb4c2afc3dad)
  • Feature provenance: The config validation command and improved startup diagnostics date to squash commit 3002f13ca7, authored by Sid-Qin and reviewed by gumadeiras; later config history shows sustained work by steipete in the same subsystem. (git.mineracks.com) (src/config/io.ts, 3002f13ca7)

Likely related people:

  • Sid-Qin: Authored the merged change that introduced openclaw config validate and its diagnostic flow. (git.mineracks.com) (role: introduced behavior; confidence: high; commits: 3002f13ca7; files: src/config/io.ts, src/config/issue-location.ts)
  • gumadeiras: Reviewed the original config-validation feature and is directly connected to its merged behavior. (git.mineracks.com) (role: reviewer; confidence: medium; commits: 3002f13ca7; files: src/config/io.ts, src/config/issue-location.ts)
  • steipete: Recent config history shows repeated maintenance and refactoring of config read/write and validation-adjacent paths. (git.mineracks.com) (role: recent area contributor; confidence: medium; commits: 36a233ff98, a27ccee5d9, 89a4f2a34e; files: src/config/io.ts, src/config/issue-location.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@steipete steipete self-assigned this Jul 17, 2026
@steipete
steipete merged commit 07a36f6 into openclaw:main Jul 17, 2026
111 of 114 checks passed
@steipete

Copy link
Copy Markdown
Contributor

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 18, 2026
…#109664)

* fix(config): preserve Unicode in validation received values

* test: tighten config diagnostic truncation proof

Co-authored-by: ZengWen-DT <[email protected]>

---------

Co-authored-by: Peter Steinberger <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants