Persist Guardian retention limits in thread settings (#62827)

## What changed

At session startup, derive `assistant_record_bytes` from the Sync Elastic
per-entry token limit for retained user instructions. Use the default
section limit when the configuration omits that section.

Store the resolved byte limit in the optional `guardian_retention` field
of `ThreadSettingsSnapshot` and update the app-server schema. Fixed-mode
snapshots omit the field, and older snapshots can still be read.

GitOrigin-RevId: a8de88c5bd0e35c4a114577e70fb0c858acb13c9
This commit is contained in:
ioanbudea-OAI
2026-11-20 20:08:33 +00:00
committed by copyberry
parent 60fc55bb69
commit 7fcb825b46
11 changed files with 46 additions and 125 deletions
+12
View File
@@ -2598,6 +2598,18 @@ pub struct ThreadSettingsSnapshot {
/// Thread-owned plugin selection, retained even when a plugin is unavailable.
#[serde(default)]
pub disabled_plugin_ids: Vec<String>,
/// Effective Guardian recorder policy. Absent for Fixed and old snapshots.
#[serde(default, skip_serializing_if = "Option::is_none")]
#[ts(optional)]
pub guardian_retention: Option<GuardianRetentionPolicy>,
}
/// Resolved limits for Guardian's retained evidence, in storage bytes.
#[derive(Debug, Clone, Copy, Deserialize, Serialize, PartialEq, Eq, JsonSchema, TS)]
pub struct GuardianRetentionPolicy {
#[serde(skip_serializing_if = "Option::is_none")]
#[ts(optional)]
pub assistant_record_bytes: Option<usize>,
}
#[derive(Debug, Clone, Deserialize, Serialize, Default, PartialEq, Eq, JsonSchema, TS)]