Add generic plugin backend bridge

This commit is contained in:
alandelong-oai
2026-04-29 12:32:30 -04:00
parent 1c420a90cd
commit f39ffdb6cb
9 changed files with 846 additions and 1 deletions
+26
View File
@@ -1729,6 +1729,24 @@
],
"type": "string"
},
"PluginBackendBridgeConfigToml": {
"additionalProperties": false,
"properties": {
"backend_path_prefix": {
"description": "Authenticated ChatGPT backend path prefix that receives forwarded requests.",
"type": "string"
},
"local_path_prefix": {
"description": "Path prefix exposed on the loopback bridge listener.",
"type": "string"
}
},
"required": [
"backend_path_prefix",
"local_path_prefix"
],
"type": "object"
},
"PluginConfig": {
"additionalProperties": false,
"properties": {
@@ -3761,6 +3779,14 @@
"plan_mode_reasoning_effort": {
"$ref": "#/definitions/ReasoningEffort"
},
"plugin_backend_bridges": {
"additionalProperties": {
"$ref": "#/definitions/PluginBackendBridgeConfigToml"
},
"default": {},
"description": "Named loopback bridges that let trusted local plugins call scoped authenticated ChatGPT backend subtrees without receiving user credentials directly.",
"type": "object"
},
"plugins": {
"additionalProperties": {
"$ref": "#/definitions/PluginConfig"
+4
View File
@@ -5907,6 +5907,7 @@ async fn test_precedence_fixture_with_o3_profile() -> std::io::Result<()> {
cwd: fixture.cwd(),
cli_auth_credentials_store_mode: Default::default(),
mcp_servers: Constrained::allow_any(HashMap::new()),
plugin_backend_bridges: HashMap::new(),
mcp_oauth_credentials_store_mode: resolve_mcp_oauth_credentials_store_mode(
Default::default(),
LOCAL_DEV_BUILD_VERSION,
@@ -6101,6 +6102,7 @@ async fn test_precedence_fixture_with_gpt3_profile() -> std::io::Result<()> {
cwd: fixture.cwd(),
cli_auth_credentials_store_mode: Default::default(),
mcp_servers: Constrained::allow_any(HashMap::new()),
plugin_backend_bridges: HashMap::new(),
mcp_oauth_credentials_store_mode: resolve_mcp_oauth_credentials_store_mode(
Default::default(),
LOCAL_DEV_BUILD_VERSION,
@@ -6249,6 +6251,7 @@ async fn test_precedence_fixture_with_zdr_profile() -> std::io::Result<()> {
cwd: fixture.cwd(),
cli_auth_credentials_store_mode: Default::default(),
mcp_servers: Constrained::allow_any(HashMap::new()),
plugin_backend_bridges: HashMap::new(),
mcp_oauth_credentials_store_mode: resolve_mcp_oauth_credentials_store_mode(
Default::default(),
LOCAL_DEV_BUILD_VERSION,
@@ -6382,6 +6385,7 @@ async fn test_precedence_fixture_with_gpt5_profile() -> std::io::Result<()> {
cwd: fixture.cwd(),
cli_auth_credentials_store_mode: Default::default(),
mcp_servers: Constrained::allow_any(HashMap::new()),
plugin_backend_bridges: HashMap::new(),
mcp_oauth_credentials_store_mode: resolve_mcp_oauth_credentials_store_mode(
Default::default(),
LOCAL_DEV_BUILD_VERSION,
+6
View File
@@ -23,6 +23,7 @@ use codex_config::SandboxModeRequirement;
use codex_config::Sourced;
use codex_config::ThreadConfigLoader;
use codex_config::config_toml::ConfigToml;
use codex_config::config_toml::PluginBackendBridgeConfigToml;
use codex_config::config_toml::ProjectConfig;
use codex_config::config_toml::RealtimeAudioConfig;
use codex_config::config_toml::RealtimeConfig;
@@ -529,6 +530,10 @@ pub struct Config {
/// Definition for MCP servers that Codex can reach out to for tool calls.
pub mcp_servers: Constrained<HashMap<String, McpServerConfig>>,
/// Named loopback bridges that let trusted local plugins call scoped authenticated
/// ChatGPT backend subtrees without receiving user credentials directly.
pub plugin_backend_bridges: HashMap<String, PluginBackendBridgeConfigToml>,
/// Preferred store for MCP OAuth credentials.
/// keyring: Use an OS-specific keyring service.
/// Credentials stored in the keyring will only be readable by Codex unless the user explicitly grants access via OS-level keyring access.
@@ -2674,6 +2679,7 @@ impl Config {
env!("CARGO_PKG_VERSION"),
),
mcp_servers,
plugin_backend_bridges: cfg.plugin_backend_bridges.clone(),
// The config.toml omits "_mode" because it's a config file. However, "_mode"
// is important in code to differentiate the mode from the store implementation.
mcp_oauth_credentials_store_mode: resolve_mcp_oauth_credentials_store_mode(