engram tiered storage: engram-service wiring + elc fold-hang fix + prune-store mirror

- Wire paged store into the ENGRAM SERVICE (server.el, the authoritative durable
  owner): boot->engram_store_boot, persist_canonical->engram_store_checkpoint,
  gated by ENGRAM_STORE.
- elc (lang/elc.c + src/parser.el + codegen.el + elc-combined.el): OOB guard in
  tok_kind/tok_value + parse_block progress backstop — fixes the pre-existing
  unbounded-memory fold hang on sessions.el.
- engram_prune_telemetry mirrors ISE prune to the store (store_forget) so store
  live-count tracks resident and stale telemetry stays bounded.
- Deployed live 2026-08-12: engram :8742 on neuron.egm+WAL, count reconciled 11552.
This commit is contained in:
2026-08-12 14:14:20 -05:00
parent 9a0266cbf9
commit bb64a236ed
7 changed files with 263 additions and 26 deletions
+13
View File
@@ -8038,6 +8038,19 @@ el_val_t engram_prune_telemetry(el_val_t older_than_ms) {
g->edge_count = ew;
free(set);
}
/* Mirror the telemetry prune into the durable paged store so its live
* count tracks the resident graph and stale ISE telemetry stays bounded
* in the store too. Without this, the resident graph GCs old ISE from RAM
* (node_count drops) while the store retains them (count diverges + the
* store re-accumulates the very telemetry bloat this prune was written to
* stop). Matches engram_forget's store_forget mirror. Done before the ids
* are freed below. */
if (engram_store_enabled() && g_engram_store) {
for (int64_t i = 0; i < removed; i++) {
store_forget(g_engram_store, removed_ids[i]);
}
}
for (int64_t i = 0; i < removed; i++) free(removed_ids[i]);
free(removed_ids);