Repository navigation
fix(memory): preserve Unicode in QMD search snippets - #103996
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed July 10, 2026, 8:05 PM ET / July 11, 2026, 00:05 UTC. Summary PR surface: Source +2, Tests +79. Total +81 across 4 files. Reproducibility: yes. Current main directly slices UTF-16 code units at all three affected QMD limits, and the supplied emoji cases deterministically exercise the malformed boundary. Review metrics: none identified. Stored data model Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Next step before merge
Security Review detailsBest possible solution: Land the shared-helper replacement at all three QMD-owned character limits while retaining the manager and public memory-tool regression coverage. Do we have a high-confidence way to reproduce the issue? Yes. Current main directly slices UTF-16 code units at all three affected QMD limits, and the supplied emoji cases deterministically exercise the malformed boundary. Is this the best way to solve the issue? Yes. Reusing the established UTF-16-safe helper at each owner-specific clamp fixes the root cause without changing budgets, ordering, metadata, configuration, or introducing a parallel truncation abstraction. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 63859f73e6ae. Label changesLabel justifications:
Evidence reviewedPR surface: Source +2, Tests +79. Total +81 across 4 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
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
Review history (1 earlier review cycle)
|
ac72909 to
9213d93
Compare
|
Land-ready at exact head
No config, ordering, citation policy, result metadata, docs, or changelog contract changes. |
|
Merged via squash.
|
What Problem This Solves
Fixes an issue where QMD memory results could contain malformed Unicode when an emoji crossed a configured snippet or prompt-injection budget. The corruption could surface in
memory_search, prompts, and CLI output, including after source citations were appended.Why This Change Was Made
All three QMD-owned prefix limits now use the existing surrogate-safe text helper: the per-result snippet limit, the manager's aggregate injected-character budget, and the post-citation aggregate budget. Both aggregate clamps remain because the CLI consumes manager results directly while the memory tool appends citations afterward.
User Impact
QMD memory snippets remain valid Unicode at configured size boundaries. Existing result sizes, ordering, source metadata, citations, and ASCII behavior are unchanged.
Evidence
@@ -1,1\nabc😀tailat a 12-unit boundary now yields exactly@@ -1,1\nabcfor both the per-result and aggregate manager paths instead of ending in a lone high surrogate.abc😀tailat a 4-unit budget now yields exactlyabcthrough the public memory-search tool path.tbx_01kx76v3wggn4091s5shmsdan3: 176 focused tests passed acrossqmd-manager.test.tsandtools.citations.test.ts.check:changed, including extension production/test typechecks, lint, dependency/package guards, database-first guard, and runtime import-cycle checks.oxfmt,git diff --check, and fresh Codex autoreview passed; autoreview reported no actionable findings with 0.98 correctness confidence.