itspig (#540, 2026-10-30) ran 0.2.4 against copilot.tencent.com and the
refusal still reached the agent. The real chunk's content is
"\nSorry, I can't respond to this question.\n" with finish_reason
content_filter. filterSaid trimmed only the start, so the trailing "\n"
made the text longer than FILTER_SAYS, the prefix test failed, and the
chunk went out as an ordinary answer.
filterSaid now trims both sides, and text that is only white space so
far may still be the line (so a "\n" sent in a chunk of its own is held,
not passed on). The reporter's suggested `t.startsWith(s)` is not taken:
it would treat the line followed by real words as the filter's and drop
those words at content_filter. `without` already removes the whole
content field, so the newlines go with it.
Run (on mote, mote-run):
- HOME=$(mktemp -d) bun test packages/workbuddy: 286 pass, 0 fail.
- bun scripts/check.mjs: ok.
- filtered.test.mjs has itspig's literal last three SSE events (the
" node" reasoning chunk, the refusal chunk, [DONE]), cut every 1, 7
and 1MiB bytes, plus newline-in-its-own-chunk, line-then-more-words
and newline-then-answer cases.
Broken by hand:
- 0.2.4's trimStart filterSaid: the 3 literal-bytes tests and the
own-chunk newline test go red (4 of 15).
- The reporter's trim() + t.startsWith(s) with t !== "": the own-chunk
newline and line-then-more-words tests go red (2 of 15).
Not tried: a live WorkBuddy account; the trigger prompt was not run.