Skip to content

fix(llm): add #[non_exhaustive] to LLM enums, SSE buffer caps, Ollama HTTP timeout#4744

Merged
bug-ops merged 2 commits into
mainfrom
4725-llm-sse-hardening
May 30, 2026
Merged

fix(llm): add #[non_exhaustive] to LLM enums, SSE buffer caps, Ollama HTTP timeout#4744
bug-ops merged 2 commits into
mainfrom
4725-llm-sse-hardening

Conversation

@bug-ops
Copy link
Copy Markdown
Owner

@bug-ops bug-ops commented May 30, 2026

Summary

Closes #4725, #4727, #4729.

Test plan

  • cargo +nightly fmt --check — clean
  • cargo clippy --workspace -- -D warnings — clean
  • cargo nextest run --workspace --features desktop,ide,server,chat,pdf,scheduler --lib --bins — 10675 tests passed, 22 skipped
  • 5 new unit tests covering SSE buffer cap overflow paths for both input_json_delta and thinking_delta

@github-actions github-actions Bot added llm zeph-llm crate (Ollama, Claude) memory zeph-memory crate (SQLite) rust Rust code changes core zeph-core crate dependencies Dependency updates bug Something isn't working size/M Medium PR (51-200 lines) size/L Large PR (201-500 lines) and removed size/M Medium PR (51-200 lines) labels May 30, 2026
@bug-ops bug-ops enabled auto-merge (squash) May 30, 2026 14:11
@bug-ops bug-ops force-pushed the 4725-llm-sse-hardening branch from d961882 to 75ddbb5 Compare May 30, 2026 14:12
@github-actions github-actions Bot added size/M Medium PR (51-200 lines) and removed size/L Large PR (201-500 lines) labels May 30, 2026
bug-ops added 2 commits May 30, 2026 16:17
…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.
@bug-ops bug-ops force-pushed the 4725-llm-sse-hardening branch from 75ddbb5 to eb4d20e Compare May 30, 2026 14:17
@bug-ops bug-ops merged commit 6585ebf into main May 30, 2026
32 checks passed
@bug-ops bug-ops deleted the 4725-llm-sse-hardening branch May 30, 2026 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working core zeph-core crate dependencies Dependency updates llm zeph-llm crate (Ollama, Claude) memory zeph-memory crate (SQLite) rust Rust code changes size/M Medium PR (51-200 lines)

Projects

None yet

1 participant