Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
96 commits
Select commit Hold shift + click to select a range
f022f2d
guardian approval mvp
charley-oai Mar 6, 2026
16d330f
codex: fix CI failure on PR #13692
charley-oai Mar 6, 2026
129d359
guardian: rename reviewer to subagent
charley-oai Mar 6, 2026
dd5502e
document output schema behavior
charley-oai Mar 6, 2026
82d5c08
guardian network allowlist review
charley-oai Mar 6, 2026
8f01b64
trim output schema docs
charley-oai Mar 6, 2026
3d077b4
shorten output schema wording
charley-oai Mar 6, 2026
5ee1591
remove redundant output schema docs
charley-oai Mar 6, 2026
82a8260
reject require_escalated outside on-request
charley-oai Mar 6, 2026
0516a0e
codex: fix CI failure on PR #13692
charley-oai Mar 6, 2026
039394f
clarify output schema turn wording
charley-oai Mar 6, 2026
a9a6a67
comment guardian exec policy allow case
charley-oai Mar 6, 2026
742aef1
comment guardian shell backend fallback
charley-oai Mar 6, 2026
829ba69
Remove guardian design summary from PR
charley-oai Mar 6, 2026
e9ac8e6
Remove stale guardian prompt draft
charley-oai Mar 6, 2026
0ec6719
Expose guardian approval mode in CLI help
charley-oai Mar 6, 2026
f731b7b
Simplify guardian CLI help text
charley-oai Mar 6, 2026
6c1c07c
Document guardian review flow
charley-oai Mar 6, 2026
cebb310
Use gpt-5.4 for guardian review
charley-oai Mar 6, 2026
12ce1ec
Clarify guardian type ordering and transcript budget
charley-oai Mar 6, 2026
d71e1f2
Let guardian inherit live network allowlist
charley-oai Mar 6, 2026
0e2daca
enforce guardian feature gate on turn overrides
charley-oai Mar 6, 2026
6dbc615
cancel guardian subagent on timeout
charley-oai Mar 6, 2026
933791a
align guardian approvals with on-request
charley-oai Mar 6, 2026
d9dfee2
clarify guardian experimental description
charley-oai Mar 6, 2026
88c24de
suppress guardian experimental announcement
charley-oai Mar 6, 2026
c6f6831
keep guardian enabled without fallback policy
charley-oai Mar 6, 2026
d02db66
remove dead guardian sandbox override arg
charley-oai Mar 6, 2026
b8bff51
allow guardian additional-permission requests
charley-oai Mar 6, 2026
c9cf6af
update guardian schema fixtures and snapshot
charley-oai Mar 7, 2026
1bb30ef
allow guardian in shell additional-permissions gate
charley-oai Mar 7, 2026
193ccfc
allow guardian network retries after sandbox denial
charley-oai Mar 7, 2026
537b81e
split guardian-specific codex tests
charley-oai Mar 7, 2026
c37e795
dedupe guardian prompt source
charley-oai Mar 7, 2026
fb51901
include tool evidence in guardian transcript
charley-oai Mar 7, 2026
f4fe375
register experimental app-server enum variants
charley-oai Mar 7, 2026
ac1abd5
feature-gate guardian behind on-request
charley-oai Mar 7, 2026
af9c1ba
audit guardian comments for on-request routing
charley-oai Mar 7, 2026
03cf1e2
zsh
charley-oai Mar 7, 2026
d7ecfe8
trim guardian experimental copy
charley-oai Mar 7, 2026
ca2529f
decouple guardian branch from validation split
charley-oai Mar 7, 2026
f748a29
include full patch in guardian review
charley-oai Mar 7, 2026
8a6ef53
remove redundant approval policy plumbing
charley-oai Mar 7, 2026
60fe3ed
refresh app-server schema fixture
charley-oai Mar 7, 2026
65dfe29
simplify guardian routing helper
charley-oai Mar 7, 2026
d251e16
simplify network retry approval guard
charley-oai Mar 7, 2026
126c208
harden guardian reviewer config
charley-oai Mar 7, 2026
071cbbe
tighten guardian approval inputs
charley-oai Mar 7, 2026
6791ba2
rename guardian approval entrypoints
charley-oai Mar 7, 2026
ba46ef2
bound guardian approval context
charley-oai Mar 7, 2026
3f9605d
restore guardian sandbox-escalation wording
charley-oai Mar 7, 2026
441f501
tighten guardian budget comment
charley-oai Mar 7, 2026
cfec787
add guardian request snapshots
charley-oai Mar 7, 2026
5fe0629
clarify guardian prompt boundaries
charley-oai Mar 7, 2026
d4e1aff
snapshot guardian responses request layout
charley-oai Mar 7, 2026
21b42a5
order guardian action fields
charley-oai Mar 7, 2026
418a647
drop apply patch guardian snapshot
charley-oai Mar 7, 2026
8c63a09
dedupe guardian output contract
charley-oai Mar 7, 2026
d881124
move guardian policy into developer message
charley-oai Mar 7, 2026
1391948
drop guardian contextual top-level messages
charley-oai Mar 7, 2026
4a14057
use typed guardian action payloads
charley-oai Mar 7, 2026
47f0c0a
use guardian-specific execution instructions
charley-oai Mar 7, 2026
ec385de
shorten guardian snapshot label
charley-oai Mar 7, 2026
7394d1a
split guardian request into content items
charley-oai Mar 7, 2026
9bdd681
normalize guardian snapshot cwd
charley-oai Mar 7, 2026
f1a6177
remove guardian serialization panics
charley-oai Mar 7, 2026
6f97e01
revert typed guardian action payloads
charley-oai Mar 7, 2026
6722229
simplify guardian request json assembly
charley-oai Mar 7, 2026
57509ff
preserve exact guardian session approvals
charley-oai Mar 7, 2026
1f09e96
embed parent instructions in guardian request
charley-oai Mar 7, 2026
ee9e4ee
collapse guardian session approval copy helper
charley-oai Mar 7, 2026
5e865ac
reduce guardian special-casing in codex
charley-oai Mar 7, 2026
374f433
compact guardian parent context layout
charley-oai Mar 7, 2026
10eca7b
collapse guardian initial-context gating
charley-oai Mar 7, 2026
87188f7
restore normal guardian initial context injection
charley-oai Mar 7, 2026
6c1f53c
restore codex context block ordering
charley-oai Mar 7, 2026
09ede4f
rely on normal guardian permissions instructions
charley-oai Mar 7, 2026
673b451
remove duplicated guardian parent context block
charley-oai Mar 7, 2026
5e5d7e1
simplify guardian review flow
charley-oai Mar 7, 2026
659b99d
improve guardian request prompt framing
charley-oai Mar 7, 2026
64f9cf0
simplify guardian review plumbing
charley-oai Mar 7, 2026
f922763
split guardian transcript snapshot items
charley-oai Mar 7, 2026
a39d250
tighten guardian prompt layout
charley-oai Mar 7, 2026
a9ec969
clarify guardian approval request prompt
charley-oai Mar 7, 2026
8c45a58
tweak guardian transcript framing
charley-oai Mar 7, 2026
cb57ff4
clarify guardian output contract
charley-oai Mar 7, 2026
f74ea98
polish guardian prompt labels
charley-oai Mar 7, 2026
b7656fd
clarify guardian entry token budgets
charley-oai Mar 7, 2026
807c813
use constant in guardian model comment
charley-oai Mar 7, 2026
5287239
polish guardian naming nits
charley-oai Mar 7, 2026
645e6f9
seed guardian approvals before first turn
charley-oai Mar 7, 2026
21656e6
forward guardian patch retry reason
charley-oai Mar 7, 2026
726eb78
fix guardian test drift
charley-oai Mar 7, 2026
46ea76f
rerun guardian snapshot CI
charley-oai Mar 7, 2026
125a5ea
route mcp approvals through guardian
charley-oai Mar 7, 2026
b37d322
rerun guardian snapshot CI
charley-oai Mar 7, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ summary?: ReasoningSummary | null, /**
* Override the personality for this turn and subsequent turns.
*/
personality?: Personality | null, /**
* Optional JSON Schema used to constrain the final assistant message for this turn.
* Optional JSON Schema used to constrain the final assistant message for
* this turn.
*/
outputSchema?: JsonValue | null, /**
* EXPERIMENTAL - Set a pre-set collaboration mode.
Expand Down
3 changes: 2 additions & 1 deletion codex-rs/app-server-protocol/src/protocol/v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,8 @@ pub struct SendUserTurnParams {
pub service_tier: Option<Option<ServiceTier>>,
pub effort: Option<ReasoningEffort>,
pub summary: ReasoningSummary,
/// Optional JSON Schema used to constrain the final assistant message for this turn.
/// Optional JSON Schema used to constrain the final assistant message for
/// this turn.
pub output_schema: Option<serde_json::Value>,
}

Expand Down
3 changes: 2 additions & 1 deletion codex-rs/app-server-protocol/src/protocol/v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3227,7 +3227,8 @@ pub struct TurnStartParams {
/// Override the personality for this turn and subsequent turns.
#[ts(optional = nullable)]
pub personality: Option<Personality>,
/// Optional JSON Schema used to constrain the final assistant message for this turn.
/// Optional JSON Schema used to constrain the final assistant message for
/// this turn.
#[ts(optional = nullable)]
pub output_schema: Option<JsonValue>,

Expand Down
6 changes: 6 additions & 0 deletions codex-rs/core/config.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,9 @@
"fast_mode": {
"type": "boolean"
},
"guardian_approval": {
"type": "boolean"
},
"image_detail_original": {
"type": "boolean"
},
Expand Down Expand Up @@ -1831,6 +1834,9 @@
"fast_mode": {
"type": "boolean"
},
"guardian_approval": {
"type": "boolean"
},
"image_detail_original": {
"type": "boolean"
},
Expand Down
14 changes: 11 additions & 3 deletions codex-rs/core/src/codex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -409,9 +409,16 @@ impl Codex {
)
.await;

let exec_policy = ExecPolicyManager::load(&config.config_layer_stack)
.await
.map_err(|err| CodexErr::Fatal(format!("failed to load rules: {err}")))?;
let exec_policy = if crate::guardian::is_guardian_subagent_source(&session_source) {
// Guardian review should rely on the built-in shell safety checks,
// not on caller-provided exec-policy rules that could shape the
// reviewer or silently auto-approve commands.
ExecPolicyManager::default()
} else {
ExecPolicyManager::load(&config.config_layer_stack)
.await
.map_err(|err| CodexErr::Fatal(format!("failed to load rules: {err}")))?
};

let config = Arc::new(config);
let refresh_strategy = match session_source {
Expand Down Expand Up @@ -3184,6 +3191,7 @@ impl Session {
DeveloperInstructions::from_policy(
turn_context.sandbox_policy.get(),
turn_context.approval_policy.value(),
turn_context.features.enabled(Feature::GuardianApproval),
self.services.exec_policy.current().as_ref(),
&turn_context.cwd,
turn_context.features.enabled(Feature::RequestPermissions),
Expand Down
10 changes: 8 additions & 2 deletions codex-rs/core/src/codex_delegate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ use codex_protocol::protocol::Submission;
use codex_protocol::request_user_input::RequestUserInputArgs;
use codex_protocol::request_user_input::RequestUserInputResponse;
use codex_protocol::user_input::UserInput;
use serde_json::Value;
use std::time::Duration;
use tokio::time::timeout;
use tokio_util::sync::CancellationToken;
Expand All @@ -36,13 +37,15 @@ use codex_protocol::protocol::InitialHistory;
/// The returned `events_rx` yields non-approval events emitted by the sub-agent.
/// Approval requests are handled via `parent_session` and are not surfaced.
/// The returned `ops_tx` allows the caller to submit additional `Op`s to the sub-agent.
#[allow(clippy::too_many_arguments)]
pub(crate) async fn run_codex_thread_interactive(
config: Config,
auth_manager: Arc<AuthManager>,
models_manager: Arc<ModelsManager>,
parent_session: Arc<Session>,
parent_ctx: Arc<TurnContext>,
cancel_token: CancellationToken,
subagent_source: SubAgentSource,
initial_history: Option<InitialHistory>,
) -> Result<Codex, CodexErr> {
let (tx_sub, rx_sub) = async_channel::bounded(SUBMISSION_CHANNEL_CAPACITY);
Expand All @@ -57,7 +60,7 @@ pub(crate) async fn run_codex_thread_interactive(
Arc::clone(&parent_session.services.mcp_manager),
Arc::clone(&parent_session.services.file_watcher),
initial_history.unwrap_or(InitialHistory::New),
SessionSource::SubAgent(SubAgentSource::Review),
SessionSource::SubAgent(subagent_source),
parent_session.services.agent_control.clone(),
Vec::new(),
false,
Expand Down Expand Up @@ -113,6 +116,8 @@ pub(crate) async fn run_codex_thread_one_shot(
parent_session: Arc<Session>,
parent_ctx: Arc<TurnContext>,
cancel_token: CancellationToken,
subagent_source: SubAgentSource,
final_output_json_schema: Option<Value>,
initial_history: Option<InitialHistory>,
) -> Result<Codex, CodexErr> {
// Use a child token so we can stop the delegate after completion without
Expand All @@ -125,14 +130,15 @@ pub(crate) async fn run_codex_thread_one_shot(
parent_session,
parent_ctx,
child_cancel.clone(),
subagent_source,
initial_history,
)
.await?;

// Send the initial input to kick off the one-shot turn.
io.submit(Op::UserInput {
items: input,
final_output_json_schema: None,
final_output_json_schema,
})
.await?;

Expand Down
3 changes: 3 additions & 0 deletions codex-rs/core/src/codex_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ use std::sync::Arc;
use std::sync::Once;
use std::time::Duration as StdDuration;

#[path = "codex_tests_guardian.rs"]
mod guardian_tests;

struct InstructionsTestCase {
slug: &'static str,
expects_apply_patch_instructions: bool,
Expand Down
Loading
Loading