Skip to content

fix(config): use truncateUtf16Safe for allowed-values hint text#102512

Merged
steipete merged 2 commits into
openclaw:mainfrom
lsr911:fix/utf16-allowed-values
Jul 9, 2026
Merged

fix(config): use truncateUtf16Safe for allowed-values hint text#102512
steipete merged 2 commits into
openclaw:mainfrom
lsr911:fix/utf16-allowed-values

Conversation

@lsr911

@lsr911 lsr911 commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

truncateHintText() uses naive .slice(0, limit) which can split surrogate pairs in config validation hint messages shown to users.

Why This Change Was Made

Replace with truncateUtf16Safe(). Same pattern as #102464, #102467, #102500 (all merged).

Files Changed

File Change
src/config/allowed-values.ts +1 import; .slice(0,N) → truncateUtf16Safe()

🤖 Generated with Claude Code

Replace naive .slice(0, N) with truncateUtf16Safe() to prevent
surrogate pair splitting in config validation hint messages
shown to users.

Co-Authored-By: Claude <[email protected]>
@openclaw-barnacle openclaw-barnacle Bot added size: XS triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. labels Jul 9, 2026
@clawsweeper

clawsweeper Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 9, 2026, 4:21 AM ET / 08:21 UTC.

Summary
The PR replaces allowed-values hint truncation with truncateUtf16Safe and adds a regression test for a surrogate-pair boundary.

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

Reproducibility: yes. source-reproducible: current main truncates allowed-value hint text with raw text.slice(0, limit), and the new test constructs a surrogate-pair boundary that would expose the bug. I did not run a live config-validation command in this read-only review.

Review metrics: none identified.

Merge readiness
Overall: 🧂 unranked krab
Proof: 🧂 unranked krab
Patch quality: 🦞 diamond lobster
Result: blocked until real behavior proof from a real setup is added.

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

Rank-up moves:

  • [P1] Add redacted terminal output, copied live output, logs, or a short recording from a real config-validation run showing the allowed-values hint handles the surrogate-pair boundary after the fix.
  • Update the PR body with that Evidence section so ClawSweeper can re-review the exact head.

Proof guidance:

  • [P1] Needs real behavior proof before merge: The only proof is a focused unit test/CI; the PR body still needs redacted terminal/live output showing the config validation hint after the fix. After adding proof, updating the PR body should trigger re-review; if it does not, ask a maintainer to comment @clawsweeper re-review. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Risk before merge

  • [P1] External-PR proof remains unit-test/CI-only, so reviewers still need redacted real config-validation output or a maintainer proof override before merge.

Maintainer options:

  1. Decide the mitigation before merge
    Merge the narrow helper replacement after the PR body includes redacted real config-validation output, or after a maintainer explicitly overrides the proof gate.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Next step before merge

  • [P1] No repair job is needed because the current head has no supported code finding; the remaining blocker is contributor real behavior proof or maintainer proof override.

Security
Cleared: The diff only imports an existing internal normalization helper and adds a focused test; no concrete security or supply-chain concern was found.

Review details

Best possible solution:

Merge the narrow helper replacement after the PR body includes redacted real config-validation output, or after a maintainer explicitly overrides the proof gate.

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

Yes, source-reproducible: current main truncates allowed-value hint text with raw text.slice(0, limit), and the new test constructs a surrogate-pair boundary that would expose the bug. I did not run a live config-validation command in this read-only review.

Is this the best way to solve the issue?

Yes. Reusing truncateUtf16Safe in the existing helper is the narrowest maintainable fix, and the current head also fixes the omitted-count edge case that the prior review found.

AGENTS.md: found and applied where relevant.

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

Label changes

Label justifications:

  • P3: This is a small user-facing config hint correctness fix with limited blast radius and no config surface, default, migration, or protocol change.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦞 diamond lobster.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The only proof is a focused unit test/CI; the PR body still needs redacted terminal/live output showing the config validation hint after the fix. After adding proof, updating the PR body should trigger re-review; if it does not, ask a maintainer to comment @clawsweeper re-review. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed

PR surface:

Source +2, Tests +11. Total +13 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 3 1 +2
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 14 1 +13

What I checked:

Likely related people:

  • gumadeiras: Remote commit metadata for f26853f14c9ba2361c983de8909926aa74143929 shows this account added src/config/allowed-values.ts with the original raw text.slice(0, limit) truncation helper. (role: introduced behavior; confidence: high; commits: f26853f14c9b; files: src/config/allowed-values.ts, src/config/validation.ts)
  • steipete: Live PR metadata shows steipete merged the adjacent same-pattern UTF-16 truncation fixes and authored the current head's boundary test commit. (role: recent reviewer and adjacent test contributor; confidence: medium; commits: 472e5167d38a, 4fa3118049c1, 4c05d91e247f; files: src/config/allowed-values.test.ts, src/agents/tool-policy-audit.ts, src/agents/harness/native-hook-relay.ts)
  • lsr911: Beyond opening this PR, lsr911 authored recently merged same-pattern UTF-16-safe truncation fixes in adjacent current-main agent display and audit paths. (role: recent adjacent UTF-16 truncation contributor; confidence: medium; commits: 472e5167d38a, 4fa3118049c1; files: src/agents/tool-policy-audit.ts, src/agents/harness/native-hook-relay.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.
Review history (1 earlier review cycle)
  • reviewed 2026-07-09T07:45:16.938Z sha ade1821 :: needs real behavior proof before merge. :: [P3] Count omitted text from the safe prefix

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. labels Jul 9, 2026
@steipete

steipete commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Land-ready maintainer verification at exact head 4c05d91e247f7aabfe88db087b159532fbc1359e:

  • Config allowed-value hints now use the shared UTF-16-safe prefix helper.
  • The omitted-character count is derived from the actual safe prefix, avoiding the backup-over-surrogate off-by-one.
  • Focused summarizeAllowedValues suite: 4 passed.
  • Fresh autoreview: clean (0.99).
  • Exact-head hosted CI/Testbox gates: passed.

The regression exercises a surrogate crossing the 160-code-unit cap and locks the exact rendered hint plus omitted count. No config schema/default surface changed.

@steipete
steipete merged commit 720aeb1 into openclaw:main Jul 9, 2026
98 of 99 checks passed
@steipete

steipete commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Merged via squash.

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

* fix(config): use truncateUtf16Safe for allowed-values hint text

Replace naive .slice(0, N) with truncateUtf16Safe() to prevent
surrogate pair splitting in config validation hint messages
shown to users.

Co-Authored-By: Claude <[email protected]>

* test(config): prove UTF-16 allowed-value hint boundary

---------

Co-authored-by: Claude <[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. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: XS status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants