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:
faizan-oai authored and copyberry committed 2026-08-25 19:54:52 +00:00
1 parent a6e63f9f32
commit 94967e03e5
72 files changed
+1323 -273

No files matched your search

+18
View File
@@ -7,11 +7,13 @@ use crate::protocol::NonSteerableTurnKind;
use crate::protocol::ThreadSettingsOverrides;
use crate::protocol::W3cTraceContext;
use crate::user_input::UserInput;
use schemars::JsonSchema;
use serde::Deserialize;
use serde::Serialize;
use serde_json::Value;
use std::collections::BTreeMap;
use std::collections::HashMap;
use ts_rs::TS;
/// Result of stopping an unfinished root turn so another worker can recover it.
#[derive(Clone, Debug, PartialEq, Eq)]
@@ -59,6 +61,8 @@ pub struct RecoverTurnRequest {
pub turn_id: String,
pub thread_settings: ThreadSettingsOverrides,
pub trace: Option<W3cTraceContext>,
/// Program recorded in the interrupted turn's persisted context.
pub cyber_access_program: Option<CyberAccessProgram>,
}
impl TurnInputRequest {
@@ -135,6 +139,17 @@ pub enum TurnInputMode {
Steer { expected_turn_id: String },
}
/// Requested cyber treatment for a ChatGPT-authenticated Codex turn.
/// Authorization and model-tier restrictions remain server-owned.
#[derive(Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq, JsonSchema, TS)]
#[serde(rename_all = "snake_case")]
#[ts(rename_all = "snake_case")]
pub enum CyberAccessProgram {
Standard,
DaybreakBlue,
DaybreakRed,
}
/// Options for the new-turn branch of a submission.
///
/// Core only records these options when input starts a turn. When input steers,
@@ -155,6 +170,9 @@ pub struct TurnStartOptions {
pub parent_turn_id: Option<String>,
/// Causal root turn lineage recorded if this request starts a new turn.
pub root_turn_id: Option<String>,
/// Explicit cyber treatment for this turn. Omission preserves the backend's
/// automatic behavior.
pub cyber_access_program: Option<CyberAccessProgram>,
}
/// What Core did with input submitted through `start_or_steer_turn`.