[2 of 4] tui: route app and skill enablement through app server (#22914)

## Why
App and skill toggles are user config mutations too. When the TUI is
attached to a remote app server, writing those toggles into the local
`config.toml` makes the UI report success without updating the server
that actually owns the session.

This is **[2 of 4]** in a stacked series that moves TUI-owned config
mutations onto app-server APIs.

## What changed
- Routed app enable/disable persistence through app-server config batch
writes.
- Routed skill enable/disable persistence through `skills/config/write`.
- Avoided refreshing local config from disk after these writes when the
TUI is connected to a remote app server.

## Config keys affected
- `apps.<app_id>.enabled`
- `apps.<app_id>.disabled_reason`
- `[[skills.config]]` entries keyed by `path`, with `enabled = false`
used for persisted disables

## Suggested manual validation
- Connect the TUI to a remote app server, disable an app, reconnect, and
confirm the app remains disabled from remote config rather than local
disk state.
- Re-enable the same app and confirm both `apps.<app_id>.enabled` and
`apps.<app_id>.disabled_reason` are cleared remotely.
- Disable a skill in the manage-skills UI and confirm a remote
`[[skills.config]]` disable entry appears.
- Re-enable that skill and confirm the disable entry is removed and the
effective enabled state updates without relying on local config reloads.

## Stack
1. [#22913](https://github.com/openai/codex/pull/22913) `[1 of 4]`
primary settings writes
2. [#22914](https://github.com/openai/codex/pull/22914) `[2 of 4]` app
and skill enablement
3. [#22915](https://github.com/openai/codex/pull/22915) `[3 of 4]`
feature and memory toggles
4. [#22916](https://github.com/openai/codex/pull/22916) `[4 of 4]`
startup and onboarding bookkeeping
This commit is contained in:
Eric Traut authored and GitHub committed 2026-05-19 10:21:07 -07:00
1 parent f0663fd4fd
commit ae10708ae0
18 files changed
+189 -326

No files matched your search

+30 -36
View File
@@ -420,6 +420,9 @@ impl App {
AppEvent::RefreshConnectors { force_refetch } => {
self.chat_widget.refresh_connectors(force_refetch);
}
AppEvent::FetchConnectorsList { force_refetch } => {
self.fetch_connectors_list(app_server, force_refetch);
}
AppEvent::PluginInstallAuthAdvance { refresh_connectors } => {
if refresh_connectors {
self.chat_widget.refresh_connectors(/*force_refetch*/ true);
@@ -1668,18 +1671,18 @@ impl App {
self.chat_widget.open_manage_skills_popup();
}
AppEvent::SetSkillEnabled { path, enabled } => {
let edits = [ConfigEdit::SetSkillConfig {
path: path.to_path_buf(),
match crate::config_update::write_skill_enabled(
app_server.request_handle(),
path.clone(),
enabled,
}];
match ConfigEditsBuilder::for_config(&self.config)
.with_edits(edits)
.apply()
.await
)
.await
{
Ok(()) => {
self.chat_widget.update_skill_enabled(path, enabled);
if let Err(err) = self.refresh_in_memory_config_from_disk().await {
if !app_server.is_remote()
&& let Err(err) = self.refresh_in_memory_config_from_disk().await
{
tracing::warn!(
error = %err,
"failed to refresh config after skill toggle"
@@ -1697,44 +1700,35 @@ impl App {
AppEvent::SetAppEnabled { id, enabled } => {
let edits = if enabled {
vec![
ConfigEdit::ClearPath {
segments: vec!["apps".to_string(), id.clone(), "enabled".to_string()],
},
ConfigEdit::ClearPath {
segments: vec![
"apps".to_string(),
id.clone(),
"disabled_reason".to_string(),
],
},
crate::config_update::clear_config_value(
crate::config_update::app_scoped_key_path(&id, "enabled"),
),
crate::config_update::clear_config_value(
crate::config_update::app_scoped_key_path(&id, "disabled_reason"),
),
]
} else {
vec![
ConfigEdit::SetPath {
segments: vec!["apps".to_string(), id.clone(), "enabled".to_string()],
value: false.into(),
},
ConfigEdit::SetPath {
segments: vec![
"apps".to_string(),
id.clone(),
"disabled_reason".to_string(),
],
value: "user".into(),
},
crate::config_update::replace_config_value(
crate::config_update::app_scoped_key_path(&id, "enabled"),
serde_json::json!(false),
),
crate::config_update::replace_config_value(
crate::config_update::app_scoped_key_path(&id, "disabled_reason"),
serde_json::json!("user"),
),
]
};
match ConfigEditsBuilder::for_config(&self.config)
.with_edits(edits)
.apply()
match crate::config_update::write_config_batch(app_server.request_handle(), edits)
.await
{
Ok(()) => {
Ok(_) => {
self.chat_widget.update_connector_enabled(&id, enabled);
if let Err(err) = self.refresh_in_memory_config_from_disk().await {
if !app_server.is_remote()
&& let Err(err) = self.refresh_in_memory_config_from_disk().await
{
tracing::warn!(error = %err, "failed to refresh config after app toggle");
}
self.chat_widget.submit_op(AppCommand::reload_user_config());
}
Err(err) => {
self.chat_widget.add_error_message(format!(