Commit 1bed2a5
fix(F19+F20): strip UTF-8 BOM in read; bound interject channel (#91)
Two F-MEDIUM fixes from ROADMAP.md.
## F19 — UTF-8 BOM strip
Old Windows-saved files start with U+FEFF (0xEF 0xBB 0xBF). Before
this, the BOM survived `read_line` and ended up as an invisible
prefix on the first line shown to the LLM. opencode's
`Bom.readFile()` does the same strip on its side.
`read.rs` line loop now tracks `first_line` and strips a leading
`'\u{FEFF}'` from line 1 only. Mid-file BOMs (rare but possible
when concatenating files) stay as regular chars.
## F20 — Bounded interject channel
`AgentRunner::interject_tx: mpsc::UnboundedSender<()>` could grow
without bound if the user hammered the interject keybind while
the runner was in a long LLM call. Each press allocated an entry
even though all but the first were redundant (the runner drains
via `try_recv()` after the first wakeup).
- Switch to `mpsc::Sender<()>` with capacity 64.
- UI uses `try_send(())` instead of `send(())`: if the channel is
full, no-op (we already have a wakeup queued).
- Updated all 9 ownership transfer sites + the runner-side
receiver type.
## Tests
F19: two new tests in `agent::tools::read::tests`:
- `read_strips_utf8_bom_from_first_line`: writes a file starting
with `\u{FEFF}`, asserts the output has no BOM byte anywhere.
- `read_only_strips_bom_at_start_of_file`: BOM in line 2 stays
intact — guards against the strip applying to wrong lines.
F20: no new tests (capacity-bound is a runtime contract; the
existing interjection-queue tests in ui already exercise the
try_send path).
681 pass (was 679). All build profiles clean.
Co-authored-by: Yogthos <yogthos@gmail.com>1 parent 4edacb2 commit 1bed2a5
3 files changed
Lines changed: 90 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
119 | 119 | | |
120 | 120 | | |
121 | 121 | | |
122 | | - | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
123 | 130 | | |
124 | 131 | | |
125 | 132 | | |
| |||
220 | 227 | | |
221 | 228 | | |
222 | 229 | | |
223 | | - | |
| 230 | + | |
224 | 231 | | |
225 | 232 | | |
226 | 233 | | |
| |||
361 | 368 | | |
362 | 369 | | |
363 | 370 | | |
364 | | - | |
| 371 | + | |
| 372 | + | |
365 | 373 | | |
366 | 374 | | |
367 | 375 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
| 124 | + | |
124 | 125 | | |
125 | 126 | | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
126 | 139 | | |
127 | 140 | | |
128 | 141 | | |
| |||
276 | 289 | | |
277 | 290 | | |
278 | 291 | | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
279 | 348 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
457 | 457 | | |
458 | 458 | | |
459 | 459 | | |
460 | | - | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
461 | 464 | | |
462 | 465 | | |
463 | 466 | | |
| |||
1385 | 1388 | | |
1386 | 1389 | | |
1387 | 1390 | | |
1388 | | - | |
| 1391 | + | |
| 1392 | + | |
| 1393 | + | |
| 1394 | + | |
| 1395 | + | |
| 1396 | + | |
1389 | 1397 | | |
1390 | 1398 | | |
1391 | 1399 | | |
| |||
0 commit comments