feat(codex): align Search and execution protocol

This commit is contained in:
MMEXA
2026-07-12 03:04:15 +08:00
parent 59d37ae1dd
commit 2316df5c9a
121 changed files with 5141 additions and 543 deletions
@@ -1115,10 +1115,9 @@ fn normalize_api_format_alias(value: &str) -> String {
fn auth_gate_api_format(auth_endpoint_signature: &str) -> String {
let normalized = normalize_api_format_alias(auth_endpoint_signature);
if normalized == "antigravity:v1internal" {
"gemini:generate_content".to_string()
} else {
normalized
match normalized.as_str() {
"antigravity:v1internal" => "gemini:generate_content".to_string(),
_ => normalized,
}
}
@@ -54,6 +54,14 @@ pub(super) fn classify_ai_public_route(
true,
))
}
} else if method == http::Method::POST && normalized_path == "/v1/alpha/search" {
Some(classified(
"ai_public",
"openai",
"search",
"openai:search",
true,
))
} else if method == http::Method::POST
&& matches!(
normalized_path,
@@ -56,6 +56,28 @@ fn classifies_openai_rerank_as_rerank_not_chat() {
assert!(decision.is_execution_runtime_candidate());
}
#[test]
fn classifies_openai_search_as_its_own_sync_endpoint() {
let headers = headers(&[("authorization", "Bearer sk-test")]);
let uri: Uri = "/v1/alpha/search".parse().expect("uri should parse");
let decision =
classify_control_route(&http::Method::POST, &uri, &headers).expect("route should classify");
assert_eq!(decision.route_family.as_deref(), Some("openai"));
assert_eq!(decision.route_kind.as_deref(), Some("search"));
assert_eq!(
decision.auth_endpoint_signature.as_deref(),
Some("openai:search")
);
assert!(decision.is_execution_runtime_candidate());
assert!(classify_control_route(&http::Method::GET, &uri, &headers).is_none());
let upstream_uri: Uri = "/backend-api/codex/alpha/search"
.parse()
.expect("uri should parse");
assert!(classify_control_route(&http::Method::POST, &upstream_uri, &headers).is_none());
}
#[test]
fn classifies_openai_chat_and_responses_separately_from_embedding() {
let headers = headers(&[("authorization", "Bearer sk-test")]);