mirror of
https://github.com/openai/codex.git
synced 2026-11-15 21:50:46 +00:00
Allow hosts to restrict a thread's root-only capabilities (#58984)
## Why Hosts need to apply subagent-style capability restrictions without changing a thread's session attribution, agent lineage, or permission profile. ## What changed Add the public `RestrictRootCapabilities` marker to thread startup extension data. Capture the restriction once at startup and apply it alongside the restrictions native subagents already receive. Hosts must supply the marker again when cold-resuming a restricted thread. Use the restriction to gate user-input and plugin-install requests, async user messaging, legacy MCP tool approvals, and Full Access MCP form input. Exclude inherited user messages from Guardian's retained authorization context for restricted threads, including after cold resume. ## Testing Add coverage for host-restricted tool registration, MCP approval rejection, Full Access form-input handling, and inherited instruction authorization after cold resume. Update handler tests to exercise the shared restriction flag. GitOrigin-RevId: 4d6d7102a20dc747431c7511a74a204c773e8420
This commit is contained in:
@@ -159,6 +159,8 @@ pub(crate) struct SessionConfiguration {
|
||||
pub(super) trusted_guardian_reviewer: bool,
|
||||
/// Source of the session (cli, vscode, exec, mcp, ...)
|
||||
pub(super) session_source: SessionSource,
|
||||
/// Whether native lineage or the trusted host restricts this session's root-only capabilities.
|
||||
pub(super) root_capabilities_restricted: bool,
|
||||
/// Persisted thread history contract selected when this thread was created.
|
||||
pub(super) history_mode: ThreadHistoryMode,
|
||||
/// Immediate history source copied into this thread, when this thread was forked.
|
||||
@@ -1574,7 +1576,7 @@ impl Session {
|
||||
session_configuration.clone(),
|
||||
initial_auto_compact_window_ids,
|
||||
ContextManager::for_session(
|
||||
&session_configuration.session_source,
|
||||
session_configuration.root_capabilities_restricted,
|
||||
&config.features,
|
||||
),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user