Repository navigation
fix(cognition): shared single-flight embed resolver — kills the per-persona 1.2GB model-load storm - #2106
Merged
Conversation
… model-load storm (BigMama's 102-context spin) Glass-boxed live on the Windows node: 102 llama_context creations x ~1200 MiB with ZERO IPC deltas, eating memory out from under the ResourceGovernor. Root cause: resolve_recall_embedder runs per persona REGISTRATION (and registration re-runs on every respawn), and every call built a FRESH LlamaCppAdapter — a full ~1.2 GB embed-GGUF load into a new context, a probe, and ~16 calibration passes. The call-site comment claimed "already cached by the resolver"; only content vectors were cached, never the resolution. Nine personas = nine resident embed contexts; respawn churn = the storm. Fix: rung 1 (the in-process embed model) resolves through ONE process-global cell. Success memoizes permanently and resolution is single-flight (concurrent spawns share one load). Failure is never memoized permanently — the #71 lesson: a late-arriving embed model must still be adoptable — but re-attempts are rate-limited by a 60s cooldown, capping the worst case at ~1 load/minute instead of one per respawn. Regression test pins the invariant: three back-to-back failed resolves cost at most ONE load attempt. Also repairs two test call sites of PersonaInstanceManagerModule::new that PR #2105 missed (its signature change compiled clean under `cargo check` but broke `cargo test` builds — check does not compile test code). Governor accounting follow-up stays #225 (register embed weights as a ResourceConsumer); this fix removes the drift MULTIPLICATION. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
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.
The bug (BigMama's Windows spin, taken on per Joel: "take on her hard challenges")
102 llama_context creations × ~1200 MiB with zero IPC deltas — an internal storm eating memory out from under the governor.
resolve_recall_embedderruns once per persona registration (re-run on every respawn), and each call constructed a freshLlamaCppAdapter: full embed-GGUF load into a new context + probe + ~16 calibration passes. The "already cached by the resolver" comment at the call site was false — only content vectors were cached, never the resolution. Nine personas = nine resident embed contexts on EVERY node (M5 included); respawn churn on Windows made it a storm.The fix
PersonaInstanceManagerModule::newtest call sites missed by fix(persona): home room from HER durable membership — never the operator's focused room (#298) #2105 (its signature change passedcargo checkbut broke test builds).Testing
cargo test -p continuum-core --lib --features metal,accelerate failed_rung1— passes.cargo test ... persona_instance— 6/6 pass (test-build errors from fix(persona): home room from HER durable membership — never the operator's focused room (#298) #2105 gone).#225 (embed weights as governor ResourceConsumer) remains the accounting follow-up; this removes the multiplication.
🤖 Generated with Claude Code
https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo