mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
Route Guardian requests through /responses with identifying headers (#45736)
## What changed - Replace dedicated Guardian endpoints with `/responses`, sending `x-codex-guardian: reviewer` or `x-codex-guardian: classifier` for eligible Codex backend requests over HTTP and WebSocket. - Add model-scoped thread headers, recheck backend authentication on each request attempt, and reconnect WebSockets when the applicable headers change. - Retain `features.guardianv2.free_guardian` for configuration compatibility while removing its routing gate; the backend now controls Guardian billing. ## Testing Update tests for reviewer and classifier headers, model and authentication scoping, HTTP fallback, WebSocket reuse, and parent-response metadata across retries. GitOrigin-RevId: 1c2b3c458ab77fb40aae4ee6784f6d827c60e76c
This commit is contained in:
1 parent
d4e11a9b97
commit
eeded5ba1a
22 files changed
+246
-286
No files matched your search
@@ -0,0 +1,24 @@
|
||||
//! Header overrides for host-created threads on the Codex Responses endpoint.
|
||||
//! Headers are scoped to a model and rechecked against current auth on each attempt.
|
||||
|
||||
use http::HeaderMap;
|
||||
|
||||
/// Seed in `StartThreadOptions::thread_extension_init` to supply Responses headers.
|
||||
///
|
||||
/// Applied only to the selected model with Codex backend auth and routing. The headers
|
||||
/// are sent on HTTP requests and WebSocket handshakes; changes require a new socket.
|
||||
/// Other provider endpoints and unrelated threads do not inherit these headers.
|
||||
#[derive(Clone)]
|
||||
pub struct CodexResponsesHeaders {
|
||||
pub model: String,
|
||||
pub headers: HeaderMap,
|
||||
}
|
||||
|
||||
impl std::fmt::Debug for CodexResponsesHeaders {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
f.debug_struct("CodexResponsesHeaders")
|
||||
.field("model", &self.model)
|
||||
.field("header_names", &self.headers.keys())
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user