mirror of
https://github.com/openai/codex.git
synced 2026-11-18 23:02:23 +00:00
Add per-turn cyber access program selection (#40687)
## What changed - Add the experimental `turn/start.cyberAccessProgram` option with `standard`, `daybreakBlue`, and `daybreakRed` values. - Forward the selection as `access_programs.cyber` on Responses, WebSocket, and remote-compaction requests made with ChatGPT authentication, while omitting it for API-key and custom-provider requests. - Preserve the per-turn selection across recovery, compaction, and child-agent turns without making it a persistent thread setting. ## Testing - Cover app-server forwarding, authentication boundaries, WebSocket reuse, turn recovery, compaction, and child-agent inheritance. GitOrigin-RevId: d2eb468f365b2214c5099bc21741cf30f8bd2eb5
This commit is contained in:
1 parent
a6e63f9f32
commit
94967e03e5
72 files changed
+1323
-273
No files matched your search
@@ -4733,12 +4733,42 @@ fn turn_start_params_preserve_explicit_null_service_tier() {
|
||||
collaboration_mode: None,
|
||||
multi_agent_mode: None,
|
||||
personality: None,
|
||||
cyber_access_program: None,
|
||||
};
|
||||
let serialized_without_override =
|
||||
serde_json::to_value(&without_override).expect("params should serialize");
|
||||
assert_eq!(serialized_without_override.get("serviceTier"), None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn turn_start_cyber_access_program_uses_separate_wire_formats() {
|
||||
for (app_server_value, core_value) in [
|
||||
("standard", "standard"),
|
||||
("daybreakBlue", "daybreak_blue"),
|
||||
("daybreakRed", "daybreak_red"),
|
||||
] {
|
||||
let params: TurnStartParams = serde_json::from_value(json!({
|
||||
"threadId": "thread_123",
|
||||
"input": [],
|
||||
"cyberAccessProgram": app_server_value,
|
||||
}))
|
||||
.expect("params should deserialize");
|
||||
let core_program: codex_protocol::turn_input::CyberAccessProgram = params
|
||||
.cyber_access_program
|
||||
.expect("explicit program")
|
||||
.into();
|
||||
|
||||
assert_eq!(
|
||||
serde_json::to_value(params).expect("params should serialize")["cyberAccessProgram"],
|
||||
app_server_value,
|
||||
);
|
||||
assert_eq!(
|
||||
serde_json::to_value(core_program).expect("core program should serialize"),
|
||||
json!(core_value),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn turn_start_params_round_trip_multi_agent_mode() {
|
||||
let params: TurnStartParams = serde_json::from_value(json!({
|
||||
|
||||
@@ -13,6 +13,7 @@ use codex_protocol::models::ImageDetail;
|
||||
use codex_protocol::openai_models::ReasoningEffort;
|
||||
use codex_protocol::plan_tool::PlanItemArg as CorePlanItemArg;
|
||||
use codex_protocol::plan_tool::StepStatus as CorePlanStepStatus;
|
||||
use codex_protocol::turn_input::CyberAccessProgram as CoreCyberAccessProgram;
|
||||
use codex_protocol::user_input::ByteRange as CoreByteRange;
|
||||
use codex_protocol::user_input::TextElement as CoreTextElement;
|
||||
use codex_protocol::user_input::UserInput as CoreUserInput;
|
||||
@@ -111,6 +112,28 @@ pub struct AdditionalContextEntry {
|
||||
pub kind: AdditionalContextKind,
|
||||
}
|
||||
|
||||
/// Requested cyber treatment for a ChatGPT-authenticated Codex turn.
|
||||
/// Authorization and model-tier restrictions remain server-owned.
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq, JsonSchema, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[ts(rename_all = "camelCase")]
|
||||
#[ts(export_to = "v2/")]
|
||||
pub enum CyberAccessProgram {
|
||||
Standard,
|
||||
DaybreakBlue,
|
||||
DaybreakRed,
|
||||
}
|
||||
|
||||
impl From<CyberAccessProgram> for CoreCyberAccessProgram {
|
||||
fn from(value: CyberAccessProgram) -> Self {
|
||||
match value {
|
||||
CyberAccessProgram::Standard => Self::Standard,
|
||||
CyberAccessProgram::DaybreakBlue => Self::DaybreakBlue,
|
||||
CyberAccessProgram::DaybreakRed => Self::DaybreakRed,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(
|
||||
Serialize, Deserialize, Debug, Default, Clone, PartialEq, JsonSchema, TS, ExperimentalApi,
|
||||
)]
|
||||
@@ -215,6 +238,12 @@ pub struct TurnStartParams {
|
||||
#[experimental("turn/start.multiAgentMode")]
|
||||
#[ts(optional = nullable)]
|
||||
pub multi_agent_mode: Option<MultiAgentMode>,
|
||||
|
||||
/// EXPERIMENTAL - Request a workspace-authorized cyber program for this
|
||||
/// turn. Omission preserves automatic behavior. This does not grant access.
|
||||
#[experimental("turn/start.cyberAccessProgram")]
|
||||
#[ts(optional = nullable)]
|
||||
pub cyber_access_program: Option<CyberAccessProgram>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
|
||||
|
||||
Reference in new issue
Block a user