Fix bounds check panic and batched lock in collect_results

- subconscious.rs: use .get(fork_point..) instead of direct slice
  to avoid panic when fork_point > entries.len()
- dmn.rs: batch all output injections (surface, reflection, thalamus)
  under a single agent lock acquisition instead of three separate ones
- dmn.rs: use Store::cached() instead of Store::load() when rendering
  surfaced memories
- Add scoring persistence analysis notes

Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
Kent Overstreet 2026-04-07 03:49:49 -04:00
parent 03d2d070f9
commit 0df5ec11d1
3 changed files with 87 additions and 31 deletions

View file

@ -166,7 +166,7 @@ impl SubconsciousScreen {
// Read entries from the forked agent (from fork point onward)
let entries: Vec<ConversationEntry> = snap.forked_agent.as_ref()
.and_then(|agent| agent.try_lock().ok())
.map(|ag| ag.context.entries[snap.fork_point..].to_vec())
.map(|ag| ag.context.entries.get(snap.fork_point..).unwrap_or(&[]).to_vec())
.unwrap_or_default();
if entries.is_empty() {