mirror of
https://github.com/openai/codex.git
synced 2026-11-10 08:43:33 +00:00
Route Guardian inference through dedicated endpoints (#40892)
## What changed - Add the opt-in `features.guardianv2.free_guardian` setting to route eligible Guardian reviews to `/guardian` and asynchronous classifications to `/guardian-classifier`. - Support endpoint selection for both HTTP and WebSocket Responses clients, including endpoint-aware connection reuse. - Keep `/responses` for API-key authentication, custom provider URLs, non-Guardian models, and configurations where the option is disabled. - Omit routing hints and `service_tier` from requests sent to the dedicated Guardian endpoints. ## Testing - Cover route selection across authentication modes, provider URLs, HTTP fallback, WebSocket review sessions, and classifier sampling. GitOrigin-RevId: 9c88673c710d009e0239559b9245a4e6c4f4befc
This commit is contained in:
1 parent
10d5a603ae
commit
62fb56ee56
22 files changed
+488
-87
No files matched your search
@@ -1490,6 +1490,17 @@ impl Config {
|
||||
&self.sqlite
|
||||
}
|
||||
|
||||
/// Whether Guardian may use the unmetered Codex inference endpoints.
|
||||
pub fn free_guardian_enabled(&self) -> bool {
|
||||
self.config_layer_stack
|
||||
.effective_config()
|
||||
.get("features")
|
||||
.and_then(|features| features.get("guardianv2"))
|
||||
.and_then(|guardian| guardian.get("free_guardian"))
|
||||
.and_then(toml::Value::as_bool)
|
||||
.unwrap_or(false)
|
||||
}
|
||||
|
||||
/// Resolves the configured, reviewer-catalog, or bundled Guardian policy.
|
||||
pub fn resolve_guardian_policy<'a>(
|
||||
&'a self,
|
||||
|
||||
Reference in new issue
Block a user