Skip to content

fix(active-memory): keep search query context truncation UTF-16 safe#101631

Closed
lsr911 wants to merge 1 commit into
openclaw:mainfrom
lsr911:fix/active-memory-utf16
Closed

fix(active-memory): keep search query context truncation UTF-16 safe#101631
lsr911 wants to merge 1 commit into
openclaw:mainfrom
lsr911:fix/active-memory-utf16

Conversation

@lsr911

@lsr911 lsr911 commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

The active-memory extension already imports truncateUtf16Safe for content clamping, but the search-query-context path uses raw .slice(0, 120) on previous-user message text. User message text commonly contains emoji and CJK characters — a boundary mid-surrogate produces U+FFFD in the search query.

Why This Change Was Made

truncateUtf16Safe is already imported at line 40 — this was simply a missed call site.

Evidence

Branch prerun (commit 4ccd8db)

=== active-memory search query context @120 boundary ===
Raw .slice(0,120) ends: "x\ud83d" (dangling high surrogate)
truncateUtf16Safe(..., 120): len=119 | no U+FFFD: true

Files Changed

File Change
extensions/active-memory/index.ts .slice(0, 120)truncateUtf16Safe

Replace raw .slice(0, 120) with guard-safe truncateUtf16Safe
in the search-query-context construction path, preventing
dangling surrogates when previous user message text contains
emoji or CJK characters at the 120-code-unit boundary.

truncateUtf16Safe is already imported in this file.
@openclaw-barnacle openclaw-barnacle Bot added size: S triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. and removed triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. labels Jul 7, 2026
@clawsweeper

clawsweeper Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper review: did not complete due to Codex infrastructure failure. Reviewed July 7, 2026, 8:32 AM ET / 12:32 UTC.

Summary
Review failed before ClawSweeper could summarize the requested change.

PR surface: Source +31. Total +31 across 1 file.

Reproducibility: unclear. The review failed before ClawSweeper could establish a reproduction path.

Review metrics: none identified.

Merge readiness
Not assessed.
Failure reason: timeout.

This is a ClawSweeper/Codex infrastructure failure, not a PR readiness or patch-quality verdict.
Keep any merge decision on the normal maintainer review path until ClawSweeper can complete a fresh review.

Risk before merge

  • [P1] No close action taken because the review did not complete.

Maintainer options:

  1. Decide the mitigation before merge
    Retry the Codex review after fixing the execution failure.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Next step before merge

  • Review did not complete, so no work-lane recommendation was made.
Review details

Best possible solution:

Retry the Codex review after fixing the execution failure.

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

Unclear. The review failed before ClawSweeper could establish a reproduction path.

Is this the best way to solve the issue?

Unclear. Retry the review first so ClawSweeper can evaluate the actual issue and fix direction.

AGENTS.md: unclear because the file could not be read completely.

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

Evidence reviewed

PR surface:

Source +31. Total +31 across 1 file.

View PR surface stats
Area Files Added Removed Net
Source 1 45 14 +31
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 1 45 14 +31

What I checked:

  • failure reason: timeout.
  • codex failure detail: Codex review failed for this PR: Codex process timed out after 1200000ms.
  • codex stderr: No stderr captured.
  • codex stdout: {"type":"thread.started","thread_id":"019f3c7e-e46b-77e0-ace7-565752a05840"}.
  • process error code: ETIMEDOUT.

Likely related people:

  • unknown: Codex failed before it could trace repository history. (role: review did not complete; confidence: low)
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 commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Thanks @lsr911. The useful behavior from this PR was consolidated with the sibling UTF-16 boundary fixes into #101654 and landed on main in a9582a1bb62aa70bb0b0ceb72536d0d76f08eab8.

The landed fix uses the existing truncateUtf16Safe helper, preserves this caller's prior code-unit limit and output shape, and adds caller-level surrogate-boundary coverage. Closing this PR as superseded by the canonical landed change.

@steipete steipete closed this Jul 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants