WIP fase 2b-2: rimosso login ChatGPT/OAuth/device code, agent/workload identity, backend-client; resta solo chiave API (test non tutti verdi)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -145,12 +145,11 @@ impl TimeProvider for RecordingTimeProvider {
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||
#[test_case(CodexAuth::from_api_key("test-api-key"), "OpenAI", "/v1", "/v1/responses", true; "api_key_uses_responses")]
|
||||
#[test_case(CodexAuth::create_dummy_chatgpt_auth_for_testing(), "OpenAI", "/backend-api/codex", "/backend-api/codex/responses", true; "chatgpt_marks_guardian_by_default")]
|
||||
#[test_case(CodexAuth::Headers(AuthHeaders::new(http::HeaderMap::new())), "OpenAI", "/api/codex", "/api/codex/responses", true; "header_auth_marks_guardian_on_direct_backend")]
|
||||
#[test_case(CodexAuth::from_api_key("test-api-key"), "OpenAI", "/api/codex", "/api/codex/responses", true; "api_key_does_not_mark_guardian_on_direct_backend")]
|
||||
#[test_case(CodexAuth::create_dummy_chatgpt_auth_for_testing(), "OpenAI", "/v1", "/v1/responses", true; "custom_openai_url_marks_guardian")]
|
||||
#[test_case(CodexAuth::create_dummy_chatgpt_auth_for_testing(), "Custom", "/backend-api/codex", "/backend-api/codex/responses", true; "custom_provider_uses_responses")]
|
||||
#[test_case(CodexAuth::create_dummy_chatgpt_auth_for_testing(), "OpenAI", "/backend-api/codex", "/backend-api/codex/responses", false; "retry_without_response_id_keeps_last_parent")]
|
||||
#[test_case(CodexAuth::from_api_key("Test API Key"), "OpenAI", "/v1", "/v1/responses", true; "custom_openai_url_marks_guardian")]
|
||||
#[test_case(CodexAuth::from_api_key("Test API Key"), "Custom", "/backend-api/codex", "/backend-api/codex/responses", true; "custom_provider_uses_responses")]
|
||||
#[test_case(CodexAuth::from_api_key("Test API Key"), "OpenAI", "/backend-api/codex", "/backend-api/codex/responses", false; "retry_without_response_id_keeps_last_parent")]
|
||||
async fn guardian_session_inherits_parent_http_fallback(
|
||||
auth: CodexAuth,
|
||||
provider_name: &str,
|
||||
@@ -158,8 +157,10 @@ async fn guardian_session_inherits_parent_http_fallback(
|
||||
expected_guardian_path: &str,
|
||||
response_id_present: bool,
|
||||
) -> Result<()> {
|
||||
let credits_enabled = auth.uses_codex_backend() && provider_name == "OpenAI";
|
||||
let requests_parent_credits = credits_enabled && auth.is_chatgpt_auth();
|
||||
// Guardian credits are a ChatGPT-backend feature; stored credentials never request them.
|
||||
let _ = (&auth, provider_name);
|
||||
let credits_enabled = false;
|
||||
let requests_parent_credits = false;
|
||||
skip_if_no_network!(Ok(()));
|
||||
|
||||
let configured_policy = "Use the task-configured Guardian policy.";
|
||||
@@ -355,7 +356,7 @@ async fn guardian_custom_gateway_selects_reviewer_by_catalog_origin(
|
||||
sse(vec![ev_completed("done")]),
|
||||
]).await;
|
||||
let test = test_codex()
|
||||
.with_auth(CodexAuth::create_dummy_chatgpt_auth_for_testing())
|
||||
.with_catalog_discovery_api_key()
|
||||
.with_config(move |config| {
|
||||
config.model = Some("gateway-main".to_string());
|
||||
config.model_catalog = (origin == ModelOrigin::ExplicitConfig).then_some(catalog);
|
||||
@@ -483,7 +484,7 @@ for (const phase of ["before", "after"]) {
|
||||
let server = start_mock_server().await;
|
||||
let base_url = format!("{}/backend-api/codex", streaming.uri());
|
||||
let test = test_codex()
|
||||
.with_auth(CodexAuth::create_dummy_chatgpt_auth_for_testing())
|
||||
.with_auth(CodexAuth::from_api_key("Test API Key"))
|
||||
.with_extensions(Arc::new(extensions.build()))
|
||||
.with_config(move |config| {
|
||||
config.features.enable(Feature::CodeMode).unwrap();
|
||||
@@ -941,7 +942,6 @@ async fn guardian_requests_record_only_their_own_tool_calls() -> Result<()> {
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||
#[test_case(CodexAuth::from_api_key("test-api-key"), "/v1", "gpt-5.6-luna"; "api_key_uses_luna_with_responses_lite")]
|
||||
#[test_case(CodexAuth::create_dummy_chatgpt_auth_for_testing(), "/backend-api/codex", "codex-auto-review"; "chatgpt_uses_codex_auto_review")]
|
||||
#[test_case(CodexAuth::Headers(AuthHeaders::new(http::HeaderMap::new())), "/api/codex", "codex-auto-review"; "header_auth_uses_codex_auto_review_on_direct_backend")]
|
||||
#[test_case(CodexAuth::Headers(AuthHeaders::new(http::HeaderMap::new())), "/v1", "codex-auto-review"; "header_auth_marks_guardian_on_custom_url")]
|
||||
async fn guardian_session_prewarms_and_is_reused_for_first_review(
|
||||
@@ -951,8 +951,9 @@ async fn guardian_session_prewarms_and_is_reused_for_first_review(
|
||||
) -> Result<()> {
|
||||
skip_if_no_network!(Ok(()));
|
||||
|
||||
let credits_enabled = auth.uses_codex_backend();
|
||||
let requests_parent_credits = credits_enabled && auth.is_chatgpt_auth();
|
||||
// Guardian credits are a ChatGPT-backend feature; stored credentials never request them.
|
||||
let credits_enabled = false;
|
||||
let requests_parent_credits = false;
|
||||
let bundled_models = codex_models_manager::bundled_models_response()?.models;
|
||||
let catalog_auto_review = bundled_models
|
||||
.iter()
|
||||
@@ -1530,7 +1531,7 @@ async fn guardian_refreshes_missing_default_reviewer_once(
|
||||
let catalog_url = format!("{}/v1/models", server.uri());
|
||||
let configured_catalog = initial_catalog.clone();
|
||||
let mut builder = test_codex()
|
||||
.with_auth(CodexAuth::create_dummy_chatgpt_auth_for_testing())
|
||||
.with_catalog_discovery_api_key()
|
||||
.with_model("guardian-parent-a")
|
||||
.with_config(move |config| {
|
||||
config.permissions.approval_policy = Constrained::allow_any(AskForApproval::OnRequest);
|
||||
@@ -1750,7 +1751,7 @@ async fn guardian_reviews_delayed_and_new_actions_after_catalog_refresh() -> Res
|
||||
let mut extensions = ExtensionRegistryBuilder::<Config>::new();
|
||||
extensions.tool_lifecycle_contributor(pause.clone());
|
||||
let test = test_codex()
|
||||
.with_auth(CodexAuth::create_dummy_chatgpt_auth_for_testing())
|
||||
.with_catalog_discovery_api_key()
|
||||
.with_model("guardian-parent-a")
|
||||
.with_extensions(Arc::new(extensions.build()))
|
||||
.with_config(|config| {
|
||||
|
||||
Reference in New Issue
Block a user