Enable Guardian thread context by default (#47275)

## What changed

Mark `guardianv2.thread_context` as stable and enable it by default for synchronous and asynchronous Guardian reviews. Keep it independent of the Guardian v2 `enabled` toggle and preserve explicit configuration and profile overrides. Update the configuration schema documentation to match.

## Testing

Update coverage for default configuration and sender user messages, review prompt snapshots, history retention across compaction, and checkpoint provenance. Assert that later user input invalidates an in-flight review's authorization. Keep legacy transcript budgeting coverage by explicitly disabling thread context in that test.

GitOrigin-RevId: 19afd34d7bfc0ee36bbf878089c68b732a21bc6a
This commit is contained in:
felixxia-oai
2026-09-22 12:43:11 +00:00
committed by copyberry
parent 99784bd09b
commit 279ba89415
14 changed files with 158 additions and 80 deletions
+1 -1
View File
@@ -135,7 +135,7 @@ pub struct GuardianV2ConfigToml {
/// Legacy setting retained for config compatibility; the backend now controls Guardian billing.
#[serde(skip_serializing_if = "Option::is_none")]
pub free_guardian: Option<bool>,
/// Use thread-owned context for sync and async Guardian. Defaults to false.
/// Use thread-owned context for sync and async Guardian. Defaults to true.
/// Independent of the Guardian v2 `enabled` toggle.
#[serde(skip_serializing_if = "Option::is_none")]
pub thread_context: Option<bool>,
+2 -2
View File
@@ -1627,8 +1627,8 @@ pub const FEATURES: &[FeatureSpec] = &[
FeatureSpec {
id: Feature::GuardianThreadContext,
key: "guardianv2.thread_context",
stage: Stage::UnderDevelopment,
default_enabled: false,
stage: Stage::Stable,
default_enabled: true,
},
FeatureSpec {
id: Feature::GuardianReuseParentCompaction,
+3 -4
View File
@@ -182,7 +182,8 @@ fn guardian_thread_context_resolves_nested_config_and_profile_overrides() {
let enabled_context = "[guardianv2]\nthread_context = true";
let disabled_context = "[guardianv2]\nthread_context = false";
for (base, profile, enabled) in [
("", "", false),
("", "", true),
("guardianv2 = false", "", true),
(disabled_context, "", false),
(enabled_context, "", true),
(enabled_context, disabled_context, false),
@@ -207,9 +208,7 @@ fn guardian_thread_context_resolves_nested_config_and_profile_overrides() {
FeatureOverrides::default(),
);
let mut expected = Features::with_defaults();
if enabled {
expected.enable(Feature::GuardianThreadContext);
}
expected.set_enabled(Feature::GuardianThreadContext, enabled);
assert_eq!(features.enabled_features(), expected.enabled_features());
}
}