Skip to content

A self-improving RLM agent for coding workflows and long-running autonomous tasks.

Rust

remove saved-catalog transcript text (#3610)

Sebastian Müllerbdddd3fd3fac
diff --git a/.changes/remove-saved-catalog-transcript-text.md b/.changes/remove-saved-catalog-transcript-text.md
new file mode 100644
index 0000000000..654147a6f7
--- /dev/null
+++ b/.changes/remove-saved-catalog-transcript-text.md
@@ -0,0 +1 @@
+- Saved-session catalog rows no longer include `allMessagesText`; full session transcripts remain unchanged. Current Rust and Desktop clients do not use this field, but older TypeScript clients and older typed consumers that require it are incompatible with the new daemon.
diff --git a/crates/pa-daemon/README.md b/crates/pa-daemon/README.md
index 3000ef68d7..66eed1af77 100644
--- a/crates/pa-daemon/README.md
+++ b/crates/pa-daemon/README.md
@@ -84,10 +84,8 @@ merge non-resident ledger children (walk roots = saved + resident session
files), so passivated children stay roster-visible (TS
`walkPassiveRlmSubagents` / `withPassiveRlmDescendantInfos`). The saved
session scan (`session_store.rs`) folds each file once into the durable
-catalog row, including the agents-view search corpus the TS scan builds:
-the capped `allMessagesText` transcript text (64 KiB). Archived sessions live in
-`<agent-dir>/sessions-archive` and never reach the catalog scan, so search
-covers live sessions only.
+catalog row. Archived sessions live in `<agent-dir>/sessions-archive` and
+never reach the catalog scan, so search covers live sessions only.
Supervisor-backed RLM child sessions
(`rlm_children.rs`, the daemon side of the pa-core `RlmSubagentHost` seam):
`rlm.spawn`/`rlm.create_session` create real daemon sessions through the
diff --git a/crates/pa-daemon/src/session_store.rs b/crates/pa-daemon/src/session_store.rs
index 6d7a410ae2..6b3c091033 100644
--- a/crates/pa-daemon/src/session_store.rs
+++ b/crates/pa-daemon/src/session_store.rs
@@ -70,17 +70,13 @@ mod info;
mod info_sidecar;
pub(crate) use info::read_session_info_from;
+pub use info::{find_most_recent_session_for_cwd, read_session_info, SessionInfo};
#[cfg(test)]
use info::{
- append_capped_search_text, fold_scan_entry, message_content_text, raw_string, raw_u64,
- session_info_cache, SessionInfoEntry, SessionInfoGeneration, SessionInfoScanCache,
- SessionScanAccumulator, SessionScanState, SESSION_SCAN_MAX_CACHED_STATES,
+ message_content_text, raw_string, raw_u64, session_info_cache, SessionInfoEntry,
+ SessionInfoGeneration, SessionInfoScanCache, SessionScanState, SESSION_SCAN_MAX_CACHED_STATES,
SESSION_SCAN_RESUME_TAIL_BYTES,
};
-pub use info::{
- find_most_recent_session_for_cwd, read_session_info, SessionInfo,
- SESSION_LIST_SEARCH_TEXT_MAX_CHARS,
-};
pub(crate) use info_sidecar::persist_info_sidecar;
// The inline unit battery lives in session_store::tests.
diff --git a/crates/pa-daemon/src/session_store/info.rs b/crates/pa-daemon/src/session_store/info.rs
index a18fda2394..eb9b4288a4 100644
--- a/crates/pa-daemon/src/session_store/info.rs
+++ b/crates/pa-daemon/src/session_store/info.rs
@@ -26,9 +26,6 @@ pub struct SessionInfo {
pub modified: String,
pub message_count: usize,
pub first_message: String,
- /// Every user/assistant message text, concatenated, capped at
- /// `SESSION_LIST_SEARCH_TEXT_MAX_CHARS`: the agents-view search corpus.
- pub all_messages_text: String,
/// The own-usage summary — assistant aggregates plus summarization calls,
/// minus every attributed child block; `None` when the session recorded no billable work.
pub usage: Option<crate::session_usage::SessionUsageSummary>,
@@ -38,32 +35,10 @@ pub struct SessionInfo {
pub deleted_descendant_usage: Option<crate::session_usage::SessionUsageSummary>,
}
-pub const SESSION_LIST_SEARCH_TEXT_MAX_CHARS: usize = 64 * 1024;
-
/// The scan's read-buffer size: one 64 KiB fill reads the typical session in
/// a single syscall; only the syscall chunking changes.
const SESSION_SCAN_READ_BUF_BYTES: usize = 64 * 1024;
-/// Space-join the texts, cut the final addition at the cap. `used` is the
-/// corpus's char count before this append; the returned count is after it.
-pub(super) fn append_capped_search_text(current: &mut String, text: &str, used: usize) -> usize {
- if text.is_empty() {
- return used;
- }
- if used >= SESSION_LIST_SEARCH_TEXT_MAX_CHARS {
- return used;
- }
- let mut count = used;
- if count > 0 {
- current.push(' ');
- count += 1;
- }
- let remaining = SESSION_LIST_SEARCH_TEXT_MAX_CHARS - count;
- let mut taken = 0;
- current.extend(text.chars().take(remaining).inspect(|_| taken += 1));
- count + taken
-}
-
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub(super) struct SessionInfoGeneration {
pub(super) len: u64,
@@ -203,9 +178,8 @@ pub(super) const SESSION_SCAN_RESUME_TAIL_BYTES: usize = 16;
/// Clone is the snapshot fold's copy (TS `snapshotSessionInfo`). Serialize is
/// the persisted sidecar's form ([`super::info_sidecar`]): a released lease
/// holder writes it, a cold process loads it and folds only the tail.
-/// Persisted in `<stem>.info-cache.json`: any change to this fold's semantics
-/// or fields must bump `info_sidecar::INFO_SIDECAR_VERSION`, or old sessions
-/// keep the old build's prefix fold.
+/// Persisted in `<stem>.info-cache.json`: see
+/// `info_sidecar::INFO_SIDECAR_VERSION` for the version-bump rule.
#[derive(Clone, Default, Serialize, Deserialize)]
pub(super) struct SessionScanAccumulator {
header: Option<SessionHeader>,
@@ -215,10 +189,6 @@ pub(super) struct SessionScanAccumulator {
thinking_level: Option<String>,
pub(super) message_count: usize,
pub(super) first_message: String,
- pub(super) all_messages_text: String,
- /// [`SessionScanAccumulator::all_messages_text`]'s char count, kept in
- /// lockstep by the only writer (`append_capped_search_text`): avoids re-counting.
- pub(super) search_text_chars: usize,
last_activity_ms: Option<u64>,
usage_scan: crate::session_usage::UsageScan,
}
@@ -268,8 +238,6 @@ impl SessionScanState {
thinking_level: self.acc.thinking_level.clone(),
message_count: self.acc.message_count,
first_message: self.acc.first_message.clone(),
- all_messages_text: self.acc.all_messages_text.clone(),
- search_text_chars: self.acc.search_text_chars,
last_activity_ms: self.acc.last_activity_ms,
usage_scan: self.acc.usage_scan.clone(),
},
@@ -588,7 +556,6 @@ impl SessionScanState {
} else {
acc.first_message.clone()
},
- all_messages_text: acc.all_messages_text.clone(),
usage,
// Ledger-derived, never the file scan's: the listing arm attaches it from the ledger.
deleted_descendant_usage: None,
@@ -701,21 +668,11 @@ pub(super) fn fold_scan_entry(acc: &mut SessionScanAccumulator, raw: &str) -> Op
Some(acc.last_activity_ms.unwrap_or(0).max(timestamp));
}
}
- if (role == Some("user") && acc.first_message.is_empty())
- || (matches!(role, Some("user" | "assistant"))
- && acc.search_text_chars < SESSION_LIST_SEARCH_TEXT_MAX_CHARS)
- {
+ if role == Some("user") && acc.first_message.is_empty() {
let text = message_content_text(message.content);
- if role == Some("user") && acc.first_message.is_empty() && !text.is_empty() {
+ if !text.is_empty() {
acc.first_message.clone_from(&text);
}
- if matches!(role, Some("user" | "assistant")) {
- acc.search_text_chars = append_capped_search_text(
- &mut acc.all_messages_text,
- &text,
- acc.search_text_chars,
- );
- }
}
}
}
diff --git a/crates/pa-daemon/src/session_store/info_sidecar.rs b/crates/pa-daemon/src/session_store/info_sidecar.rs
index 1d43264558..9ed9fc278c 100644
--- a/crates/pa-daemon/src/session_store/info_sidecar.rs
+++ b/crates/pa-daemon/src/session_store/info_sidecar.rs
@@ -16,10 +16,13 @@ use super::info::{session_info_cache, SessionScanState};
/// The sidecar format version: a sidecar serves only at exactly this
/// version; any other version (an older or a newer build's) is a cold
-/// scan, the behavior without a sidecar. Bump on any change to
-/// [`SessionScanAccumulator`](super::info::SessionScanAccumulator) or
-/// [`UsageScan`](crate::session_usage::UsageScan) - the persisted fold's
-/// fields or semantics.
+/// scan, the behavior without a sidecar. Bump when an OLD sidecar's state
+/// would be wrong for this build - a new field or changed fold semantics
+/// in [`SessionScanAccumulator`](super::info::SessionScanAccumulator) or
+/// [`UsageScan`](crate::session_usage::UsageScan). Removing a field needs
+/// no bump: the plain `Deserialize` (no `deny_unknown_fields`) ignores the
+/// stale key, and the remaining state is exactly what this build's fold
+/// would have written, so the store stays warm.
const INFO_SIDECAR_VERSION: u32 = 2;
/// The on-disk envelope: the version gate plus the scan state.
@@ -68,10 +71,9 @@ pub(crate) fn persist_info_sidecar(path: &Path) {
// serialized fragment into its own write syscall.
let mut options = std::fs::OpenOptions::new();
options.write(true).create_new(true);
- // The sidecar carries message text (the search corpus, the first
- // message): the temp is owner-only like the session files
- // (`persist.rs`'s writer), and the rename carries the mode onto
- // the sidecar.
+ // The sidecar carries message text (the first message): the temp is
+ // owner-only like the session files (`persist.rs`'s writer), and the
+ // rename carries the mode onto the sidecar.
pa_core::platform::perms::set_private_mode(&mut options);
let mut file = io::BufWriter::new(options.open(&temp)?);
serde_json::to_writer(
diff --git a/crates/pa-daemon/src/session_store/tests.rs b/crates/pa-daemon/src/session_store/tests.rs
index e748855833..c715c013f5 100644
--- a/crates/pa-daemon/src/session_store/tests.rs
+++ b/crates/pa-daemon/src/session_store/tests.rs
@@ -648,30 +648,6 @@ fn branch_bridged_matches_the_strict_walk_on_clean_files() {
let _ = fs::remove_dir_all(&dir);
}
-#[test]
-fn scan_builds_transcript_search_text() {
- let dir = temp_dir();
- let mut session = SessionFile::create("/tmp", None, 0);
- let path = dir.join(session_file_name(session.session_id()));
- session.set_path(path.clone());
- session.append_message(
- &json!({"role": "user", "content": "fix the login bug", "timestamp": 1u64}),
- );
- session.append_message(&json!({
- "role": "assistant",
- "content": [{ "type": "text", "text": "fixed in auth.rs" }],
- "provider": "p", "model": "m", "timestamp": 2u64
- }));
- // Tool traffic is counted but never enters the search corpus.
- session
- .append_message(&json!({"role": "toolResult", "content": "tool noise", "timestamp": 3u64}));
- session.rewrite().unwrap();
-
- let info = read_session_info(&path).unwrap();
- assert_eq!(info.all_messages_text, "fix the login bug fixed in auth.rs");
- let _ = fs::remove_dir_all(&dir);
-}
-
/// Raw usage keyed by id, aggregates replacing raw blocks, child spend
/// subtracted — `session_usage`'s tests pin the fold, this pins the scan's wiring.
#[test]
@@ -752,7 +728,6 @@ fn scan_keeps_messages_with_partial_usage_objects() {
let info = read_session_info(&path).unwrap();
assert_eq!(info.message_count, 2);
assert_eq!(info.model, Some(("p".to_string(), "m".to_string())));
- assert!(info.all_messages_text.contains("done"));
assert_eq!(
info.usage,
Some(crate::session_usage::SessionUsageSummary {
@@ -778,227 +753,6 @@ fn scan_omits_usage_without_billable_work() {
let _ = fs::remove_dir_all(&dir);
}
-#[test]
-fn transcript_search_text_caps_at_the_ts_limit() {
- let dir = temp_dir();
- let mut session = SessionFile::create("/tmp", None, 0);
- let path = dir.join(session_file_name(session.session_id()));
- session.set_path(path.clone());
- for round in 0..3 {
- let message = "x".repeat(30 * 1024);
- session.append_message(&json!({
- "role": "user", "content": format!("{round} {message}"), "timestamp": round + 1
- }));
- }
- session.rewrite().unwrap();
-
- let info = read_session_info(&path).unwrap();
- assert_eq!(
- info.all_messages_text.chars().count(),
- SESSION_LIST_SEARCH_TEXT_MAX_CHARS
- );
- // Space-joined like TS: exactly one separator between messages.
- assert!(info.all_messages_text.starts_with("0 xxx"));
- assert!(info.all_messages_text.contains("1 xxx"));
- let _ = fs::remove_dir_all(&dir);
-}
-
-#[test]
-fn search_text_char_counter_stays_in_lockstep_with_the_corpus() {
- // The O(1) running counter must equal `chars().count()` of the corpus at
- // every fold step — multibyte, mid-message cap cut, post-cap appends.
- let mut acc = SessionScanAccumulator::default();
- let texts = [
- "fix the login bug".to_string(),
- "ünïcödé — multibyte ✓ chars".to_string(),
- "x".repeat(66 * 1024),
- "post-cap tail that must not move the corpus".to_string(),
- "y".repeat(10),
- ];
- for (index, text) in texts.iter().enumerate() {
- let entry = json!({
- "type": "message",
- "id": format!("m{index}"),
- "timestamp": format!("{}", index + 1),
- "message": {"role": "user", "content": text}
- });
- fold_scan_entry(&mut acc, &entry.to_string()).unwrap();
- assert_eq!(
- acc.search_text_chars,
- acc.all_messages_text.chars().count(),
- "counter drift after fold {index}"
- );
- assert!(acc.all_messages_text.chars().count() <= SESSION_LIST_SEARCH_TEXT_MAX_CHARS);
- }
- assert_eq!(acc.first_message, "fix the login bug");
- assert_eq!(acc.message_count, 5);
- // The cap cut mid-message: the corpus holds exactly the limit.
- assert_eq!(acc.search_text_chars, SESSION_LIST_SEARCH_TEXT_MAX_CHARS);
-}
-
-#[test]
-fn search_text_char_counter_matches_the_legacy_append() {
- // The reference append (the pre-counter shape: count, then extend) must produce the same
- // corpus for the same texts.
- let mut corpus = String::new();
- let mut count = 0usize;
- let texts = [
- String::new(),
- "one".to_string(),
- "twö with multibyte".to_string(),
- "z".repeat(SESSION_LIST_SEARCH_TEXT_MAX_CHARS + 10),
- "post-cap".to_string(),
- ];
- for text in &texts {
- let mut legacy = corpus.clone();
- if !text.is_empty() {
- let used = legacy.chars().count();
- if used < SESSION_LIST_SEARCH_TEXT_MAX_CHARS {
- if used > 0 {
- legacy.push(' ');
- }
- let remaining = SESSION_LIST_SEARCH_TEXT_MAX_CHARS - legacy.chars().count();
- legacy.extend(text.chars().take(remaining));
- }
- }
- count = append_capped_search_text(&mut corpus, text, count);
- assert_eq!(corpus, legacy);
- assert_eq!(count, legacy.chars().count());
- }
-}
-
-#[test]
-fn search_text_counter_lockstep_names_every_corpus_mutation_path() {
- // Every corpus-mutating path at the accumulator level: (1) a fresh fold's
- // appends, (2) the resume copy, (3) the torn-tail snapshot fold, and
- // (4) a rewritten file's fresh accumulator.
- let header_line = session_header_line(&SessionHeader {
- version: None,
- id: "s1".to_string(),
- timestamp: "2026-09-26T00:00:00.000Z".to_string(),
- cwd: "/repo".to_string(),
- parent_session: None,
- rlm_depth: None,
- git: None,
- rest: serde_json::Map::default(),
- })
- .to_string();
- let message = |text: &str, index: u64| {
- json!({
- "type": "message",
- "id": format!("m{index}"),
- "timestamp": index.to_string(),
- "message": {"role": "user", "content": text}
- })
- .to_string()
- };
-
- // (1) fresh fold, past the cap.
- let generation = SessionInfoGeneration {
- len: 4096,
- dev: 0,
- ino: 0,
- mtime: 0,
- mtime_ns: 0,
- ctime: 0,
- ctime_ns: 0,
- };
- let mut state = SessionScanState::fresh(generation);
- fold_scan_entry(&mut state.acc, &header_line).unwrap();
- fold_scan_entry(&mut state.acc, &message("first user turn", 1)).unwrap();
- fold_scan_entry(
- &mut state.acc,
- &message(&"x".repeat(SESSION_LIST_SEARCH_TEXT_MAX_CHARS), 2),
- )
- .unwrap();
- assert_eq!(
- state.acc.search_text_chars,
- state.acc.all_messages_text.chars().count()
- );
- assert_eq!(
- state.acc.all_messages_text.chars().count(),
- SESSION_LIST_SEARCH_TEXT_MAX_CHARS
- );
-
- // (2) the resume copy: the grown file's next appends fold into clone_for_resume's
- // accumulator - the counter travels in lockstep for post-cap appends.
- let mut resumed = state.clone_for_resume();
- assert_eq!(
- resumed.acc.search_text_chars,
- resumed.acc.all_messages_text.chars().count()
- );
- fold_scan_entry(&mut resumed.acc, &message("appended after cap", 3)).unwrap();
- assert_eq!(
- resumed.acc.search_text_chars,
- resumed.acc.all_messages_text.chars().count()
- );
- assert_eq!(
- resumed.acc.all_messages_text.chars().count(),
- SESSION_LIST_SEARCH_TEXT_MAX_CHARS
- );
-
- // (3) the torn-tail snapshot: build_info folds the torn line into a CLONE,
- // so the durable accumulator's counter stays untouched.
- let durable_before = state.acc.clone();
- let capped_info = state
- .build_info(
- Path::new("/repo/s1.jsonl"),
- || None,
- Some(r#"{"type":"message","id":"m4","timestamp":"4","message":{"role":"user","content":"torn tail"}}"#),
- )
- .unwrap();
- assert_eq!(
- capped_info.all_messages_text, durable_before.all_messages_text,
- "the cap bounds the snapshot fold too - a torn tail past it changes no corpus byte"
- );
- assert_eq!(
- state.acc.search_text_chars,
- durable_before.search_text_chars
- );
- assert_eq!(
- state.acc.search_text_chars,
- state.acc.all_messages_text.chars().count()
- );
- let mut uncapped = SessionScanState::fresh(generation);
- fold_scan_entry(&mut uncapped.acc, &header_line).unwrap();
- fold_scan_entry(&mut uncapped.acc, &message("user turn one", 1)).unwrap();
- let uncapped_durable = uncapped.acc.clone();
- let uncapped_info = uncapped
- .build_info(
- Path::new("/repo/s1.jsonl"),
- || None,
- Some(r#"{"type":"message","id":"m5","timestamp":"2","message":{"role":"user","content":"user turn two"}}"#),
- )
- .unwrap();
- assert_eq!(
- uncapped_info.all_messages_text,
- "user turn one user turn two"
- );
- assert_eq!(
- uncapped.acc.all_messages_text,
- uncapped_durable.all_messages_text
- );
- assert_eq!(
- uncapped.acc.search_text_chars,
- uncapped_durable.search_text_chars
- );
-
- // (4) a rewritten file re-folds from a fresh accumulator: corpus and counter restart together.
- let mut rewritten = SessionScanState::fresh(generation);
- assert_eq!(rewritten.acc.search_text_chars, 0);
- assert!(rewritten.acc.all_messages_text.is_empty());
- fold_scan_entry(&mut rewritten.acc, &header_line).unwrap();
- fold_scan_entry(&mut rewritten.acc, &message("rewrite from zero", 1)).unwrap();
- assert_eq!(
- rewritten.acc.search_text_chars,
- rewritten.acc.all_messages_text.chars().count()
- );
- assert_eq!(
- rewritten.acc.all_messages_text, "rewrite from zero",
- "a rewritten file's corpus is the fresh fold's, not the old session's"
- );
-}
-
#[test]
fn durable_first_kept_entry_id_pins_the_boundary_the_read_retains() {
// The parity scenario the frame diff caught: the engine reports an id that
diff --git a/crates/pa-daemon/src/session_store_info_tests.rs b/crates/pa-daemon/src/session_store_info_tests.rs
index d056246cab..f938cc054a 100644
--- a/crates/pa-daemon/src/session_store_info_tests.rs
+++ b/crates/pa-daemon/src/session_store_info_tests.rs
@@ -11,7 +11,6 @@ fn legacy_read_session_info(path: &Path) -> Option<SessionInfo> {
let mut thinking_level = None;
let mut message_count = 0usize;
let mut first_message = String::new();
- let mut all_messages_text = String::new();
let mut usage_scan = crate::session_usage::UsageScan::default();
let mut last_activity_ms: Option<u64> = None;
for line in content.lines() {
@@ -113,22 +112,6 @@ fn legacy_read_session_info(path: &Path) -> Option<SessionInfo> {
first_message = text;
}
}
- // User and assistant text content feeds the search; the
- // reference inlines the append, staying independent of the reshape.
- if matches!(role, Some("user" | "assistant")) {
- let text = message_text(message);
- if !text.is_empty() {
- let used = all_messages_text.chars().count();
- if used < SESSION_LIST_SEARCH_TEXT_MAX_CHARS {
- if used > 0 {
- all_messages_text.push(' ');
- }
- let remaining = SESSION_LIST_SEARCH_TEXT_MAX_CHARS
- - all_messages_text.chars().count();
- all_messages_text.extend(text.chars().take(remaining));
- }
- }
- }
}
}
_ => {}
@@ -169,7 +152,6 @@ fn legacy_read_session_info(path: &Path) -> Option<SessionInfo> {
} else {
first_message
},
- all_messages_text,
usage: usage_scan.summary(),
deleted_descendant_usage: None,
})
@@ -361,7 +343,7 @@ fn a_torn_trailing_line_folds_once_completed() {
assert_fold_matches(&path);
let completed = read_session_info(&path).unwrap();
assert_eq!(completed.message_count, 1);
- assert!(completed.all_messages_text.contains("torn text"));
+ assert_eq!(completed.first_message, "torn text");
}
#[test]
@@ -935,33 +917,18 @@ fn content_borrow_matches_full_parse_across_content_matrix() {
assert_eq!(borrowed, reference, "differential: {line}");
}
- // Fold-level differential with cap-cut appends around the matrix:
- // a multibyte boundary cut, then past the cap.
+ // Fold-level differential over the matrix rows.
let dir = test_dir();
let path = dir.join("session.jsonl");
append_rows(&path, std::slice::from_ref(&header));
for (entry, _) in &messages {
append_rows(&path, std::slice::from_ref(entry));
}
- append_rows(
- &path,
- &[
- row(
- "cap0",
- json!({"role":"assistant","content":"x".repeat(SESSION_LIST_SEARCH_TEXT_MAX_CHARS)}),
- ),
- row("cap1", json!({"role":"assistant","content":"past the cap"})),
- row("cap2", json!({"role":"user","content":"past the cap user"})),
- ],
- );
assert_fold_matches(&path);
- // First-message pick: the first NON-EMPTY user text wins (m0); the corpus
- // holds every user/assistant text under the cap in fold order.
+ // First-message pick: the first NON-EMPTY user text wins (m0).
let info = read_session_info(&path).unwrap();
assert_eq!(info.first_message, "hello");
- assert!(info.all_messages_text.starts_with("hello line1"));
- assert!(info.all_messages_text.chars().count() <= SESSION_LIST_SEARCH_TEXT_MAX_CHARS);
// A session whose only user text is empty keeps the no-message label.
let empty_dir = test_dir();
@@ -1189,7 +1156,6 @@ fn borrowed_metadata_reads_match_full_parse_across_shape_matrix() {
// and missing-message rows.
assert_eq!(info.message_count, 12);
assert_eq!(info.first_message, "ts float");
- assert!(info.all_messages_text.contains("escaped role matches"));
assert_eq!(info.modified, crate::util::iso_from_unix_ms(456));
// The abort rows kill the whole file's row on both paths.
diff --git a/crates/pa-daemon/src/supervisor/sessions.rs b/crates/pa-daemon/src/supervisor/sessions.rs
index 2773a8ceed..c7905c262f 100644
--- a/crates/pa-daemon/src/supervisor/sessions.rs
+++ b/crates/pa-daemon/src/supervisor/sessions.rs
@@ -796,9 +796,6 @@ pub(super) fn saved_session_row(info: &crate::session_store::SessionInfo) -> Val
"modified": info.modified,
"messageCount": info.message_count,
"firstMessage": info.first_message,
- // The scan's capped transcript corpus (TS `allMessagesText`): the
- // agents-view full-transcript search field.
- "allMessagesText": info.all_messages_text,
"state": info.state.as_ref().map(|state| json!({ "status": state })),
});
let object = row.as_object_mut().expect("row object");
diff --git a/crates/pa-daemon/src/supervisor/tests.rs b/crates/pa-daemon/src/supervisor/tests.rs
index fe8f5edc91..b9111c41a1 100644
--- a/crates/pa-daemon/src/supervisor/tests.rs
+++ b/crates/pa-daemon/src/supervisor/tests.rs
@@ -910,6 +910,66 @@ fn saved_session_rows_publish_the_own_usage_summary() {
let _ = std::fs::remove_dir_all(&dir);
}
+/// The whole catalog row on one fixture that exercises every optional key
+/// (name, state, model, thinking level, parent binding, usage): one literal
+/// comparison, so any wire change — a key added, renamed, or dropped — fails
+/// here first, before any client depends on the new shape.
+#[test]
+fn saved_session_rows_match_the_catalog_row_golden() {
+ let dir = std::env::temp_dir().join(format!("pa-saved-golden-{}", uuid::Uuid::new_v4()));
+ std::fs::create_dir_all(&dir).unwrap();
+ let mut session =
+ crate::session_store::SessionFile::create("/repo", Some("/s/parent.jsonl"), 1);
+ // The row's id and created timestamp read from the session header: pin
+ // both, so the golden stays one literal.
+ session.header.id = "golden-session".to_string();
+ session.header.timestamp = "2026-09-21T00:00:00.000Z".to_string();
+ let path = dir.join("golden-session.jsonl");
+ session.set_path(path.clone());
+ session.append_session_info("golden name");
+ // An assistant message with provider/model later overrides the change,
+ // pinning the fold's last-write-wins row.
+ session.append_model_change("prime", "superb");
+ session.append_thinking_level_change("high");
+ session.append_session_state("active");
+ session.append_message(&json!({
+ "role": "user", "content": "fix the login bug", "timestamp": 1_790_000_000_000_u64
+ }));
+ session.append_message(&json!({
+ "role": "assistant",
+ "content": [{ "type": "text", "text": "fixed in auth.rs" }],
+ "provider": "p", "model": "m", "timestamp": 1_790_000_060_000_u64,
+ "usage": {
+ "input": 100, "output": 10, "cacheRead": 5, "cacheWrite": 0,
+ "totalTokens": 115,
+ "cost": { "input": 0.0, "output": 0.25, "cacheRead": 0.0, "cacheWrite": 0.0, "total": 0.25 }
+ }
+ }));
+ session.rewrite().unwrap();
+
+ let info = crate::session_store::read_session_info(&path).unwrap();
+ assert_eq!(
+ saved_session_row(&info),
+ json!({
+ "path": path.to_string_lossy(),
+ "id": "golden-session",
+ "cwd": "/repo",
+ "rlmDepth": 1,
+ "created": "2026-09-21T00:00:00.000Z",
+ "modified": "2026-09-21T14:14:20.000Z",
+ "messageCount": 2,
+ "firstMessage": "fix the login bug",
+ "state": { "status": "active" },
+ "name": "golden name",
+ "parentSessionPath": "/s/parent.jsonl",
+ "model": { "provider": "p", "modelId": "m" },
+ "usage": { "inputTokens": 105, "outputTokens": 10, "cost": 0.25 },
+ "thinkingLevel": "high"
+ })
+ );
+ let _ = std::fs::remove_dir_all(&dir);
+}
+
/// `parentSessionPath` only when one is recorded (TS's `undefined` is omitted), so a
/// non-resident bound session keeps its family edge.
#[test]
diff --git a/crates/pa-tui/src/agents_view_state.rs b/crates/pa-tui/src/agents_view_state.rs
index 1dbc49ca64..96e8b6df17 100644
--- a/crates/pa-tui/src/agents_view_state.rs
+++ b/crates/pa-tui/src/agents_view_state.rs
@@ -144,7 +144,7 @@ const SESSION_NAME_COLUMN_MAX_CELLS: usize = 28;
const SESSION_TITLE_MAX_CELLS: usize = SESSION_NAME_COLUMN_MAX_CELLS - 2;
/// The picker's name target: the SESSION column's own title, clipped at the column's own cap;
-/// the TS transcript corpus (`allMessagesText`) stays excluded.
+/// transcript text stays excluded.
fn session_search_name(summary: &Value) -> String {
truncate_text(&session_title(summary), SESSION_TITLE_MAX_CELLS)
}
diff --git a/crates/pa-types/src/daemon/outbound.rs b/crates/pa-types/src/daemon/outbound.rs
index 8502f3cdba..1749a2e5b8 100644
--- a/crates/pa-types/src/daemon/outbound.rs
+++ b/crates/pa-types/src/daemon/outbound.rs
@@ -109,7 +109,6 @@ pub struct DaemonSavedSessionInfo {
pub modified: String,
pub message_count: u64,
pub first_message: String,
- pub all_messages_text: String,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub usage: Option<Value>,
#[serde(default, skip_serializing_if = "Option::is_none")]
diff --git a/scripts/review_catalog_field_removal_parity.py b/scripts/review_catalog_field_removal_parity.py
new file mode 100644
index 0000000000..eb7dfe16da
--- /dev/null
+++ b/scripts/review_catalog_field_removal_parity.py
@@ -0,0 +1,222 @@
+#!/usr/bin/env python3
+"""Actual unbounded catalog evidence for intentional allMessagesText removal.
+
+This is NOT whole-wire parity: pinned TS retains its transcript corpus; Rust
+must omit the key in streamed and terminal rows. Remaining selected stable
+fields match. No provider, kernel, create command or UI is exercised.
+"""
+import argparse
+import json
+import os
+from pathlib import Path
+import subprocess
+import sys
+import tempfile
+
+from review_agent_bounce_parity import Client
+from review_draft_disconnect_parity import digest, env_for, TS_ARCHIVE_SHA256
+from review_goal_fixture_lifecycle import OwnedProcesses, TAG, finish
+
+COUNT = 3
+BASE_MS = 1704067200000
+STAMP = '2024-01-01T00:00:00.000Z'
+CWD = '/tmp/catalog-field-removal-fixture'
+FIELDS = ('path', 'id', 'cwd', 'name', 'messageCount', 'firstMessage')
+REMOVED = 'allMessagesText'
+
+
+def seed(root):
+ directory = root / 'agent/sessions'
+ directory.mkdir(parents=True, exist_ok=True)
+ expected, transcripts = [], {}
+ for index in range(COUNT):
+ ident = f'field-removal-{index}'
+ name = f'Field removal row {index}'
+ user = f'FIELD_REMOVAL_USER_{index}'
+ # Unicode and separate assistant text distinguish a real corpus from
+ # a first-message alias; exact comparison retains whitespace and text.
+ assistant = f'FIELD_REMOVAL_ASSISTANT_{index} café 界'
+ entries = [
+ {'type': 'session', 'version': 3, 'id': ident, 'timestamp': STAMP,
+ 'cwd': CWD, 'rlmDepth': 0},
+ {'type': 'session_info', 'id': ident + '-info', 'parentId': None,
+ 'timestamp': STAMP, 'name': name},
+ {'type': 'message', 'id': ident + '-user', 'parentId': ident + '-info',
+ 'timestamp': STAMP, 'message': {'role': 'user', 'content': user,
+ 'timestamp': BASE_MS + index * 10000}},
+ {'type': 'message', 'id': ident + '-assistant', 'parentId': ident + '-user',
+ 'timestamp': STAMP, 'message': {'role': 'assistant',
+ 'content': [{'type': 'text', 'text': assistant}], 'provider': 'parity-local',
+ 'model': 'parity-1', 'timestamp': BASE_MS + index * 10000 + 1000}},
+ ]
+ path = directory / (ident + '.jsonl')
+ path.write_text(''.join(json.dumps(row, ensure_ascii=False) + '\n' for row in entries))
+ ns = (BASE_MS + index * 10000) * 1000000
+ os.utime(path, ns=(ns, ns))
+ assert path.stat().st_mtime_ns == ns, 'fixture lost deterministic mtime'
+ expected.append(dict(zip(FIELDS, (path.name, ident, CWD, name, 2, user))))
+ transcripts[ident] = user + ' ' + assistant
+ return expected, transcripts
+
+
+def stable_rows(rows, root):
+ assert isinstance(rows, list), 'sessions is not an array'
+ values = []
+ for row in rows:
+ assert isinstance(row, dict), row
+ path = Path(row['path'])
+ assert path.parent == root / 'agent/sessions', 'catalog escaped owned fixture'
+ value = {field: row[field] for field in FIELDS}
+ value['path'] = path.name # The sole normalization: per-run owned root.
+ values.append(value)
+ ids = [row['id'] for row in values]
+ assert len(set(ids)) == len(ids), 'duplicate catalog rows'
+ return sorted(values, key=lambda row: row['id'])
+
+
+def check_rows(rows, kind, root, expected, transcripts):
+ assert stable_rows(rows, root) == sorted(expected, key=lambda row: row['id']), 'stable catalog fields differ'
+ for row in rows:
+ if kind == 'ts':
+ assert REMOVED in row and row[REMOVED] == transcripts[row['id']], 'TS transcript corpus differs'
+ else:
+ assert kind == 'rust', 'unknown implementation'
+ assert REMOVED not in row, 'Rust must OMIT allMessagesText, not null or empty it'
+
+
+class RawReader:
+ def __init__(self, reader, received):
+ self.reader, self.received = reader, received
+
+ def readline(self):
+ line = self.reader.readline()
+ self.received.append(line.hex())
+ return line
+
+ def close(self):
+ self.reader.close()
+
+
+class RawSocket:
+ def __init__(self, sock, sent):
+ self.sock, self.sent = sock, sent
+
+ def sendall(self, data):
+ self.sent.append(data.hex())
+ self.sock.sendall(data)
+
+ def close(self):
+ self.sock.close()
+
+
+class CatalogClient(Client):
+ def __init__(self, path, process):
+ super().__init__(path, process)
+ self.received, self.sent = [], []
+ # Hello is retained decoded separately; all subsequent traffic is raw.
+ self.reader = RawReader(self.reader, self.received)
+ self.sock = RawSocket(self.sock, self.sent)
+
+
+def validate(observed, kind, root, expected, transcripts):
+ frames, data = observed['frames'], observed['final_data']
+ assert isinstance(data, dict), 'terminal data is not an object'
+ check_rows(data.get('sessions'), kind, root, expected, transcripts)
+ assert observed['raw_received_hex'] and observed['raw_sent_hex'], 'missing raw traffic'
+ assert [json.loads(bytes.fromhex(line)) for line in observed['raw_received_hex']] == frames, 'raw/decoded traffic mismatch'
+ final, = [frame for frame in frames if frame.get('type') == 'response']
+ assert frames[-1] == final and final.get('success') is True, 'missing successful terminal response'
+ assert final.get('command') == 'list_saved_sessions' and final.get('data') == data, final
+ request, = [json.loads(bytes.fromhex(line)) for line in observed['raw_sent_hex']]
+ assert request['id'] == final['id'] and request['command'] == {
+ 'type': 'list_saved_sessions', 'cwd': CWD, 'scope': 'all'}, request
+ streamed, progress = [], []
+ for frame in frames[:-1]:
+ assert frame.get('id') == final['id'] and frame.get('command') == 'list_saved_sessions', frame
+ if frame.get('type') == 'session_list_item':
+ streamed.append(frame['session'])
+ else:
+ assert frame.get('type') == 'session_list_progress', frame
+ assert 0 <= frame['loaded'] <= frame['total'], frame
+ progress.append(frame)
+ # Three small rows must all stream; no large-store/backpressure claim.
+ assert progress, 'missing catalog progress'
+ check_rows(streamed, kind, root, expected, transcripts)
+ return stable_rows(data['sessions'], root)
+
+
+def observe(binary, kind, root, observed):
+ env = env_for(root, kind)
+ env[TAG] = str(root)
+ (root / 'agent/settings.json').write_text(json.dumps({
+ 'prewarmPythonKernel': False, 'sessionArchiveMaxSessions': 'off',
+ 'sessionArchiveMaxAgeDays': 'off', 'onboardingCompleted': True,
+ 'telemetry': {'noticeShown': True}}))
+ expected, transcripts = seed(root)
+ observed['fixture'] = {'count': COUNT, 'mtime_base_ms': BASE_MS, 'mtime_step_ms': 10000,
+ 'archive_max_sessions': 'off', 'archive_max_age_days': 'off',
+ 'expected_stable_rows': expected, 'expected_ts_transcripts': transcripts}
+ path = root / 'd.sock'
+ scope = OwnedProcesses(binary, root, path)
+ daemon = client = None
+ with open(root / 'daemon.log', 'wb') as log:
+ try:
+ command = [str(binary), '--mode', 'daemon', '--daemon-socket', str(path)]
+ daemon = subprocess.Popen(command, cwd=root, env=env, stdout=log,
+ stderr=subprocess.STDOUT, start_new_session=True)
+ scope.register(daemon, command)
+ client = CatalogClient(path, daemon)
+ observed['hello'] = client.hello
+ try:
+ observed['final_data'] = client.call('list_saved_sessions', cwd=CWD, scope='all')
+ finally:
+ observed['frames'] = list(client.wire)
+ observed['raw_received_hex'] = list(client.received)
+ observed['raw_sent_hex'] = list(client.sent)
+ observed['stable_rows'] = validate(observed, kind, root, expected, transcripts)
+ scope.discover()
+ assert set(scope.targets) == set(scope.direct), 'catalog unexpectedly spawned worker/kernel'
+ observed['behavior_verified'] = True
+ finally:
+ finish(scope, client, daemon, observed)
+ log.flush()
+ observed['daemon_log'] = (root / 'daemon.log').read_text(errors='replace')[-10000:]
+ assert observed['cleanup_verified'], observed
+
+
+def main():
+ parser = argparse.ArgumentParser(description=__doc__)
+ parser.add_argument('--receipt', required=True, type=Path)
+ args = parser.parse_args()
+ receipt = {'verified': False, 'scope': __doc__, 'runs': {},
+ 'intentional_difference': 'TS allMessagesText exact transcript text; Rust key absent in stream and final',
+ 'normalization': 'owned path basename; compare rows by durable ID, not stream order',
+ 'not_verified': ['whole-wire equality (intentional field removal)', 'UI frames or input',
+ 'performance or heap reduction', 'sidecar old/new compatibility (catalog-only CLI does not emit lease sidecars)',
+ 'provider/kernel execution', 'large-store backpressure']}
+ try:
+ assert sys.platform == 'linux', 'hosted Linux only'
+ assert digest(Path(os.environ['PA_TS_ARCHIVE'])) == TS_ARCHIVE_SHA256, 'TS archive digest mismatch'
+ receipt['ts_archive_sha256'] = TS_ARCHIVE_SHA256
+ with tempfile.TemporaryDirectory(prefix='pa-cat-field-', dir='/tmp') as folder:
+ for kind in ('ts', 'rust'):
+ binary = Path(os.environ[f'PA_{kind.upper()}_BINARY']).resolve()
+ observed = receipt['runs'][kind] = {'binary_sha256': digest(binary)}
+ try:
+ observe(binary, kind, Path(folder) / kind, observed)
+ except Exception as error:
+ observed['error'] = f'{type(error).__name__}: {error}'
+ assert all(run.get('behavior_verified') and run.get('cleanup_verified')
+ and 'error' not in run for run in receipt['runs'].values()), 'actual field removal comparison failed'
+ assert receipt['runs']['ts']['stable_rows'] == receipt['runs']['rust']['stable_rows'], 'TS/Rust stable fields differ'
+ receipt['verified'] = True
+ except Exception as error:
+ receipt['error'] = f'{type(error).__name__}: {error}'
+ args.receipt.parent.mkdir(parents=True, exist_ok=True)
+ args.receipt.write_text(json.dumps(receipt, ensure_ascii=False, indent=2))
+ print(json.dumps({'verified': receipt['verified'], 'error': receipt.get('error')}))
+ return 0 if receipt['verified'] else 1
+
+
+if __name__ == '__main__':
+ sys.exit(main())
diff --git a/scripts/test_review_catalog_field_removal_parity.py b/scripts/test_review_catalog_field_removal_parity.py
new file mode 100644
index 0000000000..0a03794948
--- /dev/null
+++ b/scripts/test_review_catalog_field_removal_parity.py
@@ -0,0 +1,116 @@
+import copy
+import json
+from pathlib import Path
+import tempfile
+import unittest
+
+from review_catalog_field_removal_parity import (COUNT, CWD, REMOVED, seed, validate)
+
+
+class CatalogFieldRemovalGuards(unittest.TestCase):
+ def setUp(self):
+ self.directory = tempfile.TemporaryDirectory()
+ self.addCleanup(self.directory.cleanup)
+ self.root = Path(self.directory.name)
+ self.expected, self.transcripts = seed(self.root)
+
+ def observation(self, kind):
+ rows = copy.deepcopy(self.expected)
+ for row in rows:
+ row['path'] = str(self.root / 'agent/sessions' / row['path'])
+ if kind == 'ts':
+ row[REMOVED] = self.transcripts[row['id']]
+ frames = [{'type': 'session_list_item', 'id': '1',
+ 'command': 'list_saved_sessions', 'session': copy.deepcopy(row)} for row in rows]
+ frames.append({'type': 'session_list_progress', 'id': '1',
+ 'command': 'list_saved_sessions', 'loaded': COUNT, 'total': COUNT})
+ data = {'sessions': rows}
+ frames.append({'type': 'response', 'id': '1', 'command': 'list_saved_sessions',
+ 'success': True, 'data': data})
+ observed = {'frames': frames, 'final_data': data, 'raw_sent_hex': [json.dumps({
+ 'id': '1', 'type': 'command', 'command': {'type': 'list_saved_sessions',
+ 'cwd': CWD, 'scope': 'all'}}).encode().hex()]}
+ self.raw(observed)
+ return observed
+
+ def raw(self, observed):
+ observed['raw_received_hex'] = [(json.dumps(frame) + '\n').encode().hex()
+ for frame in observed['frames']]
+
+ def check(self, observed, kind):
+ return validate(observed, kind, self.root, self.expected, self.transcripts)
+
+ def test_exact_ts_corpus_and_rust_omission_keep_same_stable_fields(self):
+ self.assertEqual(self.check(self.observation('ts'), 'ts'),
+ self.check(self.observation('rust'), 'rust'))
+ for path in (self.root / 'agent/sessions').glob('*.jsonl'):
+ entries = [json.loads(line) for line in path.read_text().splitlines()]
+ self.assertEqual(entries[0]['type'], 'session')
+ self.assertEqual(entries[0]['id'], path.stem)
+ self.assertIn('café 界', entries[-1]['message']['content'][0]['text'])
+
+ def test_rust_null_empty_or_text_key_fails_in_both_stream_and_final(self):
+ for location in ('stream', 'final'):
+ for value in (None, '', 'stale text'):
+ observed = self.observation('rust')
+ row = observed['frames'][0]['session'] if location == 'stream' else observed['final_data']['sessions'][0]
+ row[REMOVED] = value
+ self.raw(observed)
+ with self.subTest(location=location, value=value), self.assertRaises(AssertionError):
+ self.check(observed, 'rust')
+
+ def test_ts_missing_empty_or_firstmessage_alias_fails_in_stream_and_final(self):
+ for location in ('stream', 'final'):
+ for mode in ('missing', 'empty', 'first_message'):
+ observed = self.observation('ts')
+ row = observed['frames'][0]['session'] if location == 'stream' else observed['final_data']['sessions'][0]
+ if mode == 'missing':
+ del row[REMOVED]
+ else:
+ row[REMOVED] = '' if mode == 'empty' else row['firstMessage']
+ self.raw(observed)
+ with self.subTest(location=location, mode=mode), self.assertRaises(AssertionError):
+ self.check(observed, 'ts')
+
+ def test_missing_duplicate_escaped_or_changed_stable_rows_fail(self):
+ for location in ('stream', 'final'):
+ for mode in ('missing', 'duplicate', 'escaped', 'changed'):
+ observed = self.observation('rust')
+ rows = [frame['session'] for frame in observed['frames'] if frame['type'] == 'session_list_item'] if location == 'stream' else observed['final_data']['sessions']
+ if mode == 'missing':
+ if location == 'stream':
+ observed['frames'].pop(0)
+ else:
+ rows.pop()
+ elif mode == 'duplicate':
+ if location == 'stream':
+ observed['frames'].insert(0, copy.deepcopy(observed['frames'][0]))
+ else:
+ rows.append(copy.deepcopy(rows[0]))
+ else:
+ rows[0]['path' if mode == 'escaped' else 'name'] = '/ambient/escaped.jsonl' if mode == 'escaped' else 'wrong'
+ self.raw(observed)
+ with self.subTest(location=location, mode=mode), self.assertRaises(AssertionError):
+ self.check(observed, 'rust')
+
+ def test_missing_raw_wrong_request_and_postterminal_frames_fail_closed(self):
+ for mode in ('missing_raw', 'wrong_raw', 'wrong_request', 'after_final', 'failure'):
+ observed = self.observation('rust')
+ if mode == 'missing_raw':
+ observed['raw_received_hex'] = []
+ elif mode == 'wrong_raw':
+ observed['raw_received_hex'][0] = b'{}\n'.hex()
+ elif mode == 'wrong_request':
+ observed['raw_sent_hex'] = [b'{"id":"wrong","command":{}}'.hex()]
+ else:
+ if mode == 'after_final':
+ observed['frames'].append(copy.deepcopy(observed['frames'][0]))
+ else:
+ observed['frames'][-1]['success'] = False
+ self.raw(observed)
+ with self.subTest(mode=mode), self.assertRaises(AssertionError):
+ self.check(observed, 'rust')
+
+
+if __name__ == '__main__':
+ unittest.main()