Enable worktrees by default and clarify local daemon errors (#44870)

## What changed

- Mark `worktrees` stable and enable it by default, removing it from `/experimental`. Point users who explicitly disable it to their Codex configuration.
- When a local daemon lacks `thread/backgroundTerminals/list`, block worktree creation and `/cd` with guidance to run `codex app-server daemon update` and restart Codex.

## Testing

Add regression coverage for unsupported local daemon methods, unrelated errors, embedded servers, and empty background terminal lists. Update feature-gating tests to disable worktrees explicitly and remove worktrees from the experimental menu snapshot.

GitOrigin-RevId: 3f21d0ebaa02da11a6aaa2e1ac615b4518fc98d8
This commit is contained in:
Benjamin Carlsson authored and copyberry committed 2026-09-11 17:08:59 +00:00
1 parent 122d55cba8
commit 68bc5369ba
12 files changed
+120 -25

No files matched your search

@@ -10,6 +10,28 @@ use crate::history_cell::McpInventoryLoadingCell as LoadingCell;
use codex_app_server_protocol::ThreadBackgroundTerminalsListParams;
use codex_app_server_protocol::ThreadBackgroundTerminalsListResponse as ListResponse;
pub(super) fn background_terminals_blocker(
result: Result<ListResponse, TypedRequestError>,
target: &AppServerTarget,
) -> Option<&'static str> {
match result {
Ok(response) if response.data.is_empty() => None,
Err(TypedRequestError::Server { source, .. })
if matches!(target, AppServerTarget::LocalDaemon { .. })
&& (source.code == -32601
|| source.code == -32600
&& source.message.contains("thread/backgroundTerminals/list")
&& (source.message.contains("unknown variant")
|| source.message.contains("unknown method"))) =>
{
Some(
"The local Codex service cannot check background terminals. Run `codex app-server daemon update`, then restart Codex.",
)
}
_ => Some("Active background terminals block /cd."),
}
}
impl App {
pub(super) async fn start_managed_worktree(
&mut self,
@@ -19,7 +41,7 @@ impl App {
) {
if !self.config.features.enabled(Feature::Worktrees) {
self.chat_widget.add_error_message(
"Enable worktrees in /experimental to create a worktree.".to_string(),
"Enable worktrees in your Codex configuration to create a worktree.".to_string(),
);
} else if self.config.active_project.is_untrusted() {
self.chat_widget.add_error_message(
@@ -123,8 +145,9 @@ impl App {
.request_handle()
.request_typed::<ListResponse>(request)
.await;
if !matches!(result, Ok(response) if response.data.is_empty()) {
return self.working_directory_error("Active background terminals block /cd.");
if let Some(message) = background_terminals_blocker(result, &self.app_server_target)
{
return self.working_directory_error(message);
}
}
let setup = async {