aKode fase 2b-2: rimosso login ChatGPT e tutti i sottosistemi solo-ChatGPT
- Login: resta solo chiave API (+ header, Bedrock). Rimossi OAuth/browser, device code, refresh/revoke su auth.openai.com, PAT, agent/workload identity, runtime agent instance, backend-client e openapi-models, workspace routing. - Rimossi: generazione immagini (ext + skill imagegen), history notes, plugin remoti (catalogo, sync, share), cyber access program, daybreak, cloud config e requirements (config_server ora fail-closed), attestation, frozen cloud skills, EMA MCP auth, Codex Apps/connettori, ricerca ospitata, header/zstd/ routing/cookie del backend Codex, fallback OPENAI_API_KEY del realtime. - Messaggi d'errore senza link a chatgpt.com. - Chiavi di config legacy accettate e ignorate; feature rimosse = Stage::Removed. - Test: cancellati solo quelli del codice rimosso; test di sicurezza (sandbox estensioni, permessi, redazione, auth storage, requirements) adattati. Restano solo fallimenti d'ambiente (code-mode-host/V8, ~/.agents). - Istruzioni di sistema invariate. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -28,11 +28,6 @@ pub struct Cli {
|
||||
#[arg(long = "thread-source", value_name = "SOURCE", global = true)]
|
||||
pub thread_source: Option<ThreadSource>,
|
||||
|
||||
/// Request an experimental Cyber access program for this turn (OpenAI provider only).
|
||||
/// Omit to use server defaults. Not supported with review; fork requires a prompt.
|
||||
#[arg(long, value_enum, value_name = "PROGRAM", global = true)]
|
||||
pub cyber_access_program: Option<CyberAccessProgramCliArg>,
|
||||
|
||||
/// Allow running Codex outside a Git repository.
|
||||
#[arg(long = "skip-git-repo-check", global = true, default_value_t = false)]
|
||||
pub skip_git_repo_check: bool,
|
||||
@@ -90,24 +85,6 @@ pub struct Cli {
|
||||
pub prompt: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, ValueEnum)]
|
||||
#[value(rename_all = "snake_case")]
|
||||
pub enum CyberAccessProgramCliArg {
|
||||
Standard,
|
||||
DaybreakBlue,
|
||||
DaybreakRed,
|
||||
}
|
||||
|
||||
impl From<CyberAccessProgramCliArg> for codex_app_server_protocol::CyberAccessProgram {
|
||||
fn from(value: CyberAccessProgramCliArg) -> Self {
|
||||
match value {
|
||||
CyberAccessProgramCliArg::Standard => Self::Standard,
|
||||
CyberAccessProgramCliArg::DaybreakBlue => Self::DaybreakBlue,
|
||||
CyberAccessProgramCliArg::DaybreakRed => Self::DaybreakRed,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl std::ops::Deref for Cli {
|
||||
type Target = SharedCliOptions;
|
||||
|
||||
|
||||
@@ -11,8 +11,6 @@ fn resume_parses_prompt_after_global_flags() {
|
||||
"--json",
|
||||
"--model",
|
||||
"gpt-5.2-codex",
|
||||
"--cyber-access-program",
|
||||
"daybreak_blue",
|
||||
"--dangerously-bypass-approvals-and-sandbox",
|
||||
"--skip-git-repo-check",
|
||||
"--ephemeral",
|
||||
@@ -24,10 +22,6 @@ fn resume_parses_prompt_after_global_flags() {
|
||||
assert!(cli.ephemeral);
|
||||
assert!(cli.ignore_user_config);
|
||||
assert!(cli.ignore_rules);
|
||||
assert_eq!(
|
||||
cli.cyber_access_program,
|
||||
Some(CyberAccessProgramCliArg::DaybreakBlue)
|
||||
);
|
||||
let Some(Command::Resume(args)) = cli.command else {
|
||||
panic!("expected resume command");
|
||||
};
|
||||
|
||||
@@ -1,112 +0,0 @@
|
||||
//! Resolve the cyber treatment for an exec turn from the connected server's catalog.
|
||||
|
||||
use crate::RequestIdSequencer;
|
||||
use codex_app_server_client::InProcessAppServerClient;
|
||||
use codex_app_server_protocol::Account;
|
||||
use codex_app_server_protocol::ClientRequest;
|
||||
use codex_app_server_protocol::CyberAccessProgram;
|
||||
use codex_app_server_protocol::GetAccountParams;
|
||||
use codex_app_server_protocol::GetAccountResponse;
|
||||
use codex_app_server_protocol::ModelListParams;
|
||||
use codex_app_server_protocol::ModelListResponse;
|
||||
use codex_features::Feature;
|
||||
use codex_features::Features;
|
||||
use codex_model_provider_info::ModelProviderInfo;
|
||||
use codex_protocol::openai_models::ModelAccessPrograms;
|
||||
|
||||
pub(crate) async fn program_for_turn(
|
||||
features: &Features,
|
||||
client: &InProcessAppServerClient,
|
||||
request_ids: &mut RequestIdSequencer,
|
||||
model: &str,
|
||||
provider_id: &str,
|
||||
provider: Option<&ModelProviderInfo>,
|
||||
enabled: bool,
|
||||
) -> anyhow::Result<Option<CyberAccessProgram>> {
|
||||
if !provider.is_some_and(|provider| provider.supports_cyber_access_programs(provider_id)) {
|
||||
anyhow::ensure!(
|
||||
!enabled,
|
||||
"Daybreak requires a model provider with Cyber access program support"
|
||||
);
|
||||
return Ok(None);
|
||||
}
|
||||
|
||||
if enabled {
|
||||
anyhow::ensure!(
|
||||
matches!(
|
||||
read_account(client, request_ids).await?,
|
||||
Some(Account::Chatgpt { .. } | Account::ApiKey { .. })
|
||||
),
|
||||
"Daybreak requires a signed-in ChatGPT account or an OpenAI API key"
|
||||
);
|
||||
}
|
||||
|
||||
let mut cursor = None;
|
||||
loop {
|
||||
let result = client
|
||||
.request_typed::<ModelListResponse>(ClientRequest::ModelList {
|
||||
request_id: request_ids.next(),
|
||||
params: ModelListParams {
|
||||
cursor,
|
||||
limit: None,
|
||||
include_hidden: Some(true),
|
||||
model_provider: None,
|
||||
},
|
||||
})
|
||||
.await;
|
||||
let Ok(result) = result else {
|
||||
return Ok(None);
|
||||
};
|
||||
if let Some(selected) = result.data.into_iter().find(|entry| entry.model == model) {
|
||||
let programs = selected
|
||||
.available_access_programs
|
||||
.map(ModelAccessPrograms::from)
|
||||
.filter(|programs| !programs.cyber.is_empty());
|
||||
let Some(programs) = programs else {
|
||||
return Ok(None);
|
||||
};
|
||||
if enabled {
|
||||
return programs
|
||||
.daybreak()
|
||||
.map(|program| Some(program.into()))
|
||||
.ok_or_else(|| anyhow::anyhow!("Daybreak is unavailable for model {model}; turn it off or choose a compatible model"));
|
||||
}
|
||||
let Some(standard) = programs.standard() else {
|
||||
return Ok(None);
|
||||
};
|
||||
let eligible = match read_account(client, request_ids).await.unwrap_or(None) {
|
||||
Some(Account::Chatgpt { .. }) => true,
|
||||
Some(Account::ApiKey { .. }) => {
|
||||
features.enabled(Feature::ApiKeyCyberAccessPrograms)
|
||||
}
|
||||
Some(Account::AmazonBedrock { .. } | Account::Gcp {}) | None => false,
|
||||
};
|
||||
return Ok(eligible.then_some(standard.into()));
|
||||
}
|
||||
match result.next_cursor {
|
||||
Some(next) => cursor = Some(next),
|
||||
None => {
|
||||
// Preserve automatic treatment for explicit model IDs absent from the catalog.
|
||||
return Ok(None);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async fn read_account(
|
||||
client: &InProcessAppServerClient,
|
||||
request_ids: &mut RequestIdSequencer,
|
||||
) -> anyhow::Result<Option<Account>> {
|
||||
let account = client
|
||||
.request_typed::<GetAccountResponse>(ClientRequest::GetAccount {
|
||||
request_id: request_ids.next(),
|
||||
params: GetAccountParams {
|
||||
refresh_token: false,
|
||||
},
|
||||
})
|
||||
.await
|
||||
.map_err(|error| {
|
||||
anyhow::anyhow!("Daybreak account availability could not be determined: {error}")
|
||||
})?;
|
||||
Ok(account.account)
|
||||
}
|
||||
@@ -295,16 +295,6 @@ impl EventProcessor for EventProcessorWithHumanOutput {
|
||||
self.render_item_completed(notification.item.payload);
|
||||
CodexStatus::Running
|
||||
}
|
||||
ServerNotification::ModelRerouted(notification) => {
|
||||
eprintln!(
|
||||
"{} {} -> {}",
|
||||
"model rerouted:".style(self.yellow).style(self.bold),
|
||||
notification.from_model,
|
||||
notification.to_model
|
||||
);
|
||||
CodexStatus::Running
|
||||
}
|
||||
ServerNotification::ModelVerification(_) => CodexStatus::Running,
|
||||
ServerNotification::ThreadTokenUsageUpdated(notification) => {
|
||||
self.last_total_token_usage = Some(notification.token_usage);
|
||||
CodexStatus::Running
|
||||
|
||||
@@ -494,21 +494,6 @@ impl EventProcessorWithJsonOutput {
|
||||
}
|
||||
CodexStatus::Running
|
||||
}
|
||||
ServerNotification::ModelRerouted(notification) => {
|
||||
events.push(ThreadEvent::ItemCompleted(ItemCompletedEvent {
|
||||
item: ExecThreadItem {
|
||||
id: self.next_item_id(),
|
||||
details: ThreadItemDetails::Error(ErrorItem {
|
||||
message: format!(
|
||||
"model rerouted: {} -> {} ({:?})",
|
||||
notification.from_model, notification.to_model, notification.reason
|
||||
),
|
||||
}),
|
||||
},
|
||||
}));
|
||||
CodexStatus::Running
|
||||
}
|
||||
ServerNotification::ModelVerification(_) => CodexStatus::Running,
|
||||
ServerNotification::ThreadTokenUsageUpdated(notification) => {
|
||||
self.last_total_token_usage = Some(notification.token_usage);
|
||||
CodexStatus::Running
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
#![deny(clippy::print_stdout)]
|
||||
|
||||
mod cli;
|
||||
mod daybreak;
|
||||
mod event_processor;
|
||||
mod event_processor_with_human_output;
|
||||
pub(crate) mod event_processor_with_jsonl_output;
|
||||
@@ -62,7 +61,6 @@ use codex_app_server_protocol::TurnStartParams;
|
||||
use codex_app_server_protocol::TurnStartResponse;
|
||||
use codex_app_server_protocol::TurnStartedNotification;
|
||||
use codex_arg0::Arg0DispatchPaths;
|
||||
use codex_config::CloudConfigBundleLoader;
|
||||
use codex_config::ConfigLoadError;
|
||||
use codex_config::ConfigLoadOptions;
|
||||
use codex_config::LoaderOverrides;
|
||||
@@ -82,7 +80,6 @@ use codex_core::find_thread_meta_by_name_str;
|
||||
use codex_core::format_exec_policy_error_with_source;
|
||||
use codex_core::path_utils;
|
||||
use codex_core::read_session_meta_line;
|
||||
use codex_features::Feature;
|
||||
use codex_feedback::CodexFeedback;
|
||||
use codex_git_utils::get_git_repo_root;
|
||||
use codex_history::RolloutItem;
|
||||
@@ -90,7 +87,6 @@ use codex_history::RolloutLine;
|
||||
use codex_login::default_client::set_default_client_residency_requirement;
|
||||
use codex_login::default_client::set_default_originator;
|
||||
use codex_login::enforce_login_restrictions;
|
||||
use codex_login::is_workload_identity_selected;
|
||||
use codex_model_provider_info::LMSTUDIO_OSS_PROVIDER_ID;
|
||||
use codex_model_provider_info::OLLAMA_OSS_PROVIDER_ID;
|
||||
use codex_otel::set_parent_from_context;
|
||||
@@ -227,7 +223,6 @@ struct ExecRunArgs {
|
||||
command: Option<ExecCommand>,
|
||||
config: Config,
|
||||
resume_approvals_reviewer_override: Option<codex_app_server_protocol::ApprovalsReviewer>,
|
||||
daybreak_override: Option<bool>,
|
||||
dangerously_bypass_approvals_and_sandbox: bool,
|
||||
exec_span: tracing::Span,
|
||||
images: Vec<PathBuf>,
|
||||
@@ -241,7 +236,6 @@ struct ExecRunArgs {
|
||||
skip_git_repo_check: bool,
|
||||
stderr_with_ansi: bool,
|
||||
thread_source: ThreadSource,
|
||||
cyber_access_program: Option<codex_app_server_protocol::CyberAccessProgram>,
|
||||
}
|
||||
|
||||
struct ManagedExecWorktree {
|
||||
@@ -282,7 +276,6 @@ pub async fn run_main(cli: Cli, arg0_paths: Arg0DispatchPaths) -> anyhow::Result
|
||||
strict_config,
|
||||
shared,
|
||||
thread_source,
|
||||
cyber_access_program,
|
||||
skip_git_repo_check,
|
||||
trust,
|
||||
ephemeral,
|
||||
@@ -295,17 +288,6 @@ pub async fn run_main(cli: Cli, arg0_paths: Arg0DispatchPaths) -> anyhow::Result
|
||||
output_schema: output_schema_path,
|
||||
mut config_overrides,
|
||||
} = cli;
|
||||
if cyber_access_program.is_some() {
|
||||
match command.as_ref() {
|
||||
Some(ExecCommand::Review(_)) => {
|
||||
anyhow::bail!("--cyber-access-program is not supported with `codex exec review`");
|
||||
}
|
||||
Some(ExecCommand::Fork(args)) if args.prompt.is_none() && prompt.is_none() => {
|
||||
anyhow::bail!("Forking with --cyber-access-program requires a prompt");
|
||||
}
|
||||
Some(ExecCommand::Resume(_) | ExecCommand::Fork(_)) | None => {}
|
||||
}
|
||||
}
|
||||
let mut shared = shared.into_inner();
|
||||
shared.take_auto_review_config_overrides(&mut config_overrides);
|
||||
let SharedCliOptions {
|
||||
@@ -408,7 +390,6 @@ pub async fn run_main(cli: Cli, arg0_paths: Arg0DispatchPaths) -> anyhow::Result
|
||||
let managed_worktree = if worktree {
|
||||
let embedded_network_policy =
|
||||
codex_app_server_client::EmbeddedNetworkPolicy::load(&loader_overrides).await;
|
||||
let gate_cloud_config = CloudConfigBundleLoader::default();
|
||||
let gate_config = ConfigBuilder::default()
|
||||
.codex_home(codex_home.to_path_buf())
|
||||
.cli_overrides(cli_kv_overrides.clone())
|
||||
@@ -418,7 +399,6 @@ pub async fn run_main(cli: Cli, arg0_paths: Arg0DispatchPaths) -> anyhow::Result
|
||||
})
|
||||
.fallback_cwd(Some(config_cwd.to_path_buf()))
|
||||
.strict_config(strict_config)
|
||||
.cloud_config_bundle(gate_cloud_config.clone())
|
||||
.build()
|
||||
.await?;
|
||||
if let Some(ExecCommand::Fork(args)) = command.as_mut() {
|
||||
@@ -429,7 +409,6 @@ pub async fn run_main(cli: Cli, arg0_paths: Arg0DispatchPaths) -> anyhow::Result
|
||||
&cli_kv_overrides,
|
||||
&loader_overrides,
|
||||
worktree::ForkNetwork {
|
||||
cloud_config_bundle: gate_cloud_config.clone(),
|
||||
policy: embedded_network_policy.clone(),
|
||||
},
|
||||
strict_config,
|
||||
@@ -448,7 +427,6 @@ pub async fn run_main(cli: Cli, arg0_paths: Arg0DispatchPaths) -> anyhow::Result
|
||||
})
|
||||
.fallback_cwd(Some(config_cwd.to_path_buf()))
|
||||
.strict_config(strict_config)
|
||||
.cloud_config_bundle(gate_cloud_config)
|
||||
.build()
|
||||
.await?;
|
||||
if source_config.active_project.is_untrusted() {
|
||||
@@ -466,7 +444,6 @@ pub async fn run_main(cli: Cli, arg0_paths: Arg0DispatchPaths) -> anyhow::Result
|
||||
Vec::new(),
|
||||
LoaderOverrides::default(),
|
||||
strict_config,
|
||||
CloudConfigBundleLoader::default(),
|
||||
)
|
||||
.await;
|
||||
let settings =
|
||||
@@ -494,12 +471,9 @@ pub async fn run_main(cli: Cli, arg0_paths: Arg0DispatchPaths) -> anyhow::Result
|
||||
cli_kv_overrides.clone(),
|
||||
loader_overrides.clone(),
|
||||
strict_config,
|
||||
CloudConfigBundleLoader::default(),
|
||||
)
|
||||
.await;
|
||||
let bootstrap_config_toml = &bootstrap_config.config_toml;
|
||||
// aKode only loads local configuration; managed bundles are never fetched remotely.
|
||||
let cloud_config_bundle = CloudConfigBundleLoader::default();
|
||||
if let Some(worktree) = managed_worktree.as_ref() {
|
||||
// Destination auth can fetch source policy that the host bootstrap could not.
|
||||
let source_config = ConfigBuilder::default()
|
||||
@@ -511,7 +485,6 @@ pub async fn run_main(cli: Cli, arg0_paths: Arg0DispatchPaths) -> anyhow::Result
|
||||
})
|
||||
.fallback_cwd(Some(worktree.source_cwd.clone()))
|
||||
.strict_config(strict_config)
|
||||
.cloud_config_bundle(cloud_config_bundle.clone())
|
||||
.build()
|
||||
.await?;
|
||||
if source_config.active_project.is_untrusted() {
|
||||
@@ -531,7 +504,6 @@ pub async fn run_main(cli: Cli, arg0_paths: Arg0DispatchPaths) -> anyhow::Result
|
||||
discovery_overrides,
|
||||
loader_overrides.clone(),
|
||||
strict_config,
|
||||
cloud_config_bundle.clone(),
|
||||
)
|
||||
.await;
|
||||
if let Some(project) = saved_config.config_layer_stack.project_trust {
|
||||
@@ -553,24 +525,7 @@ pub async fn run_main(cli: Cli, arg0_paths: Arg0DispatchPaths) -> anyhow::Result
|
||||
}
|
||||
|
||||
let model_provider = if oss {
|
||||
let bootstrap_config_with_cloud_config;
|
||||
let config_toml_for_oss = if oss_provider.is_none() {
|
||||
// The first load intentionally skips cloud config so we can read
|
||||
// auth/base-url settings needed to fetch the bundle. If OSS mode
|
||||
// needs a default provider from config, reload with the bundle.
|
||||
bootstrap_config_with_cloud_config = load_bootstrap_config_or_exit(
|
||||
&codex_home,
|
||||
Some(&config_cwd),
|
||||
cli_kv_overrides.clone(),
|
||||
loader_overrides.clone(),
|
||||
strict_config,
|
||||
cloud_config_bundle.clone(),
|
||||
)
|
||||
.await;
|
||||
&bootstrap_config_with_cloud_config.config_toml
|
||||
} else {
|
||||
bootstrap_config_toml
|
||||
};
|
||||
let config_toml_for_oss = bootstrap_config_toml;
|
||||
|
||||
let resolved = resolve_oss_provider(oss_provider.as_deref(), config_toml_for_oss);
|
||||
|
||||
@@ -634,7 +589,6 @@ pub async fn run_main(cli: Cli, arg0_paths: Arg0DispatchPaths) -> anyhow::Result
|
||||
.harness_overrides(overrides)
|
||||
.loader_overrides(loader_overrides.clone())
|
||||
.strict_config(strict_config)
|
||||
.cloud_config_bundle(cloud_config_bundle.clone())
|
||||
.build()
|
||||
};
|
||||
let mut config = build_exec_config(
|
||||
@@ -657,10 +611,6 @@ pub async fn run_main(cli: Cli, arg0_paths: Arg0DispatchPaths) -> anyhow::Result
|
||||
"warning: Untrusted project-local configuration is disabled. Run `codex exec --trust` to allow project configuration and MCP servers for this and future chats in the project, including MCP commands outside the sandbox. Explicitly untrusted projects must have their trust setting updated first."
|
||||
);
|
||||
}
|
||||
let daybreak_override = cli_kv_overrides
|
||||
.iter()
|
||||
.any(|(key, _)| key == "daybreak")
|
||||
.then_some(config.daybreak_enabled);
|
||||
let resume_approvals_reviewer_override = cli_kv_overrides
|
||||
.iter()
|
||||
.any(|(key, _)| key == "approvals_reviewer")
|
||||
@@ -680,9 +630,7 @@ pub async fn run_main(cli: Cli, arg0_paths: Arg0DispatchPaths) -> anyhow::Result
|
||||
|
||||
set_default_client_residency_requirement(config.enforce_residency.value());
|
||||
|
||||
if !is_workload_identity_selected()
|
||||
&& let Err(err) = enforce_login_restrictions(&config.auth_config()).await
|
||||
{
|
||||
if let Err(err) = enforce_login_restrictions(&config.auth_config()).await {
|
||||
eprintln!("{err}");
|
||||
std::process::exit(1);
|
||||
}
|
||||
@@ -744,7 +692,6 @@ pub async fn run_main(cli: Cli, arg0_paths: Arg0DispatchPaths) -> anyhow::Result
|
||||
..loader_overrides
|
||||
},
|
||||
strict_config,
|
||||
cloud_config_bundle,
|
||||
embedded_network_policy,
|
||||
feedback: CodexFeedback::new(),
|
||||
log_db: None,
|
||||
@@ -766,7 +713,6 @@ pub async fn run_main(cli: Cli, arg0_paths: Arg0DispatchPaths) -> anyhow::Result
|
||||
command,
|
||||
config,
|
||||
resume_approvals_reviewer_override,
|
||||
daybreak_override,
|
||||
dangerously_bypass_approvals_and_sandbox,
|
||||
exec_span: exec_span.clone(),
|
||||
images,
|
||||
@@ -780,7 +726,6 @@ pub async fn run_main(cli: Cli, arg0_paths: Arg0DispatchPaths) -> anyhow::Result
|
||||
skip_git_repo_check,
|
||||
stderr_with_ansi,
|
||||
thread_source: thread_source.map(Into::into).unwrap_or(ThreadSource::User),
|
||||
cyber_access_program: cyber_access_program.map(Into::into),
|
||||
})
|
||||
.instrument(exec_span)
|
||||
.await
|
||||
@@ -828,7 +773,6 @@ async fn load_bootstrap_config_or_exit(
|
||||
cli_kv_overrides: Vec<(String, codex_config::TomlValue)>,
|
||||
loader_overrides: LoaderOverrides,
|
||||
strict_config: bool,
|
||||
cloud_config_bundle: CloudConfigBundleLoader,
|
||||
) -> ConfigTomlLoadResult {
|
||||
match load_config_toml_with_layer_stack(
|
||||
codex_home,
|
||||
@@ -837,7 +781,6 @@ async fn load_bootstrap_config_or_exit(
|
||||
ConfigLoadOptions {
|
||||
loader_overrides,
|
||||
strict_config,
|
||||
cloud_config_bundle,
|
||||
},
|
||||
)
|
||||
.await
|
||||
@@ -868,7 +811,6 @@ async fn run_exec_session(args: ExecRunArgs) -> anyhow::Result<()> {
|
||||
command,
|
||||
config,
|
||||
resume_approvals_reviewer_override,
|
||||
daybreak_override,
|
||||
dangerously_bypass_approvals_and_sandbox,
|
||||
exec_span,
|
||||
images,
|
||||
@@ -882,22 +824,8 @@ async fn run_exec_session(args: ExecRunArgs) -> anyhow::Result<()> {
|
||||
skip_git_repo_check,
|
||||
stderr_with_ansi,
|
||||
thread_source,
|
||||
cyber_access_program,
|
||||
} = args;
|
||||
|
||||
if config.features.enabled(Feature::CliDaybreak)
|
||||
&& config.daybreak_enabled
|
||||
&& !matches!(&command, Some(ExecCommand::Review(_)))
|
||||
{
|
||||
anyhow::ensure!(
|
||||
!oss || matches!(
|
||||
&command,
|
||||
Some(ExecCommand::Resume(_) | ExecCommand::Fork(_))
|
||||
),
|
||||
"Daybreak requires the OpenAI model provider"
|
||||
);
|
||||
}
|
||||
|
||||
let mut event_processor: Box<dyn EventProcessor> = match json_mode {
|
||||
true => Box::new(EventProcessorWithJsonOutput::new(last_message_file.clone())),
|
||||
_ => Box::new(EventProcessorWithHumanOutput::create_with_ansi(
|
||||
@@ -1045,7 +973,6 @@ async fn run_exec_session(args: ExecRunArgs) -> anyhow::Result<()> {
|
||||
anyhow::anyhow!("failed to initialize in-process app-server client: {err}")
|
||||
})?;
|
||||
|
||||
let mut daybreak_enabled = config.daybreak_enabled;
|
||||
// Resolve resume and fork through existing app-server thread lifecycle APIs.
|
||||
let (history_mode, fallback_session_configured) = if let Some(ExecCommand::Resume(args)) =
|
||||
command.as_ref()
|
||||
@@ -1070,9 +997,6 @@ async fn run_exec_session(args: ExecRunArgs) -> anyhow::Result<()> {
|
||||
let session_configured =
|
||||
session_configured_from_thread_resume_response(&response, &config)
|
||||
.map_err(anyhow::Error::msg)?;
|
||||
daybreak_enabled = daybreak_override
|
||||
.or(response.thread.daybreak_enabled)
|
||||
.unwrap_or(false);
|
||||
(response.thread.history_mode, session_configured)
|
||||
} else {
|
||||
let response = start_thread(&client, &mut request_ids, &config, &thread_source)
|
||||
@@ -1095,24 +1019,6 @@ async fn run_exec_session(args: ExecRunArgs) -> anyhow::Result<()> {
|
||||
resolve_resume_thread_id(&client, &config, state_db.as_ref(), &source_args)
|
||||
.await?
|
||||
.ok_or_else(|| anyhow::anyhow!("Session not found: {}", args.session_id))?;
|
||||
let source_daybreak = if config.ephemeral && daybreak_override.is_none() {
|
||||
let response: ThreadReadResponse = send_request_with_response(
|
||||
&client,
|
||||
ClientRequest::ThreadRead {
|
||||
request_id: request_ids.next(),
|
||||
params: ThreadReadParams {
|
||||
thread_id: source_thread_id.clone(),
|
||||
include_turns: false,
|
||||
},
|
||||
},
|
||||
"thread/read",
|
||||
)
|
||||
.await
|
||||
.map_err(anyhow::Error::msg)?;
|
||||
response.thread.daybreak_enabled
|
||||
} else {
|
||||
None
|
||||
};
|
||||
let permissions = permissions_selection_from_config(&config);
|
||||
let sandbox = permissions.is_none().then(|| {
|
||||
sandbox_mode_from_permission_profile(
|
||||
@@ -1165,10 +1071,6 @@ async fn run_exec_session(args: ExecRunArgs) -> anyhow::Result<()> {
|
||||
response.reasoning_effort,
|
||||
)
|
||||
.map_err(anyhow::Error::msg)?;
|
||||
daybreak_enabled = daybreak_override
|
||||
.or(response.thread.daybreak_enabled)
|
||||
.or(source_daybreak)
|
||||
.unwrap_or(false);
|
||||
(response.thread.history_mode, session_configured)
|
||||
} else {
|
||||
let response = start_thread(&client, &mut request_ids, &config, &thread_source)
|
||||
@@ -1232,24 +1134,6 @@ async fn run_exec_session(args: ExecRunArgs) -> anyhow::Result<()> {
|
||||
items,
|
||||
output_schema,
|
||||
} => {
|
||||
let cyber_access_program = match cyber_access_program {
|
||||
Some(program) => Some(program),
|
||||
None if config.features.enabled(Feature::CliDaybreak) => {
|
||||
daybreak::program_for_turn(
|
||||
&config.features,
|
||||
&client,
|
||||
&mut request_ids,
|
||||
&session_configured.model,
|
||||
&session_configured.model_provider_id,
|
||||
config
|
||||
.model_providers
|
||||
.get(&session_configured.model_provider_id),
|
||||
daybreak_enabled,
|
||||
)
|
||||
.await?
|
||||
}
|
||||
None => None,
|
||||
};
|
||||
let response: TurnStartResponse = send_request_with_response(
|
||||
&client,
|
||||
ClientRequest::TurnStart {
|
||||
@@ -1282,7 +1166,6 @@ async fn run_exec_session(args: ExecRunArgs) -> anyhow::Result<()> {
|
||||
output_schema,
|
||||
collaboration_mode: None,
|
||||
multi_agent_mode: None,
|
||||
cyber_access_program,
|
||||
},
|
||||
},
|
||||
"turn/start",
|
||||
@@ -1483,7 +1366,6 @@ fn thread_start_params_from_config(
|
||||
permissions,
|
||||
config: thread_config_overrides_from_config(config),
|
||||
ephemeral: Some(config.ephemeral),
|
||||
daybreak_enabled: (config.daybreak_enabled && !config.ephemeral).then_some(true),
|
||||
history_mode: (!config.ephemeral).then_some(ThreadHistoryMode::Paginated),
|
||||
thread_source: Some(thread_source.clone()),
|
||||
..ThreadStartParams::default()
|
||||
@@ -1733,12 +1615,6 @@ fn should_process_notification(
|
||||
ServerNotification::ItemStarted(notification) => {
|
||||
notification.thread_id == thread_id && notification.turn_id == turn_id
|
||||
}
|
||||
ServerNotification::ModelRerouted(notification) => {
|
||||
notification.thread_id == thread_id && notification.turn_id == turn_id
|
||||
}
|
||||
ServerNotification::ModelVerification(notification) => {
|
||||
notification.thread_id == thread_id && notification.turn_id == turn_id
|
||||
}
|
||||
ServerNotification::ThreadTokenUsageUpdated(notification) => {
|
||||
notification.thread_id == thread_id && notification.turn_id == turn_id
|
||||
}
|
||||
@@ -2240,24 +2116,6 @@ async fn handle_server_request(
|
||||
)
|
||||
.await
|
||||
}
|
||||
ServerRequest::ChatgptAuthTokensRefresh { request_id, .. } => {
|
||||
reject_server_request(
|
||||
client,
|
||||
request_id,
|
||||
&method,
|
||||
"chatgpt auth token refresh is not supported in exec mode".to_string(),
|
||||
)
|
||||
.await
|
||||
}
|
||||
ServerRequest::AttestationGenerate { request_id, .. } => {
|
||||
reject_server_request(
|
||||
client,
|
||||
request_id,
|
||||
&method,
|
||||
"attestation generation is not supported in exec mode".to_string(),
|
||||
)
|
||||
.await
|
||||
}
|
||||
ServerRequest::CurrentTimeRead { request_id, .. } => {
|
||||
reject_server_request(
|
||||
client,
|
||||
|
||||
@@ -305,7 +305,6 @@ fn turn_items_for_thread_returns_matching_turn_items() {
|
||||
section: None,
|
||||
section_entered_at: None,
|
||||
project_id: None,
|
||||
daybreak_enabled: None,
|
||||
history_mode: Default::default(),
|
||||
model_provider: "openai".to_string(),
|
||||
model: None,
|
||||
@@ -818,7 +817,6 @@ fn sample_thread_start_response() -> ThreadStartResponse {
|
||||
section: None,
|
||||
section_entered_at: None,
|
||||
project_id: None,
|
||||
daybreak_enabled: None,
|
||||
history_mode: Default::default(),
|
||||
model_provider: "openai".to_string(),
|
||||
model: None,
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
use super::*;
|
||||
|
||||
pub(super) struct ForkNetwork {
|
||||
pub cloud_config_bundle: CloudConfigBundleLoader,
|
||||
pub policy: codex_app_server_client::EmbeddedNetworkPolicy,
|
||||
}
|
||||
|
||||
@@ -37,7 +36,6 @@ pub(super) async fn fork_source(
|
||||
..loader_overrides.clone()
|
||||
},
|
||||
strict_config,
|
||||
cloud_config_bundle: network.cloud_config_bundle,
|
||||
embedded_network_policy: network.policy,
|
||||
feedback: CodexFeedback::new(),
|
||||
log_db: None,
|
||||
|
||||
Reference in New Issue
Block a user