Repository navigation
feat(core): LLM consolidation executor reusing extraction setup (#1088) - #1094
Merged
Merged
Conversation
Adds consolidation_exec: executes a segment-based ConsolidationPlan via the same OpenAI-compatible endpoint as the import/extraction pipeline (shared ExtractionConfig - one setup, many uses). Each batch becomes one LLM call with a consolidation prompt that preserves hedging. Outputs pass the #1089 provenance gate before write; sources are soft-deprecated, never deleted. Budget-capped via max_llm_calls.
🔍 Cora AI Code Review✅ No issues found. Code looks good! Review powered by cora-code · BYOK · MIT |
A failed LLM call no longer aborts execute_plan mid-run: the error is recorded in ConsolidationExecution.batch_errors and remaining batches still process. Failed batches leave their sources untouched.
…batch - Compute embedding via ConsolidationStore::embed_content before insert so consolidated records are visible to vector recall (was embedding: vec![]). - insert/deprecate failures abort only the affected batch and are recorded in batch_errors; the run continues (duplicate content from a partial write is recoverable by dedup, lost batches are not).
Failed calls still consume an API request against max_llm_calls, so the guard now uses a dedicated llm_calls_made counter incremented before the call regardless of outcome. Also rewords an error message that tripped a false-positive SQL-injection pattern (no SQL involved).
| /// validated against the provenance policy, embedded, written, and its | ||
| /// sources are soft-deprecated with a reason pointing at the new record. | ||
| pub fn execute_plan<U: ConsolidationStore>( | ||
| uteke: &U, |
- reqwest blocking client gets a 120s timeout so a slow consolidation endpoint cannot hang the run (parity with update_check). - LLM-provided fact_type is validated against the allowed set (fact/decision/preference/procedure/context); anything else falls back to "fact" so arbitrary model output can never set an unknown type.
This was referenced Aug 25, 2026
ajianaz
added a commit
that referenced
this pull request
Sep 6, 2026
What
Adds
consolidation_exec— the execution layer completing the #1088 segment-consolidation pipeline:ExtractionConfig(same model / API key / base URL as the import/extraction pipeline) — one setup serves both purposes, zero new configurationexecute_plan(): iterates the plan's batches; each batch → one LLM call with a consolidation prompt that merges same-topic memories into one dense record and explicitly preserves hedging markers (EN + ID)ProvenancePolicy::validate_output(Research: trust boundary & provenance for consolidated memories #1089) before write; rejected outputs are counted, never storeddeprecated=truewith a reason pointing at the consolidated record — never deletedmax_llm_callsper run; skipped batches are reportedConsolidationStoretrait: store operations isolated for testabilityWhy
Final phase of #1088: the planner (PR #1092) showed 67–91% LLM call reduction on real rooms; this executor realizes it using the extraction endpoint already configured, and the #1089 policy guarantees consolidated records cannot launder untrusted content into human facts or manufacture confidence.
Testing
ConsolidationStoretrait boundary