Lightweight coding agent that runs in your terminal
Rust
[app-server] Add a method to override feature flags. (#15601)
Matthew Zeng0b08d893042b
diff --git a/codex-rs/app-server-protocol/schema/json/ClientRequest.json b/codex-rs/app-server-protocol/schema/json/ClientRequest.jsonindex e245c17954..9227a97d55 100644--- a/codex-rs/app-server-protocol/schema/json/ClientRequest.json+++ b/codex-rs/app-server-protocol/schema/json/ClientRequest.json@@ -524,6 +524,21 @@],"type": "object"},+ "ExperimentalFeatureEnablementSetParams": {+ "properties": {+ "enablement": {+ "additionalProperties": {+ "type": "boolean"+ },+ "description": "Process-wide runtime feature enablement keyed by canonical feature name.\n\nOnly named features are updated. Omitted features are left unchanged. Send an empty map for a no-op.",+ "type": "object"+ }+ },+ "required": [+ "enablement"+ ],+ "type": "object"+ },"ExperimentalFeatureListParams": {"properties": {"cursor": {@@ -4294,6 +4309,30 @@"title": "ExperimentalFeature/listRequest","type": "object"},+ {+ "properties": {+ "id": {+ "$ref": "#/definitions/RequestId"+ },+ "method": {+ "enum": [+ "experimentalFeature/enablement/set"+ ],+ "title": "ExperimentalFeature/enablement/setRequestMethod",+ "type": "string"+ },+ "params": {+ "$ref": "#/definitions/ExperimentalFeatureEnablementSetParams"+ }+ },+ "required": [+ "id",+ "method",+ "params"+ ],+ "title": "ExperimentalFeature/enablement/setRequest",+ "type": "object"+ },{"properties": {"id": {diff --git a/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.schemas.json b/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.schemas.jsonindex ad79d0987e..d4269f5239 100644--- a/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.schemas.json+++ b/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.schemas.json@@ -1151,6 +1151,30 @@"title": "ExperimentalFeature/listRequest","type": "object"},+ {+ "properties": {+ "id": {+ "$ref": "#/definitions/v2/RequestId"+ },+ "method": {+ "enum": [+ "experimentalFeature/enablement/set"+ ],+ "title": "ExperimentalFeature/enablement/setRequestMethod",+ "type": "string"+ },+ "params": {+ "$ref": "#/definitions/v2/ExperimentalFeatureEnablementSetParams"+ }+ },+ "required": [+ "id",+ "method",+ "params"+ ],+ "title": "ExperimentalFeature/enablement/setRequest",+ "type": "object"+ },{"properties": {"id": {@@ -7249,6 +7273,40 @@],"type": "object"},+ "ExperimentalFeatureEnablementSetParams": {+ "$schema": "http://json-schema.org/draft-07/schema#",+ "properties": {+ "enablement": {+ "additionalProperties": {+ "type": "boolean"+ },+ "description": "Process-wide runtime feature enablement keyed by canonical feature name.\n\nOnly named features are updated. Omitted features are left unchanged. Send an empty map for a no-op.",+ "type": "object"+ }+ },+ "required": [+ "enablement"+ ],+ "title": "ExperimentalFeatureEnablementSetParams",+ "type": "object"+ },+ "ExperimentalFeatureEnablementSetResponse": {+ "$schema": "http://json-schema.org/draft-07/schema#",+ "properties": {+ "enablement": {+ "additionalProperties": {+ "type": "boolean"+ },+ "description": "Feature enablement entries updated by this request.",+ "type": "object"+ }+ },+ "required": [+ "enablement"+ ],+ "title": "ExperimentalFeatureEnablementSetResponse",+ "type": "object"+ },"ExperimentalFeatureListParams": {"$schema": "http://json-schema.org/draft-07/schema#","properties": {diff --git a/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.v2.schemas.json b/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.v2.schemas.jsonindex 30bb2efb22..acf36d6c3c 100644--- a/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.v2.schemas.json+++ b/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.v2.schemas.json@@ -1681,6 +1681,30 @@"title": "ExperimentalFeature/listRequest","type": "object"},+ {+ "properties": {+ "id": {+ "$ref": "#/definitions/RequestId"+ },+ "method": {+ "enum": [+ "experimentalFeature/enablement/set"+ ],+ "title": "ExperimentalFeature/enablement/setRequestMethod",+ "type": "string"+ },+ "params": {+ "$ref": "#/definitions/ExperimentalFeatureEnablementSetParams"+ }+ },+ "required": [+ "id",+ "method",+ "params"+ ],+ "title": "ExperimentalFeature/enablement/setRequest",+ "type": "object"+ },{"properties": {"id": {@@ -3809,6 +3833,40 @@],"type": "object"},+ "ExperimentalFeatureEnablementSetParams": {+ "$schema": "http://json-schema.org/draft-07/schema#",+ "properties": {+ "enablement": {+ "additionalProperties": {+ "type": "boolean"+ },+ "description": "Process-wide runtime feature enablement keyed by canonical feature name.\n\nOnly named features are updated. Omitted features are left unchanged. Send an empty map for a no-op.",+ "type": "object"+ }+ },+ "required": [+ "enablement"+ ],+ "title": "ExperimentalFeatureEnablementSetParams",+ "type": "object"+ },+ "ExperimentalFeatureEnablementSetResponse": {+ "$schema": "http://json-schema.org/draft-07/schema#",+ "properties": {+ "enablement": {+ "additionalProperties": {+ "type": "boolean"+ },+ "description": "Feature enablement entries updated by this request.",+ "type": "object"+ }+ },+ "required": [+ "enablement"+ ],+ "title": "ExperimentalFeatureEnablementSetResponse",+ "type": "object"+ },"ExperimentalFeatureListParams": {"$schema": "http://json-schema.org/draft-07/schema#","properties": {diff --git a/codex-rs/app-server-protocol/schema/json/v2/ExperimentalFeatureEnablementSetParams.json b/codex-rs/app-server-protocol/schema/json/v2/ExperimentalFeatureEnablementSetParams.jsonnew file mode 100644index 0000000000..9d6bcec932--- /dev/null+++ b/codex-rs/app-server-protocol/schema/json/v2/ExperimentalFeatureEnablementSetParams.json@@ -0,0 +1,17 @@+{+ "$schema": "http://json-schema.org/draft-07/schema#",+ "properties": {+ "enablement": {+ "additionalProperties": {+ "type": "boolean"+ },+ "description": "Process-wide runtime feature enablement keyed by canonical feature name.\n\nOnly named features are updated. Omitted features are left unchanged. Send an empty map for a no-op.",+ "type": "object"+ }+ },+ "required": [+ "enablement"+ ],+ "title": "ExperimentalFeatureEnablementSetParams",+ "type": "object"+}\ No newline at end of filediff --git a/codex-rs/app-server-protocol/schema/json/v2/ExperimentalFeatureEnablementSetResponse.json b/codex-rs/app-server-protocol/schema/json/v2/ExperimentalFeatureEnablementSetResponse.jsonnew file mode 100644index 0000000000..9cdbf0691f--- /dev/null+++ b/codex-rs/app-server-protocol/schema/json/v2/ExperimentalFeatureEnablementSetResponse.json@@ -0,0 +1,17 @@+{+ "$schema": "http://json-schema.org/draft-07/schema#",+ "properties": {+ "enablement": {+ "additionalProperties": {+ "type": "boolean"+ },+ "description": "Feature enablement entries updated by this request.",+ "type": "object"+ }+ },+ "required": [+ "enablement"+ ],+ "title": "ExperimentalFeatureEnablementSetResponse",+ "type": "object"+}\ No newline at end of filediff --git a/codex-rs/app-server-protocol/schema/typescript/ClientRequest.ts b/codex-rs/app-server-protocol/schema/typescript/ClientRequest.tsindex 3c77652cec..e33a986359 100644--- a/codex-rs/app-server-protocol/schema/typescript/ClientRequest.ts+++ b/codex-rs/app-server-protocol/schema/typescript/ClientRequest.ts@@ -16,6 +16,7 @@ import type { CommandExecWriteParams } from "./v2/CommandExecWriteParams";import type { ConfigBatchWriteParams } from "./v2/ConfigBatchWriteParams";import type { ConfigReadParams } from "./v2/ConfigReadParams";import type { ConfigValueWriteParams } from "./v2/ConfigValueWriteParams";+import type { ExperimentalFeatureEnablementSetParams } from "./v2/ExperimentalFeatureEnablementSetParams";import type { ExperimentalFeatureListParams } from "./v2/ExperimentalFeatureListParams";import type { ExternalAgentConfigDetectParams } from "./v2/ExternalAgentConfigDetectParams";import type { ExternalAgentConfigImportParams } from "./v2/ExternalAgentConfigImportParams";@@ -63,4 +64,4 @@ import type { WindowsSandboxSetupStartParams } from "./v2/WindowsSandboxSetupSta/*** Request from the client to the server.*/-export type ClientRequest ={ "method": "initialize", id: RequestId, params: InitializeParams, } | { "method": "thread/start", id: RequestId, params: ThreadStartParams, } | { "method": "thread/resume", id: RequestId, params: ThreadResumeParams, } | { "method": "thread/fork", id: RequestId, params: ThreadForkParams, } | { "method": "thread/archive", id: RequestId, params: ThreadArchiveParams, } | { "method": "thread/unsubscribe", id: RequestId, params: ThreadUnsubscribeParams, } | { "method": "thread/name/set", id: RequestId, params: ThreadSetNameParams, } | { "method": "thread/metadata/update", id: RequestId, params: ThreadMetadataUpdateParams, } | { "method": "thread/unarchive", id: RequestId, params: ThreadUnarchiveParams, } | { "method": "thread/compact/start", id: RequestId, params: ThreadCompactStartParams, } | { "method": "thread/shellCommand", id: RequestId, params: ThreadShellCommandParams, } | { "method": "thread/rollback", id: RequestId, params: ThreadRollbackParams, } | { "method": "thread/list", id: RequestId, params: ThreadListParams, } | { "method": "thread/loaded/list", id: RequestId, params: ThreadLoadedListParams, } | { "method": "thread/read", id: RequestId, params: ThreadReadParams, } | { "method": "skills/list", id: RequestId, params: SkillsListParams, } | { "method": "plugin/list", id: RequestId, params: PluginListParams, } | { "method": "plugin/read", id: RequestId, params: PluginReadParams, } | { "method": "app/list", id: RequestId, params: AppsListParams, } | { "method": "fs/readFile", id: RequestId, params: FsReadFileParams, } | { "method": "fs/writeFile", id: RequestId, params: FsWriteFileParams, } | { "method": "fs/createDirectory", id: RequestId, params: FsCreateDirectoryParams, } | { "method": "fs/getMetadata", id: RequestId, params: FsGetMetadataParams, } | { "method": "fs/readDirectory", id: RequestId, params: FsReadDirectoryParams, } | { "method": "fs/remove", id: RequestId, params: FsRemoveParams, } | { "method": "fs/copy", id: RequestId, params: FsCopyParams, } | { "method": "fs/watch", id: RequestId, params: FsWatchParams, } | { "method": "fs/unwatch", id: RequestId, params: FsUnwatchParams, } | { "method": "skills/config/write", id: RequestId, params: SkillsConfigWriteParams, } | { "method": "plugin/install", id: RequestId, params: PluginInstallParams, } | { "method": "plugin/uninstall", id: RequestId, params: PluginUninstallParams, } | { "method": "turn/start", id: RequestId, params: TurnStartParams, } | { "method": "turn/steer", id: RequestId, params: TurnSteerParams, } | { "method": "turn/interrupt", id: RequestId, params: TurnInterruptParams, } | { "method": "review/start", id: RequestId, params: ReviewStartParams, } | { "method": "model/list", id: RequestId, params: ModelListParams, } | { "method": "experimentalFeature/list", id: RequestId, params: ExperimentalFeatureListParams, } | { "method": "mcpServer/oauth/login", id: RequestId, params: McpServerOauthLoginParams, } | { "method": "config/mcpServer/reload", id: RequestId, params: undefined, } | { "method": "mcpServerStatus/list", id: RequestId, params: ListMcpServerStatusParams, } | { "method": "windowsSandbox/setupStart", id: RequestId, params: WindowsSandboxSetupStartParams, } | { "method": "account/login/start", id: RequestId, params: LoginAccountParams, } | { "method": "account/login/cancel", id: RequestId, params: CancelLoginAccountParams, } | { "method": "account/logout", id: RequestId, params: undefined, } | { "method": "account/rateLimits/read", id: RequestId, params: undefined, } | { "method": "feedback/upload", id: RequestId, params: FeedbackUploadParams, } | { "method": "command/exec", id: RequestId, params: CommandExecParams, } | { "method": "command/exec/write", id: RequestId, params: CommandExecWriteParams, } | { "method": "command/exec/terminate", id: RequestId, params: CommandExecTerminateParams, } | { "method": "command/exec/resize", id: RequestId, params: CommandExecResizeParams, } | { "method": "config/read", id: RequestId, params: ConfigReadParams, } | { "method": "externalAgentConfig/detect", id: RequestId, params: ExternalAgentConfigDetectParams, } | { "method": "externalAgentConfig/import", id: RequestId, params: ExternalAgentConfigImportParams, } | { "method": "config/value/write", id: RequestId, params: ConfigValueWriteParams, } | { "method": "config/batchWrite", id: RequestId, params: ConfigBatchWriteParams, } | { "method": "configRequirements/read", id: RequestId, params: undefined, } | { "method": "account/read", id: RequestId, params: GetAccountParams, } | { "method": "getConversationSummary", id: RequestId, params: GetConversationSummaryParams, } | { "method": "gitDiffToRemote", id: RequestId, params: GitDiffToRemoteParams, } | { "method": "getAuthStatus", id: RequestId, params: GetAuthStatusParams, } | { "method": "fuzzyFileSearch", id: RequestId, params: FuzzyFileSearchParams, };+export type ClientRequest ={ "method": "initialize", id: RequestId, params: InitializeParams, } | { "method": "thread/start", id: RequestId, params: ThreadStartParams, } | { "method": "thread/resume", id: RequestId, params: ThreadResumeParams, } | { "method": "thread/fork", id: RequestId, params: ThreadForkParams, } | { "method": "thread/archive", id: RequestId, params: ThreadArchiveParams, } | { "method": "thread/unsubscribe", id: RequestId, params: ThreadUnsubscribeParams, } | { "method": "thread/name/set", id: RequestId, params: ThreadSetNameParams, } | { "method": "thread/metadata/update", id: RequestId, params: ThreadMetadataUpdateParams, } | { "method": "thread/unarchive", id: RequestId, params: ThreadUnarchiveParams, } | { "method": "thread/compact/start", id: RequestId, params: ThreadCompactStartParams, } | { "method": "thread/shellCommand", id: RequestId, params: ThreadShellCommandParams, } | { "method": "thread/rollback", id: RequestId, params: ThreadRollbackParams, } | { "method": "thread/list", id: RequestId, params: ThreadListParams, } | { "method": "thread/loaded/list", id: RequestId, params: ThreadLoadedListParams, } | { "method": "thread/read", id: RequestId, params: ThreadReadParams, } | { "method": "skills/list", id: RequestId, params: SkillsListParams, } | { "method": "plugin/list", id: RequestId, params: PluginListParams, } | { "method": "plugin/read", id: RequestId, params: PluginReadParams, } | { "method": "app/list", id: RequestId, params: AppsListParams, } | { "method": "fs/readFile", id: RequestId, params: FsReadFileParams, } | { "method": "fs/writeFile", id: RequestId, params: FsWriteFileParams, } | { "method": "fs/createDirectory", id: RequestId, params: FsCreateDirectoryParams, } | { "method": "fs/getMetadata", id: RequestId, params: FsGetMetadataParams, } | { "method": "fs/readDirectory", id: RequestId, params: FsReadDirectoryParams, } | { "method": "fs/remove", id: RequestId, params: FsRemoveParams, } | { "method": "fs/copy", id: RequestId, params: FsCopyParams, } | { "method": "fs/watch", id: RequestId, params: FsWatchParams, } | { "method": "fs/unwatch", id: RequestId, params: FsUnwatchParams, } | { "method": "skills/config/write", id: RequestId, params: SkillsConfigWriteParams, } | { "method": "plugin/install", id: RequestId, params: PluginInstallParams, } | { "method": "plugin/uninstall", id: RequestId, params: PluginUninstallParams, } | { "method": "turn/start", id: RequestId, params: TurnStartParams, } | { "method": "turn/steer", id: RequestId, params: TurnSteerParams, } | { "method": "turn/interrupt", id: RequestId, params: TurnInterruptParams, } | { "method": "review/start", id: RequestId, params: ReviewStartParams, } | { "method": "model/list", id: RequestId, params: ModelListParams, } | { "method": "experimentalFeature/list", id: RequestId, params: ExperimentalFeatureListParams, } | { "method": "experimentalFeature/enablement/set", id: RequestId, params: ExperimentalFeatureEnablementSetParams, } | { "method": "mcpServer/oauth/login", id: RequestId, params: McpServerOauthLoginParams, } | { "method": "config/mcpServer/reload", id: RequestId, params: undefined, } | { "method": "mcpServerStatus/list", id: RequestId, params: ListMcpServerStatusParams, } | { "method": "windowsSandbox/setupStart", id: RequestId, params: WindowsSandboxSetupStartParams, } | { "method": "account/login/start", id: RequestId, params: LoginAccountParams, } | { "method": "account/login/cancel", id: RequestId, params: CancelLoginAccountParams, } | { "method": "account/logout", id: RequestId, params: undefined, } | { "method": "account/rateLimits/read", id: RequestId, params: undefined, } | { "method": "feedback/upload", id: RequestId, params: FeedbackUploadParams, } | { "method": "command/exec", id: RequestId, params: CommandExecParams, } | { "method": "command/exec/write", id: RequestId, params: CommandExecWriteParams, } | { "method": "command/exec/terminate", id: RequestId, params: CommandExecTerminateParams, } | { "method": "command/exec/resize", id: RequestId, params: CommandExecResizeParams, } | { "method": "config/read", id: RequestId, params: ConfigReadParams, } | { "method": "externalAgentConfig/detect", id: RequestId, params: ExternalAgentConfigDetectParams, } | { "method": "externalAgentConfig/import", id: RequestId, params: ExternalAgentConfigImportParams, } | { "method": "config/value/write", id: RequestId, params: ConfigValueWriteParams, } | { "method": "config/batchWrite", id: RequestId, params: ConfigBatchWriteParams, } | { "method": "configRequirements/read", id: RequestId, params: undefined, } | { "method": "account/read", id: RequestId, params: GetAccountParams, } | { "method": "getConversationSummary", id: RequestId, params: GetConversationSummaryParams, } | { "method": "gitDiffToRemote", id: RequestId, params: GitDiffToRemoteParams, } | { "method": "getAuthStatus", id: RequestId, params: GetAuthStatusParams, } | { "method": "fuzzyFileSearch", id: RequestId, params: FuzzyFileSearchParams, };diff --git a/codex-rs/app-server-protocol/schema/typescript/v2/ExperimentalFeatureEnablementSetParams.ts b/codex-rs/app-server-protocol/schema/typescript/v2/ExperimentalFeatureEnablementSetParams.tsnew file mode 100644index 0000000000..cd9ced0b3a--- /dev/null+++ b/codex-rs/app-server-protocol/schema/typescript/v2/ExperimentalFeatureEnablementSetParams.ts@@ -0,0 +1,12 @@+// 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 ExperimentalFeatureEnablementSetParams = {+/**+ * Process-wide runtime feature enablement keyed by canonical feature name.+ *+ * Only named features are updated. Omitted features are left unchanged.+ * Send an empty map for a no-op.+ */+enablement: { [key in string]?: boolean }, };diff --git a/codex-rs/app-server-protocol/schema/typescript/v2/ExperimentalFeatureEnablementSetResponse.ts b/codex-rs/app-server-protocol/schema/typescript/v2/ExperimentalFeatureEnablementSetResponse.tsnew file mode 100644index 0000000000..903576d9bc--- /dev/null+++ b/codex-rs/app-server-protocol/schema/typescript/v2/ExperimentalFeatureEnablementSetResponse.ts@@ -0,0 +1,9 @@+// 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 ExperimentalFeatureEnablementSetResponse = {+/**+ * Feature enablement entries updated by this request.+ */+enablement: { [key in string]?: boolean }, };diff --git a/codex-rs/app-server-protocol/schema/typescript/v2/index.ts b/codex-rs/app-server-protocol/schema/typescript/v2/index.tsindex 2ee447bba2..d0b1b88198 100644--- a/codex-rs/app-server-protocol/schema/typescript/v2/index.ts+++ b/codex-rs/app-server-protocol/schema/typescript/v2/index.ts@@ -81,6 +81,8 @@ export type { DynamicToolSpec } from "./DynamicToolSpec";export type { ErrorNotification } from "./ErrorNotification";export type { ExecPolicyAmendment } from "./ExecPolicyAmendment";export type { ExperimentalFeature } from "./ExperimentalFeature";+export type { ExperimentalFeatureEnablementSetParams } from "./ExperimentalFeatureEnablementSetParams";+export type { ExperimentalFeatureEnablementSetResponse } from "./ExperimentalFeatureEnablementSetResponse";export type { ExperimentalFeatureListParams } from "./ExperimentalFeatureListParams";export type { ExperimentalFeatureListResponse } from "./ExperimentalFeatureListResponse";export type { ExperimentalFeatureStage } from "./ExperimentalFeatureStage";diff --git a/codex-rs/app-server-protocol/src/protocol/common.rs b/codex-rs/app-server-protocol/src/protocol/common.rsindex 80cb24f0ff..5a9215f2ee 100644--- a/codex-rs/app-server-protocol/src/protocol/common.rs+++ b/codex-rs/app-server-protocol/src/protocol/common.rs@@ -392,6 +392,10 @@ client_request_definitions! {params: v2::ExperimentalFeatureListParams,response: v2::ExperimentalFeatureListResponse,},+ ExperimentalFeatureEnablementSet => "experimentalFeature/enablement/set" {+ params: v2::ExperimentalFeatureEnablementSetParams,+ response: v2::ExperimentalFeatureEnablementSetResponse,+ },#[experimental("collaborationMode/list")]/// Lists collaboration mode presets.CollaborationModeList => "collaborationMode/list" {diff --git a/codex-rs/app-server-protocol/src/protocol/v2.rs b/codex-rs/app-server-protocol/src/protocol/v2.rsindex fab3fe3190..67c4e95856 100644--- a/codex-rs/app-server-protocol/src/protocol/v2.rs+++ b/codex-rs/app-server-protocol/src/protocol/v2.rs@@ -1926,6 +1926,25 @@ pub struct ExperimentalFeatureListResponse {pub next_cursor: Option<String>,}+#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, Default, JsonSchema, TS)]+#[serde(rename_all = "camelCase")]+#[ts(export_to = "v2/")]+pub struct ExperimentalFeatureEnablementSetParams {+ /// Process-wide runtime feature enablement keyed by canonical feature name.+ ///+ /// Only named features are updated. Omitted features are left unchanged.+ /// Send an empty map for a no-op.+ pub enablement: std::collections::BTreeMap<String, bool>,+}++#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)]+#[serde(rename_all = "camelCase")]+#[ts(export_to = "v2/")]+pub struct ExperimentalFeatureEnablementSetResponse {+ /// Feature enablement entries updated by this request.+ pub enablement: std::collections::BTreeMap<String, bool>,+}+#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]#[serde(rename_all = "camelCase")]#[ts(export_to = "v2/")]diff --git a/codex-rs/app-server/README.md b/codex-rs/app-server/README.mdindex b877c4a035..1e186c0d5e 100644--- a/codex-rs/app-server/README.md+++ b/codex-rs/app-server/README.md@@ -164,6 +164,7 @@ Example with notification opt-out:- `fs/changed` — notification emitted when watched paths change, including the `watchId` and `changedPaths`.- `model/list` — list available models (set `includeHidden: true` to include entries with `hidden: true`), with reasoning effort options, optional legacy `upgrade` model ids, optional `upgradeInfo` metadata (`model`, `upgradeCopy`, `modelLink`, `migrationMarkdown`), and optional `availabilityNux` metadata.- `experimentalFeature/list` — list feature flags with stage metadata (`beta`, `underDevelopment`, `stable`, etc.), enabled/default-enabled state, and cursor pagination. For non-beta flags, `displayName`/`description`/`announcement` are `null`.+- `experimentalFeature/enablement/set` — patch the in-memory process-wide runtime feature enablement for the currently supported feature keys (`apps`, `plugins`). For each feature, precedence is: cloud requirements > --enable <feature_name> > config.toml > experimentalFeature/enablement/set (new) > code default.- `collaborationMode/list` — list available collaboration mode presets (experimental, no pagination). This response omits built-in developer instructions; clients should either pass `settings.developer_instructions: null` when setting a mode to use Codex's built-in instructions, or provide their own instructions explicitly.- `skills/list` — list skills for one or more `cwd` values (optional `forceReload`).- `plugin/list` — list discovered plugin marketplaces and plugin state, including effective marketplace install/auth policy metadata, fail-open `marketplaceLoadErrors` entries for marketplace files that could not be parsed or loaded, and best-effort `featuredPluginIds` for the official curated marketplace. `interface.category` uses the marketplace category when present; otherwise it falls back to the plugin manifest category. Pass `forceRemoteSync: true` to refresh curated plugin state before listing (**under development; do not call from production clients yet**).diff --git a/codex-rs/app-server/src/codex_message_processor.rs b/codex-rs/app-server/src/codex_message_processor.rsindex 1d58e7317d..402dd51ddd 100644--- a/codex-rs/app-server/src/codex_message_processor.rs+++ b/codex-rs/app-server/src/codex_message_processor.rs@@ -1,6 +1,7 @@use crate::bespoke_event_handling::apply_bespoke_event_handling;use crate::command_exec::CommandExecManager;use crate::command_exec::StartCommandExecParams;+use crate::config_api::apply_runtime_feature_enablement;use crate::error_code::INPUT_TOO_LARGE_ERROR_CODE;use crate::error_code::INTERNAL_ERROR_CODE;use crate::error_code::INVALID_PARAMS_ERROR_CODE;@@ -283,6 +284,7 @@ use codex_state::ThreadMetadataBuilder;use codex_state::log_db::LogDbLayer;use codex_utils_json_to_toml::json_to_toml;use codex_utils_pty::DEFAULT_OUTPUT_BYTES_CAP;+use std::collections::BTreeMap;use std::collections::HashMap;use std::collections::HashSet;use std::ffi::OsStr;@@ -371,7 +373,8 @@ pub(crate) struct CodexMessageProcessor {outgoing: Arc<OutgoingMessageSender>,arg0_paths: Arg0DispatchPaths,config: Arc<Config>,- cli_overrides: Vec<(String, TomlValue)>,+ cli_overrides: Arc<RwLock<Vec<(String, TomlValue)>>>,+ runtime_feature_enablement: Arc<RwLock<BTreeMap<String, bool>>>,cloud_requirements: Arc<RwLock<CloudRequirementsLoader>>,active_login: Arc<Mutex<Option<ActiveLogin>>>,pending_thread_unloads: Arc<Mutex<HashSet<ThreadId>>>,@@ -422,7 +425,8 @@ pub(crate) struct CodexMessageProcessorArgs {pub(crate) outgoing: Arc<OutgoingMessageSender>,pub(crate) arg0_paths: Arg0DispatchPaths,pub(crate) config: Arc<Config>,- pub(crate) cli_overrides: Vec<(String, TomlValue)>,+ pub(crate) cli_overrides: Arc<RwLock<Vec<(String, TomlValue)>>>,+ pub(crate) runtime_feature_enablement: Arc<RwLock<BTreeMap<String, bool>>>,pub(crate) cloud_requirements: Arc<RwLock<CloudRequirementsLoader>>,pub(crate) feedback: CodexFeedback,pub(crate) log_db: Option<LogDbLayer>,@@ -486,6 +490,7 @@ impl CodexMessageProcessor {arg0_paths,config,cli_overrides,+ runtime_feature_enablement,cloud_requirements,feedback,log_db,@@ -497,6 +502,7 @@ impl CodexMessageProcessor {arg0_paths,config,cli_overrides,+ runtime_feature_enablement,cloud_requirements,active_login: Arc::new(Mutex::new(None)),pending_thread_unloads: Arc::new(Mutex::new(HashSet::new())),@@ -517,7 +523,7 @@ impl CodexMessageProcessor {) -> Result<Config, JSONRPCErrorError> {let cloud_requirements = self.current_cloud_requirements();let mut config = codex_core::config::ConfigBuilder::default()- .cli_overrides(self.cli_overrides.clone())+ .cli_overrides(self.current_cli_overrides()).fallback_cwd(fallback_cwd).cloud_requirements(cloud_requirements).build()@@ -527,6 +533,7 @@ impl CodexMessageProcessor {message: format!("failed to reload config: {err}"),data: None,})?;+ apply_runtime_feature_enablement(&mut config, &self.current_runtime_feature_enablement());config.codex_linux_sandbox_exe = self.arg0_paths.codex_linux_sandbox_exe.clone();config.main_execve_wrapper_exe = self.arg0_paths.main_execve_wrapper_exe.clone();Ok(config)@@ -539,6 +546,20 @@ impl CodexMessageProcessor {.unwrap_or_default()}+ fn current_cli_overrides(&self) -> Vec<(String, TomlValue)> {+ self.cli_overrides+ .read()+ .map(|guard| guard.clone())+ .unwrap_or_default()+ }++ fn current_runtime_feature_enablement(&self) -> BTreeMap<String, bool> {+ self.runtime_feature_enablement+ .read()+ .map(|guard| guard.clone())+ .unwrap_or_default()+ }+/// If a client sends `developer_instructions: null` during a mode switch,/// use the built-in instructions for that mode.fn normalize_turn_start_collaboration_mode(@@ -884,7 +905,8 @@ impl CodexMessageProcessor {}ClientRequest::ConfigRead { .. }| ClientRequest::ConfigValueWrite { .. }- | ClientRequest::ConfigBatchWrite { .. } => {+ | ClientRequest::ConfigBatchWrite { .. }+ | ClientRequest::ExperimentalFeatureEnablementSet { .. } => {warn!("Config request reached CodexMessageProcessor unexpectedly");}ClientRequest::FsReadFile { .. }@@ -1085,7 +1107,7 @@ impl CodexMessageProcessor {let cloud_requirements = self.cloud_requirements.clone();let chatgpt_base_url = self.config.chatgpt_base_url.clone();let codex_home = self.config.codex_home.clone();- let cli_overrides = self.cli_overrides.clone();+ let cli_overrides = self.current_cli_overrides();let auth_url = server.auth_url.clone();tokio::spawn(async move {let (success, error_msg) = match tokio::time::timeout(@@ -1273,11 +1295,9 @@ impl CodexMessageProcessor {self.config.chatgpt_base_url.clone(),self.config.codex_home.clone(),);- sync_default_client_residency_requirement(- &self.cli_overrides,- self.cloud_requirements.as_ref(),- )- .await;+ let cli_overrides = self.current_cli_overrides();+ sync_default_client_residency_requirement(&cli_overrides, self.cloud_requirements.as_ref())+ .await;self.outgoing.send_response(request_id, LoginAccountResponse::ChatgptAuthTokens {})@@ -1892,8 +1912,8 @@ impl CodexMessageProcessor {personality,);typesafe_overrides.ephemeral = ephemeral;- let cli_overrides = self.cli_overrides.clone();let cloud_requirements = self.current_cloud_requirements();+ let cli_overrides = self.current_cli_overrides();let listener_task_context = ListenerTaskContext {thread_manager: Arc::clone(&self.thread_manager),thread_state_manager: self.thread_state_manager.clone(),@@ -1903,10 +1923,12 @@ impl CodexMessageProcessor {codex_home: self.config.codex_home.clone(),};let request_trace = request_context.request_trace();+ let runtime_feature_enablement = self.current_runtime_feature_enablement();let thread_start_task = async move {Self::thread_start_task(listener_task_context,cli_overrides,+ runtime_feature_enablement,cloud_requirements,request_id,config,@@ -1979,6 +2001,7 @@ impl CodexMessageProcessor {async fn thread_start_task(listener_task_context: ListenerTaskContext,cli_overrides: Vec<(String, TomlValue)>,+ runtime_feature_enablement: BTreeMap<String, bool>,cloud_requirements: CloudRequirementsLoader,request_id: ConnectionRequestId,config_overrides: Option<HashMap<String, serde_json::Value>>,@@ -1995,6 +2018,7 @@ impl CodexMessageProcessor {typesafe_overrides,&cloud_requirements,&listener_task_context.codex_home,+ &runtime_feature_enablement,).await{@@ -3497,13 +3521,16 @@ impl CodexMessageProcessor {// Derive a Config using the same logic as new conversation, honoring overrides if provided.let cloud_requirements = self.current_cloud_requirements();+ let cli_overrides = self.current_cli_overrides();+ let runtime_feature_enablement = self.current_runtime_feature_enablement();let config = match derive_config_for_cwd(- &self.cli_overrides,+ &cli_overrides,request_overrides,typesafe_overrides,history_cwd,&cloud_requirements,&self.config.codex_home,+ &runtime_feature_enablement,).await{@@ -4039,13 +4066,16 @@ impl CodexMessageProcessor {typesafe_overrides.ephemeral = ephemeral.then_some(true);// Derive a Config using the same logic as new conversation, honoring overrides if provided.let cloud_requirements = self.current_cloud_requirements();+ let cli_overrides = self.current_cli_overrides();+ let runtime_feature_enablement = self.current_runtime_feature_enablement();let config = match derive_config_for_cwd(- &self.cli_overrides,+ &cli_overrides,request_overrides,typesafe_overrides,history_cwd,&cloud_requirements,&self.config.codex_home,+ &runtime_feature_enablement,).await{@@ -7224,12 +7254,13 @@ impl CodexMessageProcessor {WindowsSandboxSetupMode::Unelevated => CoreWindowsSandboxSetupMode::Unelevated,};let config = Arc::clone(&self.config);- let cli_overrides = self.cli_overrides.clone();let cloud_requirements = self.current_cloud_requirements();let command_cwd = params.cwd.map(PathBuf::from).unwrap_or_else(|| config.cwd.clone());+ let cli_overrides = self.current_cli_overrides();+ let runtime_feature_enablement = self.current_runtime_feature_enablement();let outgoing = Arc::clone(&self.outgoing);let connection_id = request_id.connection_id;@@ -7244,6 +7275,7 @@ impl CodexMessageProcessor {Some(command_cwd.clone()),&cloud_requirements,&config.codex_home,+ &runtime_feature_enablement,).await;let setup_result = match derived_config {@@ -7873,6 +7905,7 @@ async fn derive_config_from_params(typesafe_overrides: ConfigOverrides,cloud_requirements: &CloudRequirementsLoader,codex_home: &Path,+ runtime_feature_enablement: &BTreeMap<String, bool>,) -> std::io::Result<Config> {let merged_cli_overrides = cli_overrides.iter()@@ -7885,13 +7918,15 @@ async fn derive_config_from_params().collect::<Vec<_>>();- codex_core::config::ConfigBuilder::default()+ let mut config = codex_core::config::ConfigBuilder::default().codex_home(codex_home.to_path_buf()).cli_overrides(merged_cli_overrides).harness_overrides(typesafe_overrides).cloud_requirements(cloud_requirements.clone()).build()- .await+ .await?;+ apply_runtime_feature_enablement(&mut config, runtime_feature_enablement);+ Ok(config)}async fn derive_config_for_cwd(@@ -7901,6 +7936,7 @@ async fn derive_config_for_cwd(cwd: Option<PathBuf>,cloud_requirements: &CloudRequirementsLoader,codex_home: &Path,+ runtime_feature_enablement: &BTreeMap<String, bool>,) -> std::io::Result<Config> {let merged_cli_overrides = cli_overrides.iter()@@ -7913,14 +7949,16 @@ async fn derive_config_for_cwd().collect::<Vec<_>>();- codex_core::config::ConfigBuilder::default()+ let mut config = codex_core::config::ConfigBuilder::default().codex_home(codex_home.to_path_buf()).cli_overrides(merged_cli_overrides).harness_overrides(typesafe_overrides).fallback_cwd(cwd).cloud_requirements(cloud_requirements.clone()).build()- .await+ .await?;+ apply_runtime_feature_enablement(&mut config, runtime_feature_enablement);+ Ok(config)}async fn read_history_cwd_from_state_db(diff --git a/codex-rs/app-server/src/config_api.rs b/codex-rs/app-server/src/config_api.rsindex bc82e9152e..9ade74914d 100644--- a/codex-rs/app-server/src/config_api.rs+++ b/codex-rs/app-server/src/config_api.rs@@ -9,11 +9,14 @@ use codex_app_server_protocol::ConfigRequirementsReadResponse;use codex_app_server_protocol::ConfigValueWriteParams;use codex_app_server_protocol::ConfigWriteErrorCode;use codex_app_server_protocol::ConfigWriteResponse;+use codex_app_server_protocol::ExperimentalFeatureEnablementSetParams;+use codex_app_server_protocol::ExperimentalFeatureEnablementSetResponse;use codex_app_server_protocol::JSONRPCErrorError;use codex_app_server_protocol::NetworkRequirements;use codex_app_server_protocol::SandboxMode;use codex_core::AnalyticsEventsClient;use codex_core::ThreadManager;+use codex_core::config::Config;use codex_core::config::ConfigService;use codex_core::config::ConfigServiceError;use codex_core::config_loader::CloudRequirementsLoader;@@ -24,15 +27,21 @@ use codex_core::config_loader::SandboxModeRequirement as CoreSandboxModeRequiremuse codex_core::plugins::PluginId;use codex_core::plugins::collect_plugin_enabled_candidates;use codex_core::plugins::installed_plugin_telemetry_metadata;+use codex_features::canonical_feature_for_key;+use codex_features::feature_for_key;use codex_protocol::config_types::WebSearchMode;use codex_protocol::protocol::Op;use serde_json::json;+use std::collections::BTreeMap;+use std::collections::BTreeSet;use std::path::PathBuf;use std::sync::Arc;use std::sync::RwLock;use toml::Value as TomlValue;use tracing::warn;+const SUPPORTED_EXPERIMENTAL_FEATURE_ENABLEMENT: &[&str] = &["apps", "plugins"];+#[async_trait]pub(crate) trait UserConfigReloader: Send + Sync {async fn reload_user_config(&self);@@ -56,7 +65,8 @@ impl UserConfigReloader for ThreadManager {#[derive(Clone)]pub(crate) struct ConfigApi {codex_home: PathBuf,- cli_overrides: Vec<(String, TomlValue)>,+ cli_overrides: Arc<RwLock<Vec<(String, TomlValue)>>>,+ runtime_feature_enablement: Arc<RwLock<BTreeMap<String, bool>>>,loader_overrides: LoaderOverrides,cloud_requirements: Arc<RwLock<CloudRequirementsLoader>>,user_config_reloader: Arc<dyn UserConfigReloader>,@@ -66,7 +76,8 @@ pub(crate) struct ConfigApi {impl ConfigApi {pub(crate) fn new(codex_home: PathBuf,- cli_overrides: Vec<(String, TomlValue)>,+ cli_overrides: Arc<RwLock<Vec<(String, TomlValue)>>>,+ runtime_feature_enablement: Arc<RwLock<BTreeMap<String, bool>>>,loader_overrides: LoaderOverrides,cloud_requirements: Arc<RwLock<CloudRequirementsLoader>>,user_config_reloader: Arc<dyn UserConfigReloader>,@@ -75,6 +86,7 @@ impl ConfigApi {Self {codex_home,cli_overrides,+ runtime_feature_enablement,loader_overrides,cloud_requirements,user_config_reloader,@@ -83,24 +95,87 @@ impl ConfigApi {}fn config_service(&self) -> ConfigService {- let cloud_requirements = self- .cloud_requirements- .read()- .map(|guard| guard.clone())- .unwrap_or_default();ConfigService::new(self.codex_home.clone(),- self.cli_overrides.clone(),+ self.current_cli_overrides(),self.loader_overrides.clone(),- cloud_requirements,+ self.current_cloud_requirements(),)}+ fn current_cli_overrides(&self) -> Vec<(String, TomlValue)> {+ self.cli_overrides+ .read()+ .map(|guard| guard.clone())+ .unwrap_or_default()+ }++ fn current_runtime_feature_enablement(&self) -> BTreeMap<String, bool> {+ self.runtime_feature_enablement+ .read()+ .map(|guard| guard.clone())+ .unwrap_or_default()+ }++ fn current_cloud_requirements(&self) -> CloudRequirementsLoader {+ self.cloud_requirements+ .read()+ .map(|guard| guard.clone())+ .unwrap_or_default()+ }++ async fn load_latest_config(+ &self,+ fallback_cwd: Option<PathBuf>,+ ) -> Result<Config, JSONRPCErrorError> {+ let mut config = codex_core::config::ConfigBuilder::default()+ .codex_home(self.codex_home.clone())+ .cli_overrides(self.current_cli_overrides())+ .loader_overrides(self.loader_overrides.clone())+ .fallback_cwd(fallback_cwd)+ .cloud_requirements(self.current_cloud_requirements())+ .build()+ .await+ .map_err(|err| JSONRPCErrorError {+ code: INTERNAL_ERROR_CODE,+ message: format!("failed to resolve feature override precedence: {err}"),+ data: None,+ })?;+ apply_runtime_feature_enablement(&mut config, &self.current_runtime_feature_enablement());+ Ok(config)+ }+pub(crate) async fn read(&self,params: ConfigReadParams,) -> Result<ConfigReadResponse, JSONRPCErrorError> {- self.config_service().read(params).await.map_err(map_error)+ let fallback_cwd = params.cwd.as_ref().map(PathBuf::from);+ let mut response = self+ .config_service()+ .read(params)+ .await+ .map_err(map_error)?;+ let config = self.load_latest_config(fallback_cwd).await?;+ for feature_key in SUPPORTED_EXPERIMENTAL_FEATURE_ENABLEMENT {+ let Some(feature) = feature_for_key(feature_key) else {+ continue;+ };+ let features = response+ .config+ .additional+ .entry("features".to_string())+ .or_insert_with(|| json!({}));+ if !features.is_object() {+ *features = json!({});+ }+ if let Some(features) = features.as_object_mut() {+ features.insert(+ (*feature_key).to_string(),+ json!(config.features.enabled(feature)),+ );+ }+ }+ Ok(response)}pub(crate) async fn config_requirements_read(@@ -154,6 +229,68 @@ impl ConfigApi {Ok(response)}+ pub(crate) async fn set_experimental_feature_enablement(+ &self,+ params: ExperimentalFeatureEnablementSetParams,+ ) -> Result<ExperimentalFeatureEnablementSetResponse, JSONRPCErrorError> {+ let ExperimentalFeatureEnablementSetParams { enablement } = params;+ for key in enablement.keys() {+ if canonical_feature_for_key(key).is_some() {+ if SUPPORTED_EXPERIMENTAL_FEATURE_ENABLEMENT.contains(&key.as_str()) {+ continue;+ }++ return Err(JSONRPCErrorError {+ code: INVALID_REQUEST_ERROR_CODE,+ message: format!(+ "unsupported feature enablement `{key}`: currently supported features are {}",+ SUPPORTED_EXPERIMENTAL_FEATURE_ENABLEMENT.join(", ")+ ),+ data: None,+ });+ }++ let message = if let Some(feature) = feature_for_key(key) {+ format!(+ "invalid feature enablement `{key}`: use canonical feature key `{}`",+ feature.key()+ )+ } else {+ format!("invalid feature enablement `{key}`")+ };+ return Err(JSONRPCErrorError {+ code: INVALID_REQUEST_ERROR_CODE,+ message,+ data: None,+ });+ }++ if enablement.is_empty() {+ return Ok(ExperimentalFeatureEnablementSetResponse { enablement });+ }++ {+ let mut runtime_feature_enablement =+ self.runtime_feature_enablement+ .write()+ .map_err(|_| JSONRPCErrorError {+ code: INTERNAL_ERROR_CODE,+ message: "failed to update feature enablement".to_string(),+ data: None,+ })?;+ runtime_feature_enablement.extend(+ enablement+ .iter()+ .map(|(name, enabled)| (name.clone(), *enabled)),+ );+ }++ self.load_latest_config(/*fallback_cwd*/ None).await?;+ self.user_config_reloader.reload_user_config().await;++ Ok(ExperimentalFeatureEnablementSetResponse { enablement })+ }+fn emit_plugin_toggle_events(&self, pending_changes: std::collections::BTreeMap<String, bool>) {for (plugin_id, enabled) in pending_changes {let Ok(plugin_id) = PluginId::parse(&plugin_id) else {@@ -170,6 +307,49 @@ impl ConfigApi {}}+pub(crate) fn protected_feature_keys(+ config_layer_stack: &codex_core::config_loader::ConfigLayerStack,+) -> BTreeSet<String> {+ let mut protected_features = config_layer_stack+ .effective_config()+ .get("features")+ .and_then(toml::Value::as_table)+ .map(|features| features.keys().cloned().collect::<BTreeSet<_>>())+ .unwrap_or_default();++ if let Some(feature_requirements) = config_layer_stack+ .requirements_toml()+ .feature_requirements+ .as_ref()+ {+ protected_features.extend(feature_requirements.entries.keys().cloned());+ }++ protected_features+}++pub(crate) fn apply_runtime_feature_enablement(+ config: &mut Config,+ runtime_feature_enablement: &BTreeMap<String, bool>,+) {+ let protected_features = protected_feature_keys(&config.config_layer_stack);+ for (name, enabled) in runtime_feature_enablement {+ if protected_features.contains(name) {+ continue;+ }+ let Some(feature) = feature_for_key(name) else {+ continue;+ };+ if let Err(err) = config.features.set_enabled(feature, *enabled) {+ warn!(+ feature = name,+ error = %err,+ "failed to apply runtime feature enablement"+ );+ }+ }+}+fn map_requirements_toml_to_api(requirements: ConfigRequirementsToml) -> ConfigRequirements {ConfigRequirements {allowed_approval_policies: requirements.allowed_approval_policies.map(|policies| {@@ -265,6 +445,7 @@ mod tests {use super::*;use codex_core::AnalyticsEventsClient;use codex_core::config_loader::NetworkRequirementsToml as CoreNetworkRequirementsToml;+ use codex_features::Feature;use codex_protocol::protocol::AskForApproval as CoreAskForApproval;use pretty_assertions::assert_eq;use serde_json::json;@@ -392,6 +573,66 @@ mod tests {);}+ #[tokio::test]+ async fn apply_runtime_feature_enablement_keeps_cli_overrides_above_config_and_runtime() {+ let codex_home = TempDir::new().expect("create temp dir");+ std::fs::write(+ codex_home.path().join("config.toml"),+ "[features]\napps = false\n",+ )+ .expect("write config");++ let mut config = codex_core::config::ConfigBuilder::default()+ .codex_home(codex_home.path().to_path_buf())+ .fallback_cwd(Some(codex_home.path().to_path_buf()))+ .cli_overrides(vec![(+ "features.apps".to_string(),+ TomlValue::Boolean(true),+ )])+ .build()+ .await+ .expect("load config");++ apply_runtime_feature_enablement(+ &mut config,+ &BTreeMap::from([("apps".to_string(), false)]),+ );++ assert!(config.features.enabled(Feature::Apps));+ }++ #[tokio::test]+ async fn apply_runtime_feature_enablement_keeps_cloud_pins_above_cli_and_runtime() {+ let codex_home = TempDir::new().expect("create temp dir");++ let mut config = codex_core::config::ConfigBuilder::default()+ .codex_home(codex_home.path().to_path_buf())+ .cli_overrides(vec![(+ "features.apps".to_string(),+ TomlValue::Boolean(true),+ )])+ .cloud_requirements(CloudRequirementsLoader::new(async {+ Ok(Some(ConfigRequirementsToml {+ feature_requirements: Some(+ codex_core::config_loader::FeatureRequirementsToml {+ entries: BTreeMap::from([("apps".to_string(), false)]),+ },+ ),+ ..Default::default()+ }))+ }))+ .build()+ .await+ .expect("load config");++ apply_runtime_feature_enablement(+ &mut config,+ &BTreeMap::from([("apps".to_string(), true)]),+ );++ assert!(!config.features.enabled(Feature::Apps));+ }+#[tokio::test]async fn batch_write_reloads_user_config_when_requested() {let codex_home = TempDir::new().expect("create temp dir");@@ -406,7 +647,8 @@ mod tests {);let config_api = ConfigApi::new(codex_home.path().to_path_buf(),- Vec::new(),+ Arc::new(RwLock::new(Vec::new())),+ Arc::new(RwLock::new(BTreeMap::new())),LoaderOverrides::default(),Arc::new(RwLock::new(CloudRequirementsLoader::default())),reloader.clone(),diff --git a/codex-rs/app-server/src/message_processor.rs b/codex-rs/app-server/src/message_processor.rsindex a67c810bd0..d070738fba 100644--- a/codex-rs/app-server/src/message_processor.rs+++ b/codex-rs/app-server/src/message_processor.rs@@ -1,3 +1,4 @@+use std::collections::BTreeMap;use std::collections::HashSet;use std::future::Future;use std::sync::Arc;@@ -30,6 +31,7 @@ use codex_app_server_protocol::ConfigReadParams;use codex_app_server_protocol::ConfigValueWriteParams;use codex_app_server_protocol::ConfigWarningNotification;use codex_app_server_protocol::ExperimentalApi;+use codex_app_server_protocol::ExperimentalFeatureEnablementSetParams;use codex_app_server_protocol::ExternalAgentConfigDetectParams;use codex_app_server_protocol::ExternalAgentConfigImportParams;use codex_app_server_protocol::FsCopyParams;@@ -226,6 +228,8 @@ impl MessageProcessor {.plugins_manager().set_analytics_events_client(analytics_events_client.clone());+ let cli_overrides = Arc::new(RwLock::new(cli_overrides));+ let runtime_feature_enablement = Arc::new(RwLock::new(BTreeMap::new()));let cloud_requirements = Arc::new(RwLock::new(cloud_requirements));let codex_message_processor = CodexMessageProcessor::new(CodexMessageProcessorArgs {auth_manager: auth_manager.clone(),@@ -234,6 +238,7 @@ impl MessageProcessor {arg0_paths,config: Arc::clone(&config),cli_overrides: cli_overrides.clone(),+ runtime_feature_enablement: runtime_feature_enablement.clone(),cloud_requirements: cloud_requirements.clone(),feedback,log_db,@@ -246,6 +251,7 @@ impl MessageProcessor {let config_api = ConfigApi::new(config.codex_home.clone(),cli_overrides,+ runtime_feature_enablement,loader_overrides,cloud_requirements,thread_manager,@@ -700,6 +706,16 @@ impl MessageProcessor {).await;}+ ClientRequest::ExperimentalFeatureEnablementSet { request_id, params } => {+ self.handle_experimental_feature_enablement_set(+ ConnectionRequestId {+ connection_id,+ request_id,+ },+ params,+ )+ .await;+ }ClientRequest::ConfigRequirementsRead {request_id,params: _,@@ -848,7 +864,30 @@ impl MessageProcessor {request_id: ConnectionRequestId,params: ConfigBatchWriteParams,) {- match self.config_api.batch_write(params).await {+ self.handle_config_mutation_result(request_id, self.config_api.batch_write(params).await)+ .await;+ }++ async fn handle_experimental_feature_enablement_set(+ &self,+ request_id: ConnectionRequestId,+ params: ExperimentalFeatureEnablementSetParams,+ ) {+ self.handle_config_mutation_result(+ request_id,+ self.config_api+ .set_experimental_feature_enablement(params)+ .await,+ )+ .await;+ }++ async fn handle_config_mutation_result<T: serde::Serialize>(+ &self,+ request_id: ConnectionRequestId,+ result: std::result::Result<T, JSONRPCErrorError>,+ ) {+ match result {Ok(response) => {self.codex_message_processor.clear_plugin_related_caches();self.codex_message_processordiff --git a/codex-rs/app-server/tests/common/mcp_process.rs b/codex-rs/app-server/tests/common/mcp_process.rsindex 067e06ec43..fe21cdafff 100644--- a/codex-rs/app-server/tests/common/mcp_process.rs+++ b/codex-rs/app-server/tests/common/mcp_process.rs@@ -465,6 +465,16 @@ impl McpProcess {self.send_request("experimentalFeature/list", params).await}+ /// Send an `experimentalFeature/enablement/set` JSON-RPC request.+ pub async fn send_experimental_feature_enablement_set_request(+ &mut self,+ params: codex_app_server_protocol::ExperimentalFeatureEnablementSetParams,+ ) -> anyhow::Result<i64> {+ let params = Some(serde_json::to_value(params)?);+ self.send_request("experimentalFeature/enablement/set", params)+ .await+ }+/// Send an `app/list` JSON-RPC request.pub async fn send_apps_list_request(&mut self, params: AppsListParams) -> anyhow::Result<i64> {let params = Some(serde_json::to_value(params)?);diff --git a/codex-rs/app-server/tests/suite/v2/experimental_feature_list.rs b/codex-rs/app-server/tests/suite/v2/experimental_feature_list.rsindex 7ff5f6fe39..7bbcc36ee2 100644--- a/codex-rs/app-server/tests/suite/v2/experimental_feature_list.rs+++ b/codex-rs/app-server/tests/suite/v2/experimental_feature_list.rs@@ -3,16 +3,24 @@ use std::time::Duration;use anyhow::Result;use app_test_support::McpProcess;use app_test_support::to_response;+use codex_app_server_protocol::ConfigReadParams;+use codex_app_server_protocol::ConfigReadResponse;use codex_app_server_protocol::ExperimentalFeature;+use codex_app_server_protocol::ExperimentalFeatureEnablementSetParams;+use codex_app_server_protocol::ExperimentalFeatureEnablementSetResponse;use codex_app_server_protocol::ExperimentalFeatureListParams;use codex_app_server_protocol::ExperimentalFeatureListResponse;use codex_app_server_protocol::ExperimentalFeatureStage;+use codex_app_server_protocol::JSONRPCError;use codex_app_server_protocol::JSONRPCResponse;use codex_app_server_protocol::RequestId;use codex_core::config::ConfigBuilder;use codex_features::FEATURES;use codex_features::Stage;use pretty_assertions::assert_eq;+use serde::de::DeserializeOwned;+use serde_json::json;+use std::collections::BTreeMap;use tempfile::TempDir;use tokio::time::timeout;@@ -34,13 +42,7 @@ async fn experimental_feature_list_returns_feature_metadata_with_stage() -> Resu.send_experimental_feature_list_request(ExperimentalFeatureListParams::default()).await?;- let response: JSONRPCResponse = timeout(- DEFAULT_TIMEOUT,- mcp.read_stream_until_response_message(RequestId::Integer(request_id)),- )- .await??;-- let actual = to_response::<ExperimentalFeatureListResponse>(response)?;+ let actual = read_response::<ExperimentalFeatureListResponse>(&mut mcp, request_id).await?;let expected_data = FEATURES.iter().map(|spec| {@@ -82,3 +84,203 @@ async fn experimental_feature_list_returns_feature_metadata_with_stage() -> Resuassert_eq!(actual, expected);Ok(())}++#[tokio::test]+async fn experimental_feature_enablement_set_applies_to_global_and_thread_config_reads()+-> Result<()> {+ let codex_home = TempDir::new()?;+ let project_cwd = codex_home.path().join("project");+ std::fs::create_dir_all(&project_cwd)?;++ let mut mcp = McpProcess::new(codex_home.path()).await?;+ timeout(DEFAULT_TIMEOUT, mcp.initialize()).await??;++ let actual =+ set_experimental_feature_enablement(&mut mcp, BTreeMap::from([("apps".to_string(), true)]))+ .await?;+ assert_eq!(+ actual,+ ExperimentalFeatureEnablementSetResponse {+ enablement: BTreeMap::from([("apps".to_string(), true)]),+ }+ );++ for cwd in [None, Some(project_cwd.display().to_string())] {+ let ConfigReadResponse { config, .. } = read_config(&mut mcp, cwd).await?;++ assert_eq!(+ config+ .additional+ .get("features")+ .and_then(|features| features.get("apps")),+ Some(&json!(true))+ );+ }++ Ok(())+}++#[tokio::test]+async fn experimental_feature_enablement_set_does_not_override_user_config() -> Result<()> {+ let codex_home = TempDir::new()?;+ std::fs::write(+ codex_home.path().join("config.toml"),+ "[features]\napps = false\n",+ )?;+ let mut mcp = McpProcess::new(codex_home.path()).await?;+ timeout(DEFAULT_TIMEOUT, mcp.initialize()).await??;++ let actual =+ set_experimental_feature_enablement(&mut mcp, BTreeMap::from([("apps".to_string(), true)]))+ .await?;+ assert_eq!(+ actual,+ ExperimentalFeatureEnablementSetResponse {+ enablement: BTreeMap::from([("apps".to_string(), true)]),+ }+ );++ let ConfigReadResponse { config, .. } = read_config(&mut mcp, /*cwd*/ None).await?;++ assert_eq!(+ config+ .additional+ .get("features")+ .and_then(|features| features.get("apps")),+ Some(&json!(false))+ );++ Ok(())+}++#[tokio::test]+async fn experimental_feature_enablement_set_only_updates_named_features() -> Result<()> {+ let codex_home = TempDir::new()?;+ let mut mcp = McpProcess::new(codex_home.path()).await?;+ timeout(DEFAULT_TIMEOUT, mcp.initialize()).await??;++ set_experimental_feature_enablement(&mut mcp, BTreeMap::from([("apps".to_string(), true)]))+ .await?;+ let actual = set_experimental_feature_enablement(+ &mut mcp,+ BTreeMap::from([("plugins".to_string(), true)]),+ )+ .await?;++ assert_eq!(+ actual,+ ExperimentalFeatureEnablementSetResponse {+ enablement: BTreeMap::from([("plugins".to_string(), true)]),+ }+ );++ let ConfigReadResponse { config, .. } = read_config(&mut mcp, /*cwd*/ None).await?;++ assert_eq!(+ config+ .additional+ .get("features")+ .and_then(|features| features.get("apps")),+ Some(&json!(true))+ );+ assert_eq!(+ config+ .additional+ .get("features")+ .and_then(|features| features.get("plugins")),+ Some(&json!(true))+ );++ Ok(())+}++#[tokio::test]+async fn experimental_feature_enablement_set_empty_map_is_no_op() -> Result<()> {+ let codex_home = TempDir::new()?;+ let mut mcp = McpProcess::new(codex_home.path()).await?;+ timeout(DEFAULT_TIMEOUT, mcp.initialize()).await??;++ set_experimental_feature_enablement(&mut mcp, BTreeMap::from([("apps".to_string(), true)]))+ .await?;+ let actual = set_experimental_feature_enablement(&mut mcp, BTreeMap::new()).await?;++ assert_eq!(+ actual,+ ExperimentalFeatureEnablementSetResponse {+ enablement: BTreeMap::new(),+ }+ );++ let ConfigReadResponse { config, .. } = read_config(&mut mcp, /*cwd*/ None).await?;++ assert_eq!(+ config+ .additional+ .get("features")+ .and_then(|features| features.get("apps")),+ Some(&json!(true))+ );++ Ok(())+}++#[tokio::test]+async fn experimental_feature_enablement_set_rejects_non_allowlisted_feature() -> Result<()> {+ let codex_home = TempDir::new()?;+ let mut mcp = McpProcess::new(codex_home.path()).await?;+ timeout(DEFAULT_TIMEOUT, mcp.initialize()).await??;++ let request_id = mcp+ .send_experimental_feature_enablement_set_request(ExperimentalFeatureEnablementSetParams {+ enablement: BTreeMap::from([("personality".to_string(), true)]),+ })+ .await?;+ let JSONRPCError { error, .. } = timeout(+ DEFAULT_TIMEOUT,+ mcp.read_stream_until_error_message(RequestId::Integer(request_id)),+ )+ .await??;++ assert_eq!(error.code, -32600);+ assert!(+ error+ .message+ .contains("unsupported feature enablement `personality`"),+ "{}",+ error.message+ );+ assert!(error.message.contains("apps, plugins"), "{}", error.message);++ Ok(())+}++async fn set_experimental_feature_enablement(+ mcp: &mut McpProcess,+ enablement: BTreeMap<String, bool>,+) -> Result<ExperimentalFeatureEnablementSetResponse> {+ let request_id = mcp+ .send_experimental_feature_enablement_set_request(ExperimentalFeatureEnablementSetParams {+ enablement,+ })+ .await?;+ read_response(mcp, request_id).await+}++async fn read_config(mcp: &mut McpProcess, cwd: Option<String>) -> Result<ConfigReadResponse> {+ let request_id = mcp+ .send_config_read_request(ConfigReadParams {+ include_layers: false,+ cwd,+ })+ .await?;+ read_response(mcp, request_id).await+}++async fn read_response<T: DeserializeOwned>(mcp: &mut McpProcess, request_id: i64) -> Result<T> {+ let response: JSONRPCResponse = timeout(+ DEFAULT_TIMEOUT,+ mcp.read_stream_until_response_message(RequestId::Integer(request_id)),+ )+ .await??;+ to_response(response)+}