Commit 6b361ff
authored
🤖 fix: preserve assistant markdown whitespace (#3209)
Summary
- Preserve assistant text separators when normalizing history for
provider requests, preventing prior streamed Markdown from being re-sent
as clobbered headings like `## VerdictThis`.
Background
- Streaming stores assistant text as separate deltas. The request
sanitizer dropped whitespace-only text deltas before later coalescing,
so a prior sequence like `## Verdict`, `\n\n`, `This...` could become
`## VerdictThis...` in future prompts.
Implementation
- Coalesce consecutive assistant text parts before filtering
whitespace-only blocks.
- Continue filtering assistant messages that are genuinely empty or
whitespace-only.
- Add regression coverage for heading separators surviving the full
sanitizer + provider transform path.
Validation
- `bun test src/node/services/messagePipeline.test.ts`
- `make typecheck`
- `make static-check`
- post-rebase `make static-check`
Risks
- Low. The change is request-only and preserves existing filtering of
whitespace-only assistant messages while avoiding destructive separator
deletion between meaningful text chunks.
---
_Generated with `mux` • Model: `openai:gpt-5.5` • Thinking: `xhigh` •
Cost: `$7.32`_
<!-- mux-attribution: model=openai:gpt-5.5 thinking=xhigh costs=7.32 -->1 parent 2b735e0 commit 6b361ff
2 files changed
Lines changed: 93 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| |||
210 | 210 | | |
211 | 211 | | |
212 | 212 | | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
213 | 246 | | |
214 | 247 | | |
215 | 248 | | |
| |||
241 | 274 | | |
242 | 275 | | |
243 | 276 | | |
244 | | - | |
245 | | - | |
246 | | - | |
| 277 | + | |
247 | 278 | | |
248 | | - | |
| 279 | + | |
249 | 280 | | |
250 | 281 | | |
251 | 282 | | |
252 | 283 | | |
253 | | - | |
| 284 | + | |
254 | 285 | | |
255 | 286 | | |
256 | 287 | | |
257 | | - | |
| 288 | + | |
258 | 289 | | |
259 | 290 | | |
260 | 291 | | |
| |||
0 commit comments