Commit f0752f0
committed
fix(opencode): publish overflow error when recovery is abandoned, not attempted
A provider 413 with auto-compaction on published Session.Event.Error and
then recovered: compact, retry, succeed. Every consumer of that channel
treats it as the run's outcome — CLI run exits 1, TUI shows an error
toast, the desktop app fires an OS notification, and orchestrators
tailing --format json mark the run failed — so a run that produced a
complete, correct result was reported as a failure.
The publish at processor.halt's auto-compact branch was the outlier on
three counts: it was the only publisher that does not set message.error
(the durable record disagreed with the event), the only one not followed
by idle or a throw, and nothing consumed it (compaction is triggered by
the "compact" return value). Recoverable provider errors elsewhere are
silent: retried 429s never publish, and the proactive overflow check
sets needsCompaction without an event.
Move the announcement to where failure is actually decided: compaction's
result === "compact" branch ("too large to compact even after
stripping"), which already writes the durable error but published
nothing — its error event previously arrived only as a side effect of
the halt re-entering during summary generation. Net contract:
session.error with a sessionID fires iff the outcome is affected.
Tests pin both directions: 413 -> compact -> retry exits 0 with no error
event; 413 -> compaction also overflows exits 1 with exactly one error
event carrying the clearer compaction message. Both fail without the
source change (verified by stashing it).
The recovered-413 fixture is from #123 by Magnus, which fixed the same
symptom consumer-side in run.ts; this supersedes it at the producer so
run.ts stays identical to upstream and stream consumers need no
clear-on-later-success logic.1 parent 7f37345 commit f0752f0
3 files changed
Lines changed: 70 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
402 | 402 | | |
403 | 403 | | |
404 | 404 | | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
405 | 408 | | |
406 | 409 | | |
407 | 410 | | |
408 | 411 | | |
409 | 412 | | |
410 | 413 | | |
411 | 414 | | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
412 | 419 | | |
413 | 420 | | |
414 | 421 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
638 | 638 | | |
639 | 639 | | |
640 | 640 | | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
641 | 647 | | |
642 | | - | |
643 | 648 | | |
644 | 649 | | |
645 | 650 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
241 | 241 | | |
242 | 242 | | |
243 | 243 | | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
244 | 301 | | |
245 | 302 | | |
246 | 303 | | |
| |||
0 commit comments