Tool results and evidence can end on a lone surrogate half when clipped
I maintainer di solito rispondono entro 3 giorni
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 78/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- node.js, typescript
Direzione di ricerca
Start by reading clipCalendarText in apps/server/src/engine/conversation.ts and sanitizeFileName in files.ts, which the issue identifies as existing guards. Then inspect the listed clipping sites in conversation.ts, model.ts, service.ts, browser.ts and jev/service.ts; check how each handles a cut through a surrogate pair. Done means the same limits are preserved without returning a lone surrogate, with the described reproduction case covered.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
What happened?
Mail and page text reaches tool results, recorded evidence and notifications through String.prototype.slice(0, limit) on the UTF-16 code units (for example the mail snippet at apps/server/src/engine/conversation.ts (snippet: body.slice(0, 240), read_mail_thread's body.slice(0, 12000)), the search/web/page clips in apps/server/src/engine/model.ts and the monitor/evidence clips in apps/server/src/engine/service.ts, plus browser.ts and jev/service.ts). When the cut index lands between the two halves of a surrogate pair (an astral character such as an emoji), the clipped value ends on a lone high surrogate:
- it is not a character: UI renderers show U+FFFD in its place, and
- consumers that encode the value to UTF-8 (for example any Python service that reads the same data) raise
UnicodeEncodeErroron the lone half.
Two places in the codebase already guard against exactly this: clipCalendarText in conversation.ts (added with the calendar tool) and sanitizeFileName in files.ts ("Slice code points, not UTF-16 units, so a surrogate pair is never split in half"), and #183 fixed the related case of a surrogate numeric character reference failing the mail list. The mail and page clips are the same class but do not use the guard.
Steps to reproduce
- Give a mail body or watched page an astral character (for example 👍, U+1F44D, the pair D83D DC4D) straddling index 240 (or 12000/30000/500 for the other surfaces) — or in code:
"a".repeat(239) + "\u{1F44D}".repeat(3). const snippet = body.slice(0, 240)→ the result ends with the lone half\uD83D:/[\uD800-\uDBFF]$/.test(snippet)istrue.- The same value passed through
JSON.stringifykeeps a\ud83descape, and encoding it to UTF-8 outside JS replaces or rejects the lone half.
Expected: clip at the same limit, but drop the high half with its low half when the cut would split a pair, the way clipCalendarText already does for calendar text.
Commit or release
main @ a4944f4.
Platform
Any (server-side string handling).
Environment and safe logs
Pure string handling; no provider or platform dependency. Reproduced with Node: ("a".repeat(239) + "\u{1F44D}").slice(0, 240).charCodeAt(239).toString(16) → d83d.
- Lingua principale
- TypeScript
- Stelle
- 5.6k
- Fork
- 797
- Merge medio
- 4g 8h
- PR unite (30g)
- 67
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di CopilotKit/openmuse
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
CopilotKit/openmuse#215 ·
I maintainer di solito rispondono entro 3 giorni
-
[Feature] Add LLMTR as a model providerForse già presa @knowhycodata l’ha presa 1 giorno fa. Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 25/100
CopilotKit/openmuse#212 ·
I maintainer di solito rispondono entro 3 giorni
-
[Feature] Dark modeAperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 24/100
CopilotKit/openmuse#181 ·
I maintainer di solito rispondono entro 3 giorni
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
CopilotKit/openmuse#179 ·
I maintainer di solito rispondono entro 3 giorni
-
Dependency DashboardAperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
CopilotKit/openmuse#153 ·
I maintainer di solito rispondono entro 3 giorni
Tutte le issue di CopilotKit/openmuse
Issue simili
-
Replace discontinued crypto-js in the themeForse già presa @aelmanaa l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
PaloAltoNetworks/docusaurus-openapi-docs#1689 ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
solana-foundation/solana-web3.js#4015 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
formatSearchQuery drops the :present modifier, so `email:present=true` is sent as `email=true`Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
I maintainer di solito rispondono entro 1 giorno
-
documentation
Difficoltà 1/5 1-3 ore Idoneità per principianti 90/100
ivopogace/opencode-courier#422 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
chapel-lang/chapel-vscode#158 ·
I maintainer di solito rispondono entro 1 giorno