fix(llm): add #[non_exhaustive] to LLM enums, SSE buffer caps, Ollama HTTP timeout#4744
Merged
Conversation
This was
linked to
issues
May 30, 2026
d961882 to
75ddbb5
Compare
…llama HTTP timeout Closes #4725, #4727, #4729. - Add `#[non_exhaustive]` to `Role`, `ToolSseEvent`, `AnyProvider`, `ChatTemplate`, and `ModelSource` in zeph-llm so downstream crates must handle future variants explicitly. - Propagate wildcard match arms (`Role::User | _ => "user"`, etc.) to all exhaustive `match` expressions on `Role` and `ToolSseEvent` across the workspace (zeph-agent-context, zeph-context, zeph-core, zeph-memory and zeph-agent-persistence already had `_ => true`). - Cap the `input_json_delta` accumulation buffer at 4 MiB and the `thinking_delta` buffer at 1 MiB in `parse_tool_delta_event`; emit a `tracing::warn!` and discard excess bytes on overflow. - Add `fn ollama_reqwest_client()` in ollama.rs that builds a `reqwest 0.12` client (the version used by ollama-rs) with a 30-second connect timeout and a 10-minute hard backstop. Use the `reqwest012` package alias to avoid the version conflict with the workspace-wide `reqwest 0.13`. Replace `Ollama::new` with `Ollama::new_with_client`.
Clippy match_same_arms: Role::System => {} and _ => {} had identical
bodies after #4725 added the wildcard arm. Remove the redundant
non-wildcard arm.
75ddbb5 to
eb4d20e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #4725, #4727, #4729.
fix(llm): add #[non_exhaustive] to Role, ToolSseEvent, AnyProvider, ChatTemplate, ModelSource #4725 — Add
#[non_exhaustive]to five public enums inzeph-llm:Role,ToolSseEvent,AnyProvider,ChatTemplate,ModelSource. Downstream crates now require wildcard arms on exhaustive matches; wildcard arms (Role::User | _ => "user"etc.) propagated to all affected match sites across the workspace.fix(llm): add cap to tool-call JSON and thinking accumulation buffers in SSE drainer #4727 — Add buffer caps to the SSE drainer in
sse.rs:input_json_deltaaccumulation is capped at 4 MiB,thinking_deltaat 1 MiB. Overflow emitstracing::warn!and discards the excess bytes, matching the existing compaction buffer pattern.fix(llm): OllamaProvider has no timeout on HTTP requests #4729 — Add HTTP timeouts to
OllamaProvider.ollama-rs 0.3.4depends onreqwest 0.12while the workspace uses0.13; solved via areqwest012package alias. The newfn ollama_reqwest_client()builds a reqwest 0.12 client with 30s connect timeout and 10-minute hard backstop, injected viaOllama::new_with_client.Test plan
cargo +nightly fmt --check— cleancargo clippy --workspace -- -D warnings— cleancargo nextest run --workspace --features desktop,ide,server,chat,pdf,scheduler --lib --bins— 10675 tests passed, 22 skippedinput_json_deltaandthinking_delta