Skip to content

fix(active-memory): keep timeout partial replies valid at emoji caps#102920

Closed
zhangguiping-xydt wants to merge 1 commit into
openclaw:mainfrom
zhangguiping-xydt:fix/problem-active-memory-partial-transcript-surrogate
Closed

fix(active-memory): keep timeout partial replies valid at emoji caps#102920
zhangguiping-xydt wants to merge 1 commit into
openclaw:mainfrom
zhangguiping-xydt:fix/problem-active-memory-partial-transcript-surrogate

Conversation

@zhangguiping-xydt

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where active-memory timeout recovery could attach a partial assistant transcript containing a broken UTF-16 surrogate when the transcript cap lands inside an emoji or other surrogate-pair character.

Why This Change Was Made

The partial transcript reader now applies the same UTF-16-safe truncation used by other active-memory text caps before storing or returning bounded assistant text. The fix stays limited to partial assistant transcript collection and does not change transcript parsing, memory search behavior, or summary generation.

User Impact

Users who hit active-memory timeout recovery can expect partial assistant replies to remain valid text instead of exposing replacement characters or malformed emoji boundaries in the recovered timeout context.

Evidence

  • Confirmed origin/main still used raw slice(0, remaining) and final joined slice(0, resolvedLimits.maxChars) in readPartialAssistantText; fix(active-memory): recall context breaks when recent turns contain emoji #102877 only covered the recent-turn recall query path.

  • Searched open PRs for readPartialAssistantText, activeMemoryPartialReply, partial assistant, surrogate, and UTF-16; no open PR was covering this same problem.

  • Focused validation:

    $ node scripts/test-projects.mjs extensions/active-memory/index.test.ts -- --maxWorkers=1
    [test] starting test/vitest/vitest.extension-active-memory.config.ts
    The `envFile` option is deprecated, please use `envDir: false` instead.
    
     RUN  v4.1.9 [local path redacted]
    
    [vitest] still running with no output for 30000ms (test/vitest/vitest.extension-active-memory.config.ts).
    [vitest] still running with no output for 60000ms (test/vitest/vitest.extension-active-memory.config.ts).
    
     Test Files  1 passed (1)
          Tests  159 passed (159)
       Start at  22:32:25
       Duration  84.80s (transform 32.74s, setup 1.14s, import 39.72s, tests 43.52s, environment 0ms)
    
    [test] passed 1 Vitest shard in 96.46s
    

@openclaw-barnacle openclaw-barnacle Bot added size: XS r: too-many-prs Auto-close: author has more than twenty active PRs. labels Jul 9, 2026
@openclaw-barnacle

Copy link
Copy Markdown

Closing this PR because the author has more than 20 active PRs in this repo. Please reduce the active PR queue and reopen or resubmit once it is back under the limit. You can close your own PRs to get back under the limit.

@steipete

steipete commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Thanks @zhangguiping-xydt. Recording final folded proof after this PR's queue-limit closure.

The original timeout-only head is c53382e1. It was resubmitted unchanged in #102940 and then folded into canonical #102877, which landed on current main as f1e7081b.

Current main includes this PR's single-record timeout regression plus the stronger multi-record boundary regression and bounded-prefix implementation: UTF-16-safe per-record truncation, stop-on-truncation or surrogate backoff, and exact separator accounting. It also fixes the sibling recent-conversation recall path, so no unique work remains to reopen here.

Your timeout-path work remains credited in folded source commit c0d70155 and in the landed commit. Full red/green and exact-head proof is recorded in the land-ready evidence. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

r: too-many-prs Auto-close: author has more than twenty active PRs. size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants