Repository navigation
Decouple execution history and feature-gate response caching - #134
Open
arthurianresolve wants to merge 76 commits into
Open
arthurianresolve wants to merge 76 commits into
arthurianresolve wants to merge 76 commits into
Conversation
…-structured-output # Conflicts: # crates/dspy-rs/src/core/lm/mod.rs # crates/dspy-rs/src/trace/span.rs
Preview approval requiredThis pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit |
…ured-output # Conflicts: # crates/dspy-rs/src/adapter/chat.rs # crates/dspy-rs/src/ir/interp.rs # crates/dspy-rs/src/predictors/predict.rs # crates/dspy-rs/src/typesys/coerce.rs
This was referenced Nov 10, 2026
This was referenced Nov 19, 2026
arthurianresolve
added a commit
to arthurianresolve/DSRs
that referenced
this pull request
Nov 19, 2026
Integrate krypticmouse#134 — Decouple execution history and feature-gate response caching
This branch has not been deployed
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 of Fix
Includes resolved #121, #103 and #133 (with #131/#132). Merge the runtime/rendering/LM PRs before this PR.
Integrate configuration overrides with independent history and optional caching. Give config copies fresh history while retaining injected clients for generation-only changes; validate cache requests and feature-gate cache initialization in
copy_with.Compose LM/default/explicit-call scopes with history scopes in either wrapper order, preserving predictor discovery and concurrent override isolation.
Record bounded execution history independently of response caching, including cache hits, tool calls, provider and parse failures, and cancellations.
Add global and per-LM inspection, automatic predictor history, and parent-module tracking through
Module::with_history. Configure and clear each store independently; LM clones share their store, while replacing a client starts fresh history and cache state.Store input messages, redacted LM configuration, raw responses, parsed outputs, usage, timestamps, call IDs, caller paths, and trace-format events/errors. Attach the interpreter's parsed result to the same record visible at each history level. Cache hits report zero newly consumed tokens.
Add a default-on
cacheCargo feature for foyer, tempfile, response-cache exports, andLM::cache_handler. Reject explicit cache requests when the feature is absent, both during construction and after configuration changes.Remove unused Rayon and its unused transitive dependencies. Preserve the existing
datafeature and default data-loading/cache availability; JSON/JSONL loading and execution history remain available without either feature.Document history inspection, module scopes, API migration, and the supported feature combinations.
Add structured optimizer compilation, batch/rollout progress and budget events, plus module/evaluator/parse/constraint spans. Emit full prompts, responses and intermediate choices only through the opt-in
dsrs::content=debugtarget.Preserve typed completion, tool, rollout, cache and data-loading causes through outer errors. Report HTTP data-loading status before parsing; retain mapper row context and the original cause.
Integrate the current trace capture/JSONL/replay APIs with invocation history and document their different lifecycles. Verify a composed flow and parse-failure behavior through the active APIs.
Add a first-class
InteractionStorewith a versioned, locked JSONL implementation. Persist raw/parsed invocation revisions and complete captured traces, expose call IDs, and correlate invocations with their trace IDs.Compose persistence through
with_interaction_store, independently of cache or bounded history retention. Preserve typed storage failures and recover an interrupted final append without accepting corrupt complete records.Fixes #55
Fixes #70
Fixes #74
Fixes #56
Fixes #67
Fixes #68
Why
In-memory history and trace serialization alone did not supply a persistent interaction store. The new integration journals calls and traces with durable revisions and stable invocation IDs, including when history capacity is zero. Scoped persistence waits until completion to return storage errors; spawned tasks establish their own scope. See
docs/interaction-storage.md.History previously read a window maintained by response-cache insertions. Disabling caching therefore removed history, and inserting cache entries could appear to represent executions. Moving invocation records into independent stores makes history reflect actual LM calls and allows response-cache storage to be compiled out.
The existing
datafeature already gates Arrow, Parquet, Hugging Face and CSV. The remaining cache dependencies were unconditional, and Rayon had no source consumers. With this change,--no-default-featuresexcludes those stacks from the normal dependency graph. HTTP support remains required for LM providers and JSON/JSONL loading; tempfile remains a development dependency for tests.LM::inspect_historynow returnsVec<HistoryEntry>instead ofVec<CacheEntry>, andResponseCache::get_historyis removed. Predictors collect history automatically; parent modules opt in withwith_history, and spawned tasks must establish their own scopes. History complements trace capture and replay using the existing event/error types. Pure trace replay does not invoke the LM and does not add history. Pricing is unavailable, socostremainsNone; failed or cancelled calls retain unknown usage asNone.Related work
tracing; content logging is explicit opt-in. proper error handling #67 retains existing outer APIs where appropriate, with typed causes available by source traversal/downcast. This does not claim every internal assertion has been removed.Testing
Final integrated cache-enabled release checks: 61 tests passed using
--no-default-features --features cache(three live tests excluded from this offline run). This covers invocation history, persistent storage, tool-loop limits, native/scalar output and trace/history parity.The current integrated minimal-feature suite passed 68 tests across compiler transformations, structural edits, persistent storage, typed special fields, and trace/history behavior (two live tests skipped in the offline run; both passed separately).
Storage regressions include six simultaneous writers using independent handles, revision replacement, torn-append recovery, corrupt-row rejection, scoped error causes, call-ID propagation and captured-trace round trips.
The resolved stack at
2b4590f0174dc05582347b8da75b6b58fbce9ca0passed 209 tests with--no-default-featuresand 247 with defaultdata/cachefeatures (2 live tests ignored per offline run). These are focused library and integration suites, not the full workspace test suite. Later ancestry-only integration merges preserve the validated source trees.Three observability regressions verify progress/budget events, typed rollout causes, parent module spans and opt-in content logging.
Two trace/history regressions exercise real composed predictions, JSONL round trips, strict replay and parse-failure parity. Two data-error regressions retain concrete JSON/mapper causes and local HTTP 429 status.
History/configuration suites cover cache on/off, copies and replacement-client isolation, both LM/history wrapper orders, cancellation, parse failures and concurrency.
The normal
--no-default-featuresdependency graph excludes foyer, tempfile, Rayon, Arrow, Parquet, Hugging Face and CSV; tests retain tempfile as a development dependency. No dependency versions were updated.The final integrated live matrix also passed all nine example task signatures against temporary Ollama/llama3.2; this is separate from the offline suites.
git diff --check— passed.AI Disclosure