This commit is contained in:
Ruslan Nigmatullin
2026-03-25 17:54:19 -07:00
parent 685d77d2c1
commit 82be4e88b0
17 changed files with 19 additions and 253 deletions
@@ -6474,17 +6474,6 @@
"default": {},
"type": "object"
},
"remote_control": {
"anyOf": [
{
"$ref": "#/definitions/v2/RemoteControlConfig"
},
{
"type": "null"
}
],
"default": null
},
"review_model": {
"type": [
"string",
@@ -10410,17 +10399,6 @@
"title": "ReasoningTextDeltaNotification",
"type": "object"
},
"RemoteControlConfig": {
"properties": {
"base_url": {
"type": "string"
}
},
"required": [
"base_url"
],
"type": "object"
},
"RequestId": {
"anyOf": [
{
@@ -3034,17 +3034,6 @@
"default": {},
"type": "object"
},
"remote_control": {
"anyOf": [
{
"$ref": "#/definitions/RemoteControlConfig"
},
{
"type": "null"
}
],
"default": null
},
"review_model": {
"type": [
"string",
@@ -7125,17 +7114,6 @@
"title": "ReasoningTextDeltaNotification",
"type": "object"
},
"RemoteControlConfig": {
"properties": {
"base_url": {
"type": "string"
}
},
"required": [
"base_url"
],
"type": "object"
},
"RequestId": {
"anyOf": [
{
@@ -324,17 +324,6 @@
"default": {},
"type": "object"
},
"remote_control": {
"anyOf": [
{
"$ref": "#/definitions/RemoteControlConfig"
},
{
"type": "null"
}
],
"default": null
},
"review_model": {
"type": [
"string",
@@ -732,17 +721,6 @@
}
]
},
"RemoteControlConfig": {
"properties": {
"base_url": {
"type": "string"
}
},
"required": [
"base_url"
],
"type": "object"
},
"SandboxMode": {
"enum": [
"read-only",
@@ -12,7 +12,6 @@ import type { AnalyticsConfig } from "./AnalyticsConfig";
import type { ApprovalsReviewer } from "./ApprovalsReviewer";
import type { AskForApproval } from "./AskForApproval";
import type { ProfileV2 } from "./ProfileV2";
import type { RemoteControlConfig } from "./RemoteControlConfig";
import type { SandboxMode } from "./SandboxMode";
import type { SandboxWorkspaceWrite } from "./SandboxWorkspaceWrite";
import type { ToolsV2 } from "./ToolsV2";
@@ -21,4 +20,4 @@ export type Config = {model: string | null, review_model: string | null, model_c
* [UNSTABLE] Optional default for where approval requests are routed for
* review.
*/
approvals_reviewer: ApprovalsReviewer | null, sandbox_mode: SandboxMode | null, sandbox_workspace_write: SandboxWorkspaceWrite | null, forced_chatgpt_workspace_id: string | null, forced_login_method: ForcedLoginMethod | null, web_search: WebSearchMode | null, tools: ToolsV2 | null, profile: string | null, profiles: { [key in string]?: ProfileV2 }, instructions: string | null, developer_instructions: string | null, compact_prompt: string | null, model_reasoning_effort: ReasoningEffort | null, model_reasoning_summary: ReasoningSummary | null, model_verbosity: Verbosity | null, service_tier: ServiceTier | null, analytics: AnalyticsConfig | null, remote_control: RemoteControlConfig | null} & ({ [key in string]?: number | string | boolean | Array<JsonValue> | { [key in string]?: JsonValue } | null });
approvals_reviewer: ApprovalsReviewer | null, sandbox_mode: SandboxMode | null, sandbox_workspace_write: SandboxWorkspaceWrite | null, forced_chatgpt_workspace_id: string | null, forced_login_method: ForcedLoginMethod | null, web_search: WebSearchMode | null, tools: ToolsV2 | null, profile: string | null, profiles: { [key in string]?: ProfileV2 }, instructions: string | null, developer_instructions: string | null, compact_prompt: string | null, model_reasoning_effort: ReasoningEffort | null, model_reasoning_summary: ReasoningSummary | null, model_verbosity: Verbosity | null, service_tier: ServiceTier | null, analytics: AnalyticsConfig | null} & ({ [key in string]?: number | string | boolean | Array<JsonValue> | { [key in string]?: JsonValue } | null });
@@ -1,5 +0,0 @@
// GENERATED CODE! DO NOT MODIFY BY HAND!
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type RemoteControlConfig = { base_url: string, };
@@ -234,7 +234,6 @@ export type { ReasoningEffortOption } from "./ReasoningEffortOption";
export type { ReasoningSummaryPartAddedNotification } from "./ReasoningSummaryPartAddedNotification";
export type { ReasoningSummaryTextDeltaNotification } from "./ReasoningSummaryTextDeltaNotification";
export type { ReasoningTextDeltaNotification } from "./ReasoningTextDeltaNotification";
export type { RemoteControlConfig } from "./RemoteControlConfig";
export type { RequestPermissionProfile } from "./RequestPermissionProfile";
export type { ResidencyRequirement } from "./ResidencyRequirement";
export type { ReviewDelivery } from "./ReviewDelivery";
@@ -708,13 +708,6 @@ pub struct AppsConfig {
pub apps: HashMap<String, AppConfig>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
#[serde(rename_all = "snake_case")]
#[ts(export_to = "v2/")]
pub struct RemoteControlConfig {
pub base_url: String,
}
const fn default_enabled() -> bool {
true
}
@@ -759,9 +752,6 @@ pub struct Config {
#[experimental("config/read.apps")]
#[serde(default)]
pub apps: Option<AppsConfig>,
#[experimental("config/read.remote_control")]
#[serde(default)]
pub remote_control: Option<RemoteControlConfig>,
#[serde(default, flatten)]
pub additional: HashMap<String, JsonValue>,
}
@@ -7093,7 +7083,6 @@ mod tests {
service_tier: None,
analytics: None,
apps: None,
remote_control: None,
additional: HashMap::new(),
});
@@ -7127,7 +7116,6 @@ mod tests {
service_tier: None,
analytics: None,
apps: None,
remote_control: None,
additional: HashMap::new(),
});
@@ -7183,7 +7171,6 @@ mod tests {
service_tier: None,
analytics: None,
apps: None,
remote_control: None,
additional: HashMap::new(),
});
@@ -7233,7 +7220,6 @@ mod tests {
service_tier: None,
analytics: None,
apps: None,
remote_control: None,
additional: HashMap::new(),
});
+2 -3
View File
@@ -7,11 +7,10 @@ For remote-control-only deployments, use `codexd`. It runs the same app-server r
Remote control is configured in `~/.codex/config.toml`:
```toml
chatgpt_base_url = "https://chatgpt.com/backend-api/"
[features]
remote_control = true
[remote_control]
base_url = "https://chatgpt.com/backend-api/"
```
## Table of Contents
+1 -2
View File
@@ -590,11 +590,10 @@ pub async fn run_main_with_transport(
);
auth_manager.set_forced_chatgpt_workspace_id(config.forced_chatgpt_workspace_id.clone());
let remote_control_config = config.remote_control.clone();
if config.features.enabled(Feature::RemoteControl) {
validate_remote_control_auth(auth_manager.as_ref()).await?;
let accept_handle = start_remote_control(
remote_control_config.base_url,
config.chatgpt_base_url.clone(),
state_db.clone(),
auth_manager.clone(),
transport_event_tx.clone(),
@@ -160,7 +160,7 @@ mod tests {
RemoteControlTarget {
websocket_url: "ws://example.com/backend-api/wham/remote/control/server"
.to_string(),
enroll_url: "http://example.com/backend-api/remote/control/server/enroll"
enroll_url: "http://example.com/backend-api/wham/remote/control/server/enroll"
.to_string(),
}
);
@@ -170,7 +170,7 @@ mod tests {
RemoteControlTarget {
websocket_url: "wss://example.com/backend-api/wham/remote/control/server"
.to_string(),
enroll_url: "https://example.com/backend-api/remote/control/server/enroll"
enroll_url: "https://example.com/backend-api/wham/remote/control/server/enroll"
.to_string(),
}
);
@@ -999,7 +999,7 @@ async fn remote_control_transport_manages_virtual_clients_and_routes_messages()
let enroll_request = accept_http_request(&listener).await;
assert_eq!(
enroll_request.request_line,
"POST /backend-api/remote/control/server/enroll HTTP/1.1"
"POST /backend-api/wham/remote/control/server/enroll HTTP/1.1"
);
respond_with_json(enroll_request.stream, json!({ "server_id": "srv_e_test" })).await;
let mut websocket = accept_remote_control_connection(&listener).await;
@@ -1254,7 +1254,7 @@ async fn remote_control_transport_reconnects_after_disconnect() {
let enroll_request = accept_http_request(&listener).await;
assert_eq!(
enroll_request.request_line,
"POST /backend-api/remote/control/server/enroll HTTP/1.1"
"POST /backend-api/wham/remote/control/server/enroll HTTP/1.1"
);
respond_with_json(enroll_request.stream, json!({ "server_id": "srv_e_test" })).await;
let mut first_websocket = accept_remote_control_connection(&listener).await;
@@ -1330,7 +1330,7 @@ async fn remote_control_http_mode_enrolls_before_connecting() {
let enroll_request = accept_http_request(&listener).await;
assert_eq!(
enroll_request.request_line,
"POST /backend-api/remote/control/server/enroll HTTP/1.1"
"POST /backend-api/wham/remote/control/server/enroll HTTP/1.1"
);
assert_eq!(
enroll_request.headers.get("authorization"),
@@ -1535,7 +1535,7 @@ async fn enroll_remote_control_server_parse_failure_includes_response_body() {
assert_eq!(
err.to_string(),
format!(
"failed to parse remote control enrollment response from `{enroll_url}`: HTTP 200 OK, body: {expected_body}, decode error: missing field `server_id` at line 1 column {}",
"failed to parse remote control enrollment response from `{enroll_url}`: HTTP 200 OK, headers: {{connection: close, content-length: 24, content-type: application/json}}, body: {expected_body}, decode error: missing field `server_id` at line 1 column {}",
expected_body.len()
)
);
@@ -1665,7 +1665,7 @@ async fn remote_control_http_mode_clears_stale_persisted_enrollment_after_404()
let enroll_request = accept_http_request(&listener).await;
assert_eq!(
enroll_request.request_line,
"POST /backend-api/remote/control/server/enroll HTTP/1.1"
"POST /backend-api/wham/remote/control/server/enroll HTTP/1.1"
);
respond_with_json(
enroll_request.stream,
@@ -123,6 +123,7 @@ pub(super) async fn run_remote_control_websocket_loop(
continue;
}
};
info!("YOLO sending to codex backend: {payload}");
if websocket_writer
.send(tungstenite::Message::Text(payload.into()))
.await
@@ -145,6 +146,7 @@ pub(super) async fn run_remote_control_websocket_loop(
continue;
}
};
info!("YOLO sending to codex backend: {payload}");
if websocket_writer
.send(tungstenite::Message::Text(payload.into()))
.await
@@ -92,16 +92,15 @@ sandbox_mode = "workspace-write"
}
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn config_read_includes_remote_control_config() -> Result<()> {
async fn config_read_includes_chatgpt_base_url() -> Result<()> {
let codex_home = TempDir::new()?;
write_config(
&codex_home,
r#"
chatgpt_base_url = "https://example.com/backend-api/"
[features]
remote_control = true
[remote_control]
base_url = "https://example.com/remote-control"
"#,
)?;
write_chatgpt_auth(
@@ -132,13 +131,12 @@ base_url = "https://example.com/remote-control"
layers,
} = to_response(resp)?;
let remote_control = config.remote_control.expect("remote control config");
assert_eq!(
remote_control.base_url,
"https://example.com/remote-control"
config.additional.get("chatgpt_base_url"),
Some(&json!("https://example.com/backend-api/"))
);
assert_eq!(
origins.get("remote_control.base_url").expect("origin").name,
origins.get("chatgpt_base_url").expect("origin").name,
ConfigLayerSource::User {
file: user_file.clone(),
}
-21
View File
@@ -1423,18 +1423,6 @@
}
]
},
"RemoteControlConfigToml": {
"additionalProperties": false,
"description": "Remote control settings loaded from config.toml.",
"properties": {
"base_url": {
"default": "https://chatgpt.com/backend-api/",
"description": "Base URL for the remote control server.",
"type": "string"
}
},
"type": "object"
},
"SandboxMode": {
"enum": [
"read-only",
@@ -2438,15 +2426,6 @@
"default": null,
"description": "Experimental / do not use. Realtime websocket session selection. `version` controls v1/v2 and `type` controls conversational/transcription."
},
"remote_control": {
"allOf": [
{
"$ref": "#/definitions/RemoteControlConfigToml"
}
],
"default": null,
"description": "Remote control daemon settings for app-server."
},
"review_model": {
"description": "Review model override used by the `/review` feature.",
"type": "string"
-70
View File
@@ -11,8 +11,6 @@ use crate::config::types::MemoriesToml;
use crate::config::types::ModelAvailabilityNuxConfig;
use crate::config::types::NotificationMethod;
use crate::config::types::Notifications;
use crate::config::types::RemoteControlConfig;
use crate::config::types::RemoteControlConfigToml;
use crate::config::types::ToolSuggestDiscoverableType;
use crate::config_loader::RequirementSource;
use assert_matches::assert_matches;
@@ -4345,7 +4343,6 @@ fn test_precedence_fixture_with_o3_profile() -> std::io::Result<()> {
realtime: RealtimeConfig::default(),
experimental_realtime_ws_backend_prompt: None,
experimental_realtime_ws_startup_context: None,
remote_control: RemoteControlConfig::default(),
base_instructions: None,
developer_instructions: None,
guardian_developer_instructions: None,
@@ -4489,7 +4486,6 @@ fn test_precedence_fixture_with_gpt3_profile() -> std::io::Result<()> {
realtime: RealtimeConfig::default(),
experimental_realtime_ws_backend_prompt: None,
experimental_realtime_ws_startup_context: None,
remote_control: RemoteControlConfig::default(),
base_instructions: None,
developer_instructions: None,
guardian_developer_instructions: None,
@@ -4631,7 +4627,6 @@ fn test_precedence_fixture_with_zdr_profile() -> std::io::Result<()> {
realtime: RealtimeConfig::default(),
experimental_realtime_ws_backend_prompt: None,
experimental_realtime_ws_startup_context: None,
remote_control: RemoteControlConfig::default(),
base_instructions: None,
developer_instructions: None,
guardian_developer_instructions: None,
@@ -4759,7 +4754,6 @@ fn test_precedence_fixture_with_gpt5_profile() -> std::io::Result<()> {
realtime: RealtimeConfig::default(),
experimental_realtime_ws_backend_prompt: None,
experimental_realtime_ws_startup_context: None,
remote_control: RemoteControlConfig::default(),
base_instructions: None,
developer_instructions: None,
guardian_developer_instructions: None,
@@ -6082,70 +6076,6 @@ experimental_realtime_ws_startup_context = "startup context from config"
Ok(())
}
#[test]
fn remote_control_config_loads_from_config_toml() -> std::io::Result<()> {
let cfg: ConfigToml = toml::from_str(
r#"
[features]
remote_control = true
[remote_control]
base_url = "https://example.com/remote-control"
"#,
)
.expect("TOML deserialization should succeed");
assert_eq!(
cfg.remote_control,
Some(RemoteControlConfigToml {
base_url: "https://example.com/remote-control".to_string(),
})
);
let codex_home = TempDir::new()?;
let config = Config::load_from_base_config_with_overrides(
cfg,
ConfigOverrides::default(),
codex_home.path().to_path_buf(),
)?;
assert_eq!(
config.remote_control,
RemoteControlConfig {
base_url: "https://example.com/remote-control".to_string(),
}
);
assert!(config.features.enabled(Feature::RemoteControl));
Ok(())
}
#[test]
fn remote_control_config_uses_defaults() -> std::io::Result<()> {
let cfg: ConfigToml = toml::from_str(
r#"
[remote_control]
"#,
)
.expect("TOML deserialization should succeed");
assert_eq!(
cfg.remote_control,
Some(RemoteControlConfigToml {
base_url: "https://chatgpt.com/backend-api/".to_string(),
})
);
let codex_home = TempDir::new()?;
let config = Config::load_from_base_config_with_overrides(
ConfigToml::default(),
ConfigOverrides::default(),
codex_home.path().to_path_buf(),
)?;
assert_eq!(config.remote_control, RemoteControlConfig::default());
Ok(())
}
#[test]
fn experimental_realtime_ws_model_loads_from_config_toml() -> std::io::Result<()> {
let cfg: ConfigToml = toml::from_str(
-10
View File
@@ -17,8 +17,6 @@ use crate::config::types::OtelConfig;
use crate::config::types::OtelConfigToml;
use crate::config::types::OtelExporterKind;
use crate::config::types::PluginConfig;
use crate::config::types::RemoteControlConfig;
use crate::config::types::RemoteControlConfigToml;
use crate::config::types::SandboxWorkspaceWrite;
use crate::config::types::ShellEnvironmentPolicy;
use crate::config::types::ShellEnvironmentPolicyToml;
@@ -558,8 +556,6 @@ pub struct Config {
/// instructions inserted into developer messages when realtime becomes
/// active.
pub experimental_realtime_start_instructions: Option<String>,
/// Remote control daemon settings for app-server.
pub remote_control: RemoteControlConfig,
/// When set, restricts ChatGPT login to a specific workspace identifier.
pub forced_chatgpt_workspace_id: Option<String>,
@@ -1355,9 +1351,6 @@ pub struct ConfigToml {
/// instructions inserted into developer messages when realtime becomes
/// active.
pub experimental_realtime_start_instructions: Option<String>,
/// Remote control daemon settings for app-server.
#[serde(default)]
pub remote_control: Option<RemoteControlConfigToml>,
pub projects: Option<HashMap<String, ProjectConfig>>,
/// Controls the web search tool mode: disabled, cached, or live.
@@ -2703,9 +2696,6 @@ impl Config {
experimental_realtime_ws_backend_prompt: cfg.experimental_realtime_ws_backend_prompt,
experimental_realtime_ws_startup_context: cfg.experimental_realtime_ws_startup_context,
experimental_realtime_start_instructions: cfg.experimental_realtime_start_instructions,
remote_control: cfg
.remote_control
.map_or_else(RemoteControlConfig::default, RemoteControlConfig::from),
forced_chatgpt_workspace_id,
forced_login_method,
include_apply_patch_tool: include_apply_patch_tool_flag,
-44
View File
@@ -30,7 +30,6 @@ pub const DEFAULT_MEMORIES_MAX_ROLLOUT_AGE_DAYS: i64 = 30;
pub const DEFAULT_MEMORIES_MIN_ROLLOUT_IDLE_HOURS: i64 = 6;
pub const DEFAULT_MEMORIES_MAX_RAW_MEMORIES_FOR_CONSOLIDATION: usize = 256;
pub const DEFAULT_MEMORIES_MAX_UNUSED_DAYS: i64 = 30;
pub const DEFAULT_REMOTE_CONTROL_BASE_URL: &str = "https://chatgpt.com/backend-api/";
#[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq, JsonSchema)]
#[serde(rename_all = "kebab-case")]
@@ -488,49 +487,6 @@ impl From<MemoriesToml> for MemoriesConfig {
}
}
fn default_remote_control_base_url() -> String {
DEFAULT_REMOTE_CONTROL_BASE_URL.to_string()
}
/// Remote control settings loaded from config.toml.
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema)]
#[schemars(deny_unknown_fields)]
pub struct RemoteControlConfigToml {
/// Base URL for the remote control server.
#[serde(default = "default_remote_control_base_url")]
pub base_url: String,
}
impl Default for RemoteControlConfigToml {
fn default() -> Self {
Self {
base_url: default_remote_control_base_url(),
}
}
}
/// Effective remote control settings after defaults are applied.
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct RemoteControlConfig {
pub base_url: String,
}
impl Default for RemoteControlConfig {
fn default() -> Self {
Self {
base_url: default_remote_control_base_url(),
}
}
}
impl From<RemoteControlConfigToml> for RemoteControlConfig {
fn from(toml: RemoteControlConfigToml) -> Self {
Self {
base_url: toml.base_url,
}
}
}
#[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq, Default, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum AppToolApproval {