Skip to content

perf(context),refactor(llm): add fidelity tracing spans and extract response body helper#4891

Merged
bug-ops merged 1 commit into
mainfrom
4872-fidelity-tracing
Jun 5, 2026
Merged

perf(context),refactor(llm): add fidelity tracing spans and extract response body helper#4891
bug-ops merged 1 commit into
mainfrom
4872-fidelity-tracing

Conversation

@bug-ops

@bug-ops bug-ops commented Jun 5, 2026

Copy link
Copy Markdown
Owner

Summary

Changed files

  • crates/zeph-context/src/fidelity.rs — 2 new #[tracing::instrument] attributes
  • crates/zeph-llm/src/http.rs — 2 new pub(crate) async helpers
  • crates/zeph-llm/src/openai/mod.rs — 5 call sites simplified
  • crates/zeph-llm/src/claude/mod.rs — 3 call sites simplified
  • CHANGELOG.md — [Unreleased] section updated

Test plan

  • cargo nextest run --workspace --lib --bins → 10510 passed
  • cargo +nightly fmt --check → clean
  • RUSTFLAGS="-D warnings" cargo check --workspace --all-targets --features desktop,ide,server,chat,pdf,scheduler → clean
  • Verify context.fidelity.embed_prepass_dyn and context.fidelity.render_compressed spans appear in local Chrome JSON trace after a session with memory.n.enabled = true

Closes #4872
Closes #4877

@github-actions github-actions Bot added documentation Improvements or additions to documentation llm zeph-llm crate (Ollama, Claude) rust Rust code changes performance Performance improvements size/M Medium PR (51-200 lines) labels Jun 5, 2026
@bug-ops
bug-ops force-pushed the 4872-fidelity-tracing branch from e0907b5 to 5c26e92 Compare June 5, 2026 23:25
@bug-ops
bug-ops enabled auto-merge (squash) June 5, 2026 23:25
…esponse body helper

Add `#[tracing::instrument]` to `embed_prepass_dyn` and `render_compressed`
in `zeph-context/fidelity.rs`; both were invisible to local Chrome JSON traces.
All five async hot-path functions in fidelity.rs now emit `context.fidelity.*`
spans. Closes #4872.

Add `check_response` and `read_response_body` helpers to `zeph-llm/src/http.rs`.
Replace the duplicated three-line `status + text().await + map_error_response`
pattern at eight call sites across `openai/mod.rs` and `claude/mod.rs`.
Streaming call sites and those with custom retry or error-variant logic are
left unchanged. Closes #4877.
@bug-ops
bug-ops force-pushed the 4872-fidelity-tracing branch from 5c26e92 to 6e6bfc3 Compare June 5, 2026 23:34
@bug-ops
bug-ops merged commit 9998024 into main Jun 5, 2026
32 checks passed
@bug-ops
bug-ops deleted the 4872-fidelity-tracing branch June 5, 2026 23:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation llm zeph-llm crate (Ollama, Claude) performance Performance improvements rust Rust code changes size/M Medium PR (51-200 lines)

Projects

None yet

1 participant