mirror of
https://github.com/openai/codex.git
synced 2026-11-21 22:50:37 +00:00
## Why App-server clients that prepare threads for later use need to be able to skip Daybreak propagation for an individual thread when the server configuration enables it. ## What changed With `experimentalApi`, pass `daybreakProgramPropagationEnrolled: false` to `thread/start` to opt a new root thread out. Managed requirements take precedence. Omitting the field or passing `null` or `true` uses the configured enrollment rule. The same field on `Thread` reports actual enrollment for the live session, including in the start response and `thread/started` notification. Reusing a live session preserves its enrollment. A thread returned from stored metadata alone reports `null`, and resuming it from storage in a new session reports `false`. ## Testing App-server tests cover enrollment under enabled, required, and disabled configuration, as well as reporting across live reads and resumes, unload, and resume from storage. A core test checks that opting out prevents native helpers from inheriting the root's saved Daybreak choice. GitOrigin-RevId: f9aae9ff76702b1e5a38d45120cd889a26f8ece5
97 lines
3.7 KiB
Rust
97 lines
3.7 KiB
Rust
#![allow(clippy::expect_used)]
|
|
|
|
mod analytics_server;
|
|
mod auth_fixtures;
|
|
mod config;
|
|
mod json_logging;
|
|
mod local_websocket_exec_server;
|
|
mod mock_model_server;
|
|
mod models_cache;
|
|
mod responses;
|
|
mod rollout;
|
|
mod rpc_delay;
|
|
mod test_app_server;
|
|
|
|
pub use analytics_server::start_analytics_events_server;
|
|
pub use auth_fixtures::ChatGptAuthFixture;
|
|
pub use auth_fixtures::ChatGptIdTokenClaims;
|
|
pub use auth_fixtures::encode_id_token;
|
|
pub use auth_fixtures::mount_workspace_routing;
|
|
pub use auth_fixtures::write_chatgpt_auth;
|
|
use codex_app_server_protocol::JSONRPCResponse;
|
|
pub use config::MockResponsesConfig;
|
|
pub use config::write_mock_responses_config_toml;
|
|
pub use config::write_mock_responses_config_toml_with_chatgpt_base_url;
|
|
pub use core_test_support::PathBufExt;
|
|
pub use core_test_support::format_with_current_shell;
|
|
pub use core_test_support::format_with_current_shell_display;
|
|
pub use core_test_support::format_with_current_shell_display_non_login;
|
|
pub use core_test_support::format_with_current_shell_non_login;
|
|
pub use core_test_support::test_absolute_path;
|
|
pub use core_test_support::test_path_buf_with_windows;
|
|
pub use core_test_support::test_tmp_path;
|
|
pub use core_test_support::test_tmp_path_buf;
|
|
pub use json_logging::app_server_json_shutdown_event;
|
|
pub use local_websocket_exec_server::LocalWebsocketExecServer;
|
|
pub use mock_model_server::create_mock_responses_server_repeating_assistant;
|
|
pub use mock_model_server::create_mock_responses_server_sequence;
|
|
pub use mock_model_server::create_mock_responses_server_sequence_unchecked;
|
|
pub use models_cache::write_models_cache;
|
|
pub use models_cache::write_models_cache_with_models;
|
|
pub use responses::create_apply_patch_sse_response;
|
|
pub use responses::create_command_execution_sse_response;
|
|
pub use responses::create_escalated_command_execution_sse_response;
|
|
pub use responses::create_exec_command_sse_response;
|
|
pub use responses::create_final_assistant_message_sse_response;
|
|
pub use responses::create_request_permissions_sse_response;
|
|
pub use responses::create_request_user_input_sse_response;
|
|
pub use rollout::create_fake_paginated_rollout;
|
|
pub use rollout::create_fake_parented_rollout_with_source;
|
|
pub use rollout::create_fake_rollout;
|
|
pub use rollout::create_fake_rollout_with_session_and_thread_source;
|
|
pub use rollout::create_fake_rollout_with_source;
|
|
pub use rollout::create_fake_rollout_with_text_elements;
|
|
pub use rollout::create_fake_rollout_with_token_usage;
|
|
pub use rollout::rollout_path;
|
|
use serde::de::DeserializeOwned;
|
|
pub use test_app_server::DEFAULT_APP_SERVER_TEST_ARGS;
|
|
pub use test_app_server::DEFAULT_CLIENT_NAME;
|
|
pub use test_app_server::TestAppServer;
|
|
pub use test_app_server::TestAppServerBuilder;
|
|
|
|
pub const CLEARED_OPENAI_AUTH_ENV: &[(&str, Option<&str>)] = &[
|
|
(codex_login::OPENAI_API_KEY_ENV_VAR, None),
|
|
(codex_login::CODEX_API_KEY_ENV_VAR, None),
|
|
(codex_login::CODEX_ACCESS_TOKEN_ENV_VAR, None),
|
|
(
|
|
codex_protocol::shell_environment::OPENAI_FEDERATION_RULE_ID_ENV_VAR,
|
|
None,
|
|
),
|
|
(
|
|
codex_protocol::shell_environment::OPENAI_IDENTITY_TOKEN_FILE_ENV_VAR,
|
|
None,
|
|
),
|
|
(
|
|
codex_protocol::shell_environment::OPENAI_IDENTITY_TOKEN_SOURCE_ENV_VAR,
|
|
None,
|
|
),
|
|
(
|
|
codex_protocol::shell_environment::OPENAI_SPIFFE_AUDIENCE_ENV_VAR,
|
|
None,
|
|
),
|
|
(
|
|
codex_protocol::shell_environment::OPENAI_SPIFFE_ID_ENV_VAR,
|
|
None,
|
|
),
|
|
(
|
|
codex_protocol::shell_environment::OPENAI_WORKLOAD_IDENTITY_CONTEXT_ENV_VAR,
|
|
None,
|
|
),
|
|
];
|
|
|
|
pub fn to_response<T: DeserializeOwned>(response: JSONRPCResponse) -> anyhow::Result<T> {
|
|
let value = serde_json::to_value(response.result)?;
|
|
let codex_response = serde_json::from_value(value)?;
|
|
Ok(codex_response)
|
|
}
|