• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

dcdpr / jp / 26762686162
67%

Build:
DEFAULT BRANCH: main
Ran 01 Jun 2026 02:55PM UTC
Jobs 1
Files 396
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

01 Jun 2026 02:53PM UTC coverage: 66.093% (+0.07%) from 66.021%
26762686162

push

github

web-flow
fix(llm, cerebras, llamacpp): Handle pre-completion stream errors (#707)

Both the `cerebras` and `llamacpp` providers shared the same bug: the
`take_while(|e| e.is_ok())` guard dropped the first error from the SSE
stream without letting it reach the handler. That meant a dropped or
stalled connection before `[DONE]` was silently swallowed instead of
being surfaced to the retry layer.

At the same time, the benign connection-close that `EventSource` emits
after `[DONE]` was reaching the retry layer as a spurious error,
triggering unnecessary retries on what is actually a clean end of
stream.

The fix introduces a `finished` flag on `StreamState`. Once the `[DONE]`
sentinel is processed and `Event::Finished` is emitted, `finished` is
set to `true`. The `take_while` guard is replaced with a `seen_error`
latch that lets exactly one error through (so the handler can inspect
it), and the `Err` arm of `handle_sse_event_sync` now drops the error
silently when `finished` is `true` and propagates it otherwise.

`EventSource`'s built-in auto-reconnect is also disabled via
`set_retry_policy(Box::new(Never))` on both providers, since reconnect
logic is owned by the outer retry layer and the internal reconnect was
masking real failures.

The stream-assembly logic is extracted into a standalone
`assemble_event_stream` function that accepts a generic `Stream`, making
it independently testable. Two async tests are added to each provider to
pin the contract:

- `surfaces_stream_error_before_completion`: a transport error before
`[DONE]` must reach the caller as a `StreamError`.
- `swallows_stream_error_after_completion`: the connection close after
`[DONE]` must not surface as an error and the stream must end with
`Event::Finished`.

Signed-off-by: Jean Mertz <git@jeanmertz.com>

71 of 73 new or added lines in 2 files covered. (97.26%)

2 existing lines in 1 file now uncovered.

32940 of 49839 relevant lines covered (66.09%)

258.08 hits per line

Uncovered Changes

Lines Coverage ∆ File
1
90.4
1.32% crates/jp_llm/src/provider/cerebras.rs
1
90.63
1.77% crates/jp_llm/src/provider/llamacpp.rs

Coverage Regressions

Lines Coverage ∆ File
2
87.39
-0.42% crates/jp_llm/src/test.rs
Jobs
ID Job ID Ran Files Coverage
1 26762686162.1 01 Jun 2026 02:55PM UTC 396
66.09
GitHub Action Run
Source Files on build 26762686162
  • Tree
  • List 396
  • Changed 5
  • Source Changed 2
  • Coverage Changed 5
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #26762686162
  • a4a09dc7 on github
  • Prev Build on main (#26684516727)
  • Next Build on main (#26763245628)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc