## Summary - ensure the TypeScript SDK sets CODEX_INTERNAL_ORIGINATOR_OVERRIDE to codex_sdk_ts when spawning the Codex CLI - extend the responses proxy test helper to capture request headers for assertions - add coverage that verifies Codex threads launched from the TypeScript SDK send the codex_sdk_ts originator header ## Testing - Not Run (not requested) ------ https://chatgpt.com/codex/tasks/task_i_68e561b125248320a487f129093d16e7
53 lines
1.8 KiB
Rust
53 lines
1.8 KiB
Rust
#![cfg(not(target_os = "windows"))]
|
|
#![allow(clippy::expect_used, clippy::unwrap_used)]
|
|
|
|
use core_test_support::responses;
|
|
use core_test_support::test_codex_exec::test_codex_exec;
|
|
use wiremock::matchers::header;
|
|
|
|
/// Verify that when the server reports an error, `codex-exec` exits with a
|
|
/// non-zero status code so automation can detect failures.
|
|
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
|
async fn send_codex_exec_originator() -> anyhow::Result<()> {
|
|
let test = test_codex_exec();
|
|
|
|
let server = responses::start_mock_server().await;
|
|
let body = responses::sse(vec![
|
|
responses::ev_response_created("response_1"),
|
|
responses::ev_assistant_message("response_1", "Hello, world!"),
|
|
responses::ev_completed("response_1"),
|
|
]);
|
|
responses::mount_sse_once_match(&server, header("Originator", "codex_exec"), body).await;
|
|
|
|
test.cmd_with_server(&server)
|
|
.arg("--skip-git-repo-check")
|
|
.arg("tell me something")
|
|
.assert()
|
|
.code(0);
|
|
|
|
Ok(())
|
|
}
|
|
|
|
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
|
async fn supports_originator_override() -> anyhow::Result<()> {
|
|
let test = test_codex_exec();
|
|
|
|
let server = responses::start_mock_server().await;
|
|
let body = responses::sse(vec![
|
|
responses::ev_response_created("response_1"),
|
|
responses::ev_assistant_message("response_1", "Hello, world!"),
|
|
responses::ev_completed("response_1"),
|
|
]);
|
|
responses::mount_sse_once_match(&server, header("Originator", "codex_exec_override"), body)
|
|
.await;
|
|
|
|
test.cmd_with_server(&server)
|
|
.env("CODEX_INTERNAL_ORIGINATOR_OVERRIDE", "codex_exec_override")
|
|
.arg("--skip-git-repo-check")
|
|
.arg("tell me something")
|
|
.assert()
|
|
.code(0);
|
|
|
|
Ok(())
|
|
}
|