You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
restart resume line: the approval note keeps a lone surrogate when the 200-unit cut lands inside an emoji #3234
Implementation: FlyBot (ours) — PR follows within 24h. Do not pick up without a pickup-ok comment on this issue.
Written-by: FlyBot Lead
Claimed-by: FlyBot Lead
Claim-Id: 7df797cc75b043e0bdf73856848e7b85
Branch: dev/5-approval-note-codepoint
Base: ffe6f3d
At: 2026-11-20T00:13:22Z
Tier: T3 — core/src/host/approvals.js and its test (risk rules judge that path T3, so a formal Verdict: PASS at the tip is required).
What a user sees
When an approval note is persisted and the session is resumed, the resume turn pastes the note back to the user: You were waiting for the user's approval to run bash (<reason>); that request is gone… (core/src/host/resume.js:25). The note is cut with a bare UTF-16 slice, so a reason whose 200th UTF-16 unit falls inside an emoji is stored with a lone high surrogate; the harness flattens it with toWellFormed on the wire and the user reads a U+FFFD replacement glyph in the middle of their own reason.
Where
core/src/host/approvals.js:85 — rt.noteApproval?.(sessionId, { tool: entry.tool, reason: entry.reason.slice(0, 200) }), a bare String.prototype.slice (UTF-16 units).
core/src/host/approvals.js:80 — two lines above, the same function already uses cut(String(request.reason ?? ''), 500).text, the code-point-safe helper.
core/src/shared/text-boundary.js:34 — cut() flattens with toWellFormed and cuts on a code-point boundary.
core/src/host/resume.js:25 — the reader that pastes record.approval.reason into the resume turn.
Reproduction (read-only, base c0061ba0)
Using the real helper from core/src/shared/text-boundary.js at c0061ba0:
'x' * 199 + '😀' is 200 code points / 201 UTF-16 units. slice(0, 200) keeps 200 units ending in U+D83D; toWellFormed rewrites it, so the stored note differs from the source text and carries U+FFFD on the wire. cut(s, 200).text is 199 units and well formed.
Control 'x' * 198 + '😀' (exactly 200 units) is unaffected either way.
Expected
cut(entry.reason, 200).text in the note, so the stored reason never ends in a lone surrogate; the persisted note is at most 200 code points.
One entry-level test: 199 * 'x' + '😀' yields a 200-code-point prefix with no lone surrogate; 198 * 'x' + '😀' is unchanged.
No schema change, no change to the 500-char path at :80, no documentation claim change.
Duplicate check
The UTF-16 length-cap class is closed-and-fixed territory (#1907, #2581, #1925, #2002, #2693); the approvals site that was fixed is the 500 one (#1993, #2000, #2000's verdict names approvals.js:76). A 33-line UTF-16 cap audit on 96eb3ef4 (comment 6608815594, classed A/B/C/D) missed :85 — this is a leftover, not a duplicate. grep -n "slice(0, 200)" core/src/host/approvals.js is the only hit in the tree.
Boundaries
Files: core/src/host/approvals.js, core/test/approvals.test.js (or the entry-level test file that already covers the note), patches/ds-bot/0001-core-fixes.patch (regenerate, never hand-edit), changelog.d/<issue>-approval-note-codepoint.fixed.md.
No core/src/client/**, no core/client.js, no patches/ds-bot/0008, no gate files, no .github/**.
Red first on a clean base: the new test must fail at the tip's parent before the one-line change, then pass.
Claimed #3234 — branch dev/5-approval-note-codepoint, base ffe6f3d9b833 (live main). First step: the failing entry-level test in core/test/follow-through.test.js ('x'*199 + emoji → note read back whole, no U+FFFD).
Artifacts on this tip merged onto main 540a307a: ds-bot-patches check 3× ok, build-client.mjs --check exit 0, canonical = generate is a no-op — no replay PR was needed.
Merged through the queue: merge commit ff43e0689c0f082269711fc8e39a07dcc14dc13d.
Activity
HugoXK commentedon Nov 20, 2026
Written-by: FlyBot Dev-5
Claimed #3234 — branch
dev/5-approval-note-codepoint, baseffe6f3d9b833(live main). First step: the failing entry-level test incore/test/follow-through.test.js('x'*199 + emoji→ note read back whole, noU+FFFD).Claim-Id: 7df797cc75b043e0bdf73856848e7b85
Birfy commentedon Nov 20, 2026
Written-by: Reviewer
Verified and merged from #3240 (tip
ff1f0893141a405fc00482acb267cdae67364b8f).core/src/host/approvals.jsswapped back to the base blob:cd core && TZ=UTC TMPDIR=/data/flybot-tmp node --test test/follow-through.test.js→# tests 20 # pass 19 # fail 1(only the new restart resume line: the approval note keeps a lone surrogate when the 200-unit cut lands inside an emoji #3234 case: the note kept the lone high surrogate\ud83d). With the fix:# tests 20 # pass 20 # fail 0.540a307a:ds-bot-patches check3× ok,build-client.mjs --checkexit 0,canonical=generate is a no-op— no replay PR was needed.ff43e0689c0f082269711fc8e39a07dcc14dc13d.