Persona T7: a note retry skips what the first pass already settled; tests follow the titles-only line

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-11-27 18:47:08 +01:00
commit 9d02af2240
3 changed files with 11 additions and 2 deletions

View file

@ -766,10 +766,15 @@ pub(crate) fn decide_in(model: &dyn Model, segment_id: &str, packet: &Packet, na
let note_bodies = without_drafts(&bodies, &found);
let mut batch = parsed.remember;
let mut retried = false;
// What the first pass settled without sending back: a second answer that says it again is the model restating its answer, not a rephrasing.
let mut settled_texts: Vec<String> = Vec::new();
loop {
let mut again: Vec<(String, MemoryRefusal)> = Vec::new();
for proposed in batch {
let text = proposed.text.trim();
if retried && settled_texts.iter().any(|seen| seen == text) {
continue;
}
let reason = if text.is_empty() {
Some(MemoryRefusal::MemoryEmpty)
} else if text.len() > MEMORY_BYTES {
@ -785,11 +790,13 @@ pub(crate) fn decide_in(model: &dyn Model, segment_id: &str, packet: &Packet, na
if reason.retryable() && !retried {
again.push((text.to_owned(), reason));
} else {
settled_texts.push(text.to_owned());
memory_refused.push(json!({ "act": "remember", "text": text, "reason": reason }));
}
continue;
}
remembered += 1;
settled_texts.push(text.to_owned());
let (about, unknown): (Vec<String>, Vec<String>) = proposed.about.into_iter().partition(|id| shown(id));
about_dropped.extend(unknown);
proposals.push(json!({ "kind": "remember", "text": text, "about": about, "importance": proposed.importance.clamp(0.0, 1.0), "private": proposed.private, "room": room }));

View file

@ -144,7 +144,7 @@ fn r7_a_live_search_keeps_only_results_that_hold_her_words() {
}
}
let kept = repo_read(&Recorded, "GameCult/Bifrost?q=consent").unwrap();
assert!(kept.starts_with("- #87 ") && kept.lines().count() == 2 && kept.lines().nth(1).is_some_and(|line| line.starts_with("- #71 ")), "{kept}");
assert!(kept.starts_with("- #87 ") && kept.lines().count() == 3 && kept.ends_with(TITLES_ONLY) && kept.lines().nth(1).is_some_and(|line| line.starts_with("- #71 ")), "{kept}");
assert!(repo_read(&Recorded, "GameCult/Bifrost?q=CONSENT receipt").unwrap().starts_with("- #71 "));
assert_eq!(repo_read(&Recorded, "GameCult/Bifrost?q=consent signature"), Err(ReadFailure::NotFound));
assert_eq!(repo_read(&Recorded, "GameCult/Bifrost?q=sealion"), Err(ReadFailure::NotFound));

View file

@ -8,6 +8,7 @@ use crate::projection::harness::tests::{Replaying, Scripted, control};
use serde_json::json;
use crate::projection::narrate::PROJECTOR_OPENING;
use crate::projection::{Answer, Failed, Model, Spent};
use crate::projection::read::TITLES_ONLY;
const TOBIAH: &str = "@eureka:gamecult.org";
const LIBBY: &str = "@libby:gamecult.org";
@ -800,7 +801,8 @@ who = "her"
let since = DateTime::parse_from_rfc3339("2026-11-19T15:00:00Z").unwrap().with_timezone(&Utc);
let reads = CastReads { recorded: &recorded, domain: Some(&domain) };
let read = |slug: &str| reads.read(&ReadRequest::Campaign(slug.into()), since);
assert_eq!(read("heimdall-body"), Ok("- Account merge ships dark by default: notices and the merge pages stay off until the operator turns them on".to_owned()));
assert_eq!(read("heimdall-body"), Ok(format!("- Account merge ships dark by default: notices and the merge pages stay off until the operator turns them on
{TITLES_ONLY}")));
assert_eq!(read("nowhere"), Err(ReadFailure::NotFound));
let mut worded = domain.clone();
worded.campaigns[0].rulings[0].ruling = Some("dark until the operator sets AccountMerge__Enabled".into());