fix(active-memory): keep timeout partial replies valid at emoji caps#102940
Conversation
|
Thanks for the context here. I swept through the related work, and this is now duplicate or superseded. This PR can close as superseded because the same timeout-partial UTF-16 fix is already included in the broader canonical active-memory fix at #102877, which also covers recent recall snippets, multi-record timeout boundaries, and stronger proof. Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Canonical path: Use #102877 as the single landing path for the active-memory UTF-16 truncation fix, then close the timeout-only duplicates. So I’m closing this here and keeping the remaining discussion on #102877. Review detailsBest possible solution: Use #102877 as the single landing path for the active-memory UTF-16 truncation fix, then close the timeout-only duplicates. Do we have a high-confidence way to reproduce the issue? Yes. Current main and the latest release both show raw UTF-16 code-unit slicing in the timeout partial transcript path, and the canonical PR includes red/green proof for this exact failure mode. Is this the best way to solve the issue? No. This timeout-only branch is not the best landing path because #102877 includes the same fix plus adjacent recent-recall coverage, multi-record timeout coverage, and stop-on-backoff behavior. Security review: Security review cleared: Cleared: the diff only changes active-memory string truncation and tests, with no dependency, workflow, credential, package, or code-execution surface added. AGENTS.md: found and applied where relevant. What I checked:
Likely related people:
Codex review notes: model internal, reasoning high; reviewed against 4f9a371c9530. |
9030a7e to
f68679c
Compare
|
Thanks @zhangguiping-xydt. Recording the final landed proof on this already-closed resubmission. The live final head is f68679ca. Its +28/-7 two-file diff is exactly identical to #102920, with the same blobs for both changed files, so no unique code or regression remains here. The canonical fold, #102877, landed on current main as f1e7081b. It includes this PR's single-record timeout regression and the stronger bounded-prefix implementation: UTF-16-safe per-record truncation, stop-on-truncation or surrogate backoff, exact separator accounting, and an added multi-record boundary regression. It also fixes the sibling recent-conversation recall path. 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. |
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 current
origin/mainstill used rawslice(0, remaining)and final joinedslice(0, resolvedLimits.maxChars)inreadPartialAssistantText; fix(active-memory): recall context breaks when recent turns contain emoji #102877 covers the recent-turn recall query path, not the partial assistant transcript timeout recovery path.Checked fix(active-memory): recall context breaks when recent turns contain emoji #102877 after maintainer commits: it still only changes the recent-turn
recentUserChars/recentAssistantCharstruncation path, while this PR changesreadPartialAssistantText.Issue-specific runtime proof: the active-memory extension shard exercises the
before_prompt_buildtimeout recovery flow that reads partial assistant transcript JSONL, returnstimeout_partial, and verifies recovered partial text is surfaced through the active-memory prompt/status path. The same shard includes the new surrogate-boundary regression for the partial assistant transcript cap.Focused validation on the current PR head:
CI note: the remaining repeated failure is
checks-node-compact-small-whole-2timing out insrc/tui/tui-pty-local.e2e.test.ts > creates and adopts a fresh session through the real Gateway backend. That TUI PTY test config disables plugins/memory (plugins.enabled=false,slots.memory="none"), and the same focused test passed locally on this PR head, so I did not change active-memory code for that unrelated CI timeout.