Enforce host-required cyber access programs per thread (#59754)

## What changed

- Expose `RequiredCyberAccessPrograms` so hosts can require an explicit allowed program on a thread. Snapshot the requirement before extension callbacks; hosts must reapply it on cold resume.
- Validate resolved `access_programs` before HTTP and WebSocket model requests, rejecting omitted or disallowed programs. Explicit `Standard` remains distinct from omission. Reject memory summarization and realtime requests when a requirement is present.
- Keep required programs scoped to the parent thread by preventing Guardian reviewers from inheriting its program, including Guardian v2 reviews.

## Testing

Add HTTP and WebSocket coverage for allowed programs, omission, disallowed programs, unsupported providers, and connection reuse. Extend Guardian tests to verify parent-only program scope and that removing the public attachment does not erase the startup snapshot.

GitOrigin-RevId: 9306a9af0e03e7a1728dfeb610cd7ec7517367fd
This commit is contained in:
jamy-OAI
2026-11-05 22:49:46 +00:00
committed by copyberry
parent 09358089b0
commit b313cca1cf
14 changed files with 472 additions and 16 deletions
+10
View File
@@ -1012,6 +1012,8 @@ impl Session {
));
}
};
let required_cyber_access_programs =
thread_extension_init.get::<crate::cyber_access_program::RequiredCyberAccessPrograms>();
let inherited_session_id = thread_extension_init
.remove::<InheritedSessionId>()
.map(|inherited| inherited.0);
@@ -1150,6 +1152,13 @@ impl Session {
thread_id.to_string(),
thread_extension_init,
);
if let Some(required) = &required_cyber_access_programs {
thread_extension_data.insert(
crate::cyber_access_program::RequiredCyberAccessProgramsSnapshot(Arc::clone(
required,
)),
);
}
thread_extension_data.insert(crate::context::GuardianReviewEvidence::default());
crate::model_search::SearchOwner::restore(&thread_extension_data, &initial_history);
// Kick off independent async setup tasks in parallel to reduce startup latency.
@@ -1924,6 +1933,7 @@ impl Session {
tx_event.clone(),
codex_responses_headers,
crate::cyber_access_program::ApiKeyCyberAccessPrograms::from_config(&config),
required_cyber_access_programs,
);
// Once tracing starts, startup cleanup must own the session before the next await.
let rollout_thread_trace = if matches!(