Files
codex/codex-rs/core/tests/suite/mod.rs
T
rka-oai 71dbf72b05 Add the async user message tool (#39319)
## What changed

- Add `send_user_message_async` for root agents when the async-message feature is enabled and the model advertises tool support.
- Emit the supplied text as an asynchronous agent message and immediately return an accepted result so the turn can continue.
- Keep the user-visible update out of the model's input context.

## Testing

- Add an integration test covering tool registration, item events, continued turn execution, and model context.

GitOrigin-RevId: 13d5168cb8cd6742db17bb74a15c910994e9c98b
2026-08-18 23:59:19 +00:00

186 lines
5.0 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| {
#[cfg(windows)]
if exe_name.eq_ignore_ascii_case("powershell.exe")
|| exe_name.eq_ignore_ascii_case("powershell.evil")
|| exe_name.eq_ignore_ascii_case("pwsh.exe")
{
let executable = std::env::current_exe().expect("locate fake PowerShell executable");
if executable
.with_file_name(".codex-executable-identity-fixture")
.is_file()
{
let marker = executable.with_file_name("attacker-executed");
std::fs::write(marker, b"ran").expect("record fake PowerShell execution");
std::process::exit(0);
}
}
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 exe_name == CODEX_LINUX_SANDBOX_ARG0 {
return TestBinaryDispatchMode::DispatchArg0Only;
}
TestBinaryDispatchMode::InstallAliases
})
};
#[cfg(not(target_os = "windows"))]
mod abort_tasks;
mod additional_context;
mod agent_execution;
mod agent_websocket;
mod agents_md;
mod apply_patch_cli;
#[cfg(not(target_os = "windows"))]
mod approvals;
mod audio_truncation;
mod auto_review;
mod catalog_permission_messages;
mod cli_stream;
mod client;
mod client_websockets;
mod cloud_config;
mod code_mode;
mod code_mode_elicitation;
mod codex_delegate;
mod collaboration_instructions;
mod compact;
mod compact_remote;
mod compact_remote_parity;
mod compact_resume_fork;
mod current_time_reminder;
mod cyber_exec_policy;
mod deprecation_notice;
mod exec;
mod exec_policy;
mod executable_identity;
#[cfg(not(target_os = "windows"))]
mod extension_sandbox;
mod external_auth;
mod fork_thread;
mod git_enrichment;
#[cfg(not(target_os = "windows"))]
mod guardian_review;
#[cfg(not(target_os = "windows"))]
mod hooks;
#[cfg(not(target_os = "windows"))]
mod hooks_mcp;
mod image_rollout;
mod injected_models_cache;
mod items;
mod json_result;
mod live_cli;
mod mcp_auth_elicitation;
mod mcp_auth_refresh;
#[cfg(unix)]
mod mcp_refresh_cleanup;
mod mcp_startup_refresh_http_proxy;
mod mcp_tool_cache;
mod mcp_tool_exposure;
mod mcp_turn_metadata;
mod model_overrides;
mod model_runtime_selectors;
mod model_switching;
mod model_visible_layout;
mod models_cache_ttl;
mod models_etag_responses;
mod multi_agent_mode;
mod multi_agent_resume;
#[cfg(unix)]
mod multi_exec_server_sandbox;
mod network_approval;
mod openai_file_mcp;
mod otel;
mod override_updates;
mod pending_input;
mod permissions_messages;
mod personality;
mod plugins;
mod prompt_cache_key;
mod prompt_caching;
mod prompt_debug_tests;
mod quota_exceeded;
mod realtime_conversation;
mod realtime_initial_items;
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 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_list_find;
mod safety_buffering;
mod safety_check_downgrade;
mod search_tool;
mod send_user_message_async;
mod shell_command;
mod shell_serialization;
mod shell_snapshot;
mod skill_approval;
mod skills;
mod skills_extension;
mod spawn_agent_description;
mod sqlite_state;
mod stream_error_allows_next_turn;
mod stream_no_completed;
mod subagent_notifications;
mod token_budget;
mod tool_harness;
mod tool_lifecycle;
mod tool_parallelism;
mod tools;
mod truncation;
mod turn_input_submission;
mod turn_state;
mod unified_exec;
mod unified_exec_process_events;
#[cfg(unix)]
mod unified_exec_zsh_fork_approvals;
mod unstable_features_warning;
mod user_notification;
mod user_shell_cmd;
mod view_image;
mod web_search;
mod websocket_fallback;
mod window_headers;
#[cfg(target_os = "windows")]
mod windows_sandbox;
mod workspace_roots;