Harden internal Guardian session isolation (#40497)

## Why

Internal Guardian reviews must remain independent of parent-session customization while still honoring managed execution and environment restrictions.

## What changed

- Apply the restricted Guardian session path to both internal and subagent review sources.
- Start internal reviews without inherited user instructions, extensions, MCP servers, or multi-agent behavior.
- Preserve managed execution policy and selected environment constraints while exposing only the allowed review tools. Honor shell feature restrictions across every selected environment and retain code mode when enabled.

## Testing

- Cover internal review isolation from parent state and managed instructions.
- Cover optional tool filtering, managed shell restrictions, code mode, and secondary environment profiles.

GitOrigin-RevId: edbf7d8a6fe3ee8213a1c75bc8ec331a1cf49006
This commit is contained in:
Won Park authored and copyberry committed 2026-08-24 23:23:18 +00:00
1 parent be3a666143
commit 8476434a97
11 files changed
+475 -62

No files matched your search

+1 -1
View File
@@ -150,7 +150,7 @@ impl Session {
mut projection: McpRuntimeProjection,
) -> BoxFuture<'a, McpRuntimeProjection> {
Box::pin(async move {
if crate::guardian::is_guardian_reviewer_source(session_source) {
if crate::guardian::is_basic_session_source(session_source) {
return projection;
}