mirror of
https://github.com/openai/codex.git
synced 2026-10-20 18:53:37 +00:00
## Why Incremental-tool windows recorded base instructions only at setup, so a catalog refresh for the same model could leave active instructions stale. Instruction changes need to reach the model without rewriting the existing history prefix. ## What changed - Track model identity and instruction content independently, appending a `model_instructions` developer message when either changes. Explicitly mark replacement or removal of base instructions, and avoid repeating unchanged updates. - Start new windows after compaction with the latest model instructions while preserving custom base instructions. - Preserve the recorded window base during local compaction retries, including empty instructions, and rebuild current model instructions when reconstructing child context. ## Testing Add integration tests and request snapshots for catalog refreshes, instruction removal, model switches, compaction, restart, and forks. Extend regression coverage for legacy snapshots and local compaction retries. GitOrigin-RevId: eeca69067b4d9cd91c817732d79b4d5c1faa18b9
264 lines
7.2 KiB
Rust
264 lines
7.2 KiB
Rust
// Aggregates all former standalone integration tests as modules.
|
|
use codex_apply_patch::CODEX_CORE_APPLY_PATCH_ARG1;
|
|
#[cfg(unix)]
|
|
use codex_exec_server::CODEX_ARG0_EXEC_HELPER_ARG1;
|
|
use codex_exec_server::CODEX_FS_HELPER_ARG1;
|
|
use codex_sandboxing::landlock::CODEX_LINUX_SANDBOX_ARG0;
|
|
use codex_test_binary_support::TestBinaryDispatchGuard;
|
|
use codex_test_binary_support::TestBinaryDispatchMode;
|
|
use codex_test_binary_support::configure_test_binary_dispatch;
|
|
use ctor::ctor;
|
|
|
|
// This code runs before any other tests are run.
|
|
// It allows the test binary to behave like codex and dispatch to apply_patch and codex-linux-sandbox
|
|
// based on the arg0.
|
|
// NOTE: this doesn't work on ARM
|
|
#[ctor]
|
|
pub static CODEX_ALIASES_TEMP_DIR: Option<TestBinaryDispatchGuard> = {
|
|
configure_test_binary_dispatch("codex-core-tests", |exe_name, argv1| {
|
|
if argv1 == Some(CODEX_CORE_APPLY_PATCH_ARG1) {
|
|
return TestBinaryDispatchMode::DispatchArg0Only;
|
|
}
|
|
#[cfg(unix)]
|
|
if argv1 == Some(CODEX_ARG0_EXEC_HELPER_ARG1) {
|
|
return TestBinaryDispatchMode::DispatchArg0Only;
|
|
}
|
|
if argv1 == Some(CODEX_FS_HELPER_ARG1) {
|
|
return TestBinaryDispatchMode::DispatchArg0Only;
|
|
}
|
|
if argv1 == Some(codex_sandboxing::CODEX_WINDOWS_MXC_ARG1) {
|
|
return TestBinaryDispatchMode::DispatchArg0Only;
|
|
}
|
|
if exe_name == CODEX_LINUX_SANDBOX_ARG0 {
|
|
return TestBinaryDispatchMode::DispatchArg0Only;
|
|
}
|
|
TestBinaryDispatchMode::InstallAliases
|
|
})
|
|
};
|
|
|
|
mod abort_lifecycle;
|
|
#[cfg(not(target_os = "windows"))]
|
|
mod abort_tasks;
|
|
mod additional_context;
|
|
#[path = "agent_control_tests.rs"]
|
|
mod agent_control;
|
|
mod agent_execution;
|
|
mod agent_websocket;
|
|
mod agents_md;
|
|
mod app_tool_exposure;
|
|
mod apply_patch_cli;
|
|
mod apply_patch_serialization;
|
|
#[cfg(target_os = "macos")]
|
|
mod apply_patch_system_aliases;
|
|
#[cfg(not(target_os = "windows"))]
|
|
mod approvals;
|
|
mod audio_truncation;
|
|
mod auth_recovery_policy;
|
|
mod auto_review;
|
|
mod base_instructions;
|
|
#[path = "bedrock_multi_agent_tests.rs"]
|
|
mod bedrock_multi_agent;
|
|
#[path = "bedrock_service_tier_tests.rs"]
|
|
mod bedrock_service_tier;
|
|
mod catalog_permission_messages;
|
|
mod cli_stream;
|
|
mod client;
|
|
mod client_websockets;
|
|
mod cloud_config;
|
|
mod code_mode;
|
|
mod code_mode_elicitation;
|
|
mod code_mode_model_messages;
|
|
mod codex_apps_protocol;
|
|
mod codex_delegate;
|
|
mod collaboration_instructions;
|
|
mod compact;
|
|
mod compact_remote;
|
|
mod compact_resume_fork;
|
|
mod context_annotations;
|
|
mod current_time_reminder;
|
|
mod cyber_access_program;
|
|
mod cyber_exec_policy;
|
|
mod daybreak_access;
|
|
mod deprecation_notice;
|
|
mod direct_tool_metadata;
|
|
mod dynamic_tool_cancellation;
|
|
mod exec;
|
|
mod exec_policy;
|
|
#[cfg(not(target_os = "windows"))]
|
|
mod extension_sandbox;
|
|
mod external_auth;
|
|
mod fork_thread;
|
|
mod git_enrichment;
|
|
mod guardian_authorization;
|
|
mod guardian_authorization_refresh;
|
|
#[path = "guardian_cached_score_tests.rs"]
|
|
mod guardian_cached_score;
|
|
#[path = "guardian_checkpoint_migration_tests.rs"]
|
|
mod guardian_checkpoint_migration;
|
|
// Uses the same command-approval harness as guardian_review below.
|
|
mod canonical_plugin_connectors;
|
|
mod gateway_auth;
|
|
mod guardian_connector_trust;
|
|
#[cfg(not(target_os = "windows"))]
|
|
mod guardian_context_budget;
|
|
#[path = "guardian_cyber_access_program_tests.rs"]
|
|
mod guardian_cyber_access_program;
|
|
mod guardian_history;
|
|
mod guardian_mcp_elicitation;
|
|
#[cfg(not(target_os = "windows"))]
|
|
#[path = "guardian_persistence_tests.rs"]
|
|
mod guardian_persistence;
|
|
mod guardian_retained_context;
|
|
mod guardian_retry;
|
|
#[cfg(not(target_os = "windows"))]
|
|
mod guardian_review;
|
|
#[cfg(not(target_os = "windows"))]
|
|
mod guardian_review_cancellation;
|
|
#[cfg(not(target_os = "windows"))]
|
|
mod guardian_subagent_authorization;
|
|
#[cfg(not(target_os = "windows"))]
|
|
mod hooks;
|
|
#[cfg(not(target_os = "windows"))]
|
|
mod hooks_executor;
|
|
#[cfg(not(target_os = "windows"))]
|
|
mod hooks_mcp;
|
|
mod hooks_plugin_policy_refresh;
|
|
mod image_rollout;
|
|
mod injected_models_cache;
|
|
#[cfg(not(target_os = "windows"))]
|
|
mod interrupt_hooks;
|
|
mod items;
|
|
mod json_result;
|
|
mod live_cli;
|
|
#[path = "managed_threads_tests.rs"]
|
|
mod managed_threads;
|
|
mod mcp_auth_elicitation;
|
|
mod mcp_auth_refresh;
|
|
mod mcp_ema_config;
|
|
#[path = "mcp_executor_context_tests.rs"]
|
|
mod mcp_executor_context;
|
|
mod mcp_extension_protocol;
|
|
mod mcp_optional_startup_grace;
|
|
mod mcp_refresh_cleanup;
|
|
mod mcp_startup_refresh_http_proxy;
|
|
mod mcp_subagent_elicitation;
|
|
mod mcp_tool_cache;
|
|
mod mcp_tool_exposure;
|
|
mod mcp_turn_metadata;
|
|
mod mcp_user_verification;
|
|
mod model_overrides;
|
|
#[path = "model_provider_requirements_tests.rs"]
|
|
mod model_provider_requirements;
|
|
mod model_request;
|
|
mod model_runtime_selectors;
|
|
mod model_switching;
|
|
mod model_visible_layout;
|
|
mod models_cache_auth;
|
|
mod models_cache_ttl;
|
|
mod models_etag_responses;
|
|
mod multi_agent_mode;
|
|
mod multi_agent_resume;
|
|
mod multi_agent_tool_descriptions;
|
|
#[cfg(unix)]
|
|
mod multi_exec_server_sandbox;
|
|
mod network_approval;
|
|
mod openai_file_mcp;
|
|
mod otel;
|
|
mod output_token_replay;
|
|
mod override_updates;
|
|
mod pending_input;
|
|
mod pending_input_persistence;
|
|
mod permissions_messages;
|
|
mod personality;
|
|
mod plugins;
|
|
mod prompt_cache_key;
|
|
mod prompt_caching;
|
|
mod prompt_debug_tests;
|
|
mod quota_exceeded;
|
|
mod realtime_attachment;
|
|
mod realtime_conversation;
|
|
mod realtime_initial_items;
|
|
mod realtime_misalignment;
|
|
mod realtime_sideband_endpoint;
|
|
mod realtime_system_proxy;
|
|
mod reasoning_effort_override;
|
|
mod remote_env;
|
|
mod remote_models;
|
|
mod request_compression;
|
|
#[cfg(not(target_os = "windows"))]
|
|
mod request_permissions;
|
|
#[cfg(not(target_os = "windows"))]
|
|
mod request_permissions_tool;
|
|
mod request_plugin_install;
|
|
mod request_user_input;
|
|
mod request_user_input_async;
|
|
mod responses_api_proxy_headers;
|
|
mod responses_lite;
|
|
#[cfg(target_os = "linux")]
|
|
mod responses_system_proxy;
|
|
mod resume;
|
|
mod resume_warning;
|
|
mod retry_after;
|
|
mod review;
|
|
mod rmcp_client;
|
|
mod rollout_budget;
|
|
mod rollout_compression;
|
|
mod rollout_list_find;
|
|
mod safety_buffering;
|
|
mod safety_check_downgrade;
|
|
mod scenarios;
|
|
mod search_tool;
|
|
mod settings_commits;
|
|
mod settings_constraints;
|
|
mod shell_snapshot;
|
|
mod skills;
|
|
mod skills_extension;
|
|
mod spawn_agent_description;
|
|
mod sqlite_state;
|
|
mod startup_cancellation;
|
|
mod step_settings;
|
|
mod step_settings_snapshots;
|
|
mod stream_error_allows_next_turn;
|
|
mod stream_no_completed;
|
|
mod subagent_dynamic_tools;
|
|
mod subagent_notifications;
|
|
mod subagent_service_tier;
|
|
mod token_budget;
|
|
mod token_usage_rollout;
|
|
mod tool_harness;
|
|
mod tool_lifecycle;
|
|
mod tool_parallelism;
|
|
mod tool_registration_metrics;
|
|
mod tools;
|
|
mod truncation;
|
|
#[path = "turn_error_details_tests.rs"]
|
|
mod turn_error_details;
|
|
mod turn_input_submission;
|
|
mod turn_phase_trace;
|
|
mod turn_state;
|
|
mod unified_exec;
|
|
#[path = "unified_exec_launch_failure_tests.rs"]
|
|
mod unified_exec_launch_failure;
|
|
#[cfg(windows)]
|
|
#[path = "unified_exec_mxc_powershell_tests.rs"]
|
|
mod unified_exec_mxc_powershell;
|
|
mod unified_exec_process_events;
|
|
mod unified_exec_stdin_approval;
|
|
mod unified_exec_stdin_review_size;
|
|
mod unstable_features_warning;
|
|
mod user_notification;
|
|
mod user_shell_cmd;
|
|
mod view_image;
|
|
mod wake_reservation;
|
|
mod web_search;
|
|
#[path = "web_search_system_proxy_tests.rs"]
|
|
mod web_search_system_proxy;
|
|
mod websocket_fallback;
|
|
mod window_headers;
|
|
mod workspace_roots;
|
|
mod worktree_trust;
|
|
|
|
mod executor_discovery_v2;
|
|
#[path = "guardian_sender_messages_tests.rs"]
|
|
mod guardian_sender_messages;
|