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:
@@ -243,7 +243,6 @@ async fn token_budget_context_is_only_emitted_with_full_context() -> Result<()>
|
||||
}
|
||||
|
||||
#[test_case("features.token_budget.enabled = true"; "token_budget")]
|
||||
#[test_case("features.context_management.experimental_mode = true"; "experimental_mode")]
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||
async fn token_budget_guidance_precedes_standalone_context_window(
|
||||
activation: &'static str,
|
||||
@@ -265,11 +264,7 @@ async fn token_budget_guidance_precedes_standalone_context_window(
|
||||
.with_model_info_override("gpt-5.2", |model| {
|
||||
model.supports_experimental_context = true;
|
||||
})
|
||||
.with_auth(CodexAuth::from_external_chatgpt_tokens(
|
||||
"header.e30.signature",
|
||||
"account-123",
|
||||
Some("plus"),
|
||||
)?)
|
||||
.with_auth(CodexAuth::from_api_key("Test API Key"))
|
||||
.with_pre_build_hook(move |home| {
|
||||
std::fs::write(
|
||||
home.join("config.toml"),
|
||||
@@ -314,64 +309,6 @@ async fn token_budget_guidance_precedes_standalone_context_window(
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test_case("OpenAI", "/backend-api/codex", None, true, true; "codex_backend")]
|
||||
#[test_case("OpenAI", "/backend-api/codex", None, false, false; "unsupported_model")]
|
||||
#[test_case("Custom", "/backend-api/codex", None, true, false; "custom_provider")]
|
||||
#[test_case("OpenAI", "/v1", None, true, false; "non_codex_endpoint")]
|
||||
#[test_case("OpenAI", "/backend-api/codex", Some("test-provider-token"), true, false; "provider_credentials")]
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||
async fn experimental_context_requires_capable_model_and_codex_backend(
|
||||
provider_name: &'static str,
|
||||
base_path: &'static str,
|
||||
bearer_token: Option<&'static str>,
|
||||
supports_context: bool,
|
||||
expected_enabled: bool,
|
||||
) -> Result<()> {
|
||||
skip_if_no_network!(Ok(()));
|
||||
|
||||
let server = start_mock_server().await;
|
||||
let response = mount_sse_once(&server, sse_completed("resp-1")).await;
|
||||
let base_url = format!("{}{base_path}", server.uri());
|
||||
let test = test_codex()
|
||||
.with_model_info_override("gpt-5.2", move |model| {
|
||||
model.supports_experimental_context = supports_context;
|
||||
})
|
||||
.with_auth(CodexAuth::from_external_chatgpt_tokens(
|
||||
"header.e30.signature",
|
||||
"account-123",
|
||||
Some("plus"),
|
||||
)?)
|
||||
.with_config(move |config| {
|
||||
config.model_provider.name = provider_name.to_string();
|
||||
config.model_provider.base_url = Some(base_url);
|
||||
config.model_provider.experimental_bearer_token = bearer_token.map(Into::into);
|
||||
config.model_context_window = Some(CONFIGURED_CONTEXT_WINDOW);
|
||||
config
|
||||
.features
|
||||
.enable(Feature::ContextManagement)
|
||||
.expect("test config should allow experimental context");
|
||||
})
|
||||
.build_with_auto_env(&server)
|
||||
.await?;
|
||||
|
||||
test.submit_turn("inspect experimental context activation")
|
||||
.await?;
|
||||
|
||||
let request = response.single_request();
|
||||
assert_eq!(
|
||||
tool_names(&request)
|
||||
.iter()
|
||||
.any(|name| name == "new_context"),
|
||||
expected_enabled
|
||||
);
|
||||
assert_eq!(
|
||||
!token_budget_contexts(&request).is_empty(),
|
||||
expected_enabled
|
||||
);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test_case(false, true, false; "explicit_history_notes_without_experimental_capability")]
|
||||
#[test_case(false, true, true; "explicit_history_notes_with_experimental_capability")]
|
||||
#[test_case(false, false, false; "explicit_standalone_token_budget")]
|
||||
@@ -389,11 +326,7 @@ async fn token_budget_history_notes_can_be_enabled_without_experimental_context(
|
||||
let server = start_mock_server().await;
|
||||
let backend_url = format!("{}/backend-api/codex", server.uri());
|
||||
let mut builder = test_codex()
|
||||
.with_auth(CodexAuth::from_external_chatgpt_tokens(
|
||||
"header.e30.signature",
|
||||
"account-123",
|
||||
Some("plus"),
|
||||
)?)
|
||||
.with_auth(CodexAuth::from_api_key("Test API Key"))
|
||||
.with_pre_build_hook(move |home| {
|
||||
let config = if use_model_defaults {
|
||||
"[features.context_management]\nexperimental_mode = false\n".to_string()
|
||||
@@ -557,7 +490,6 @@ async fn token_budget_explicit_default_template_overrides_model_defaults() -> Re
|
||||
}
|
||||
|
||||
#[test_case(Feature::TokenBudget; "explicit_activation")]
|
||||
#[test_case(Feature::ContextManagement; "experimental_activation")]
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||
async fn token_budget_defaults_follow_the_active_model(activation: Feature) -> Result<()> {
|
||||
skip_if_no_network!(Ok(()));
|
||||
@@ -570,11 +502,7 @@ async fn token_budget_defaults_follow_the_active_model(activation: Feature) -> R
|
||||
.await;
|
||||
let backend_url = format!("{}/backend-api/codex", server.uri());
|
||||
let test = test_codex()
|
||||
.with_auth(CodexAuth::from_external_chatgpt_tokens(
|
||||
"header.e30.signature",
|
||||
"account-123",
|
||||
Some("plus"),
|
||||
)?)
|
||||
.with_auth(CodexAuth::from_api_key("Test API Key"))
|
||||
.with_model_info_override("gpt-5.2", |model_info| {
|
||||
model_info.supports_experimental_context = true;
|
||||
let mut defaults = model_token_budget_config();
|
||||
|
||||
Reference in New Issue
Block a user