mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
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:
1 parent
122d55cba8
commit
68bc5369ba
12 files changed
+120
-25
No files matched your search
@@ -14,6 +14,7 @@ use pretty_assertions::assert_eq;
|
||||
#[tokio::test]
|
||||
async fn worktree_creation_event_requires_feature() -> Result<()> {
|
||||
let (mut app, mut events, _op_rx) = make_test_app_with_channels().await;
|
||||
app.config.features.disable(Feature::Worktrees)?;
|
||||
let mut tui = crate::tui::test_support::make_test_tui()?;
|
||||
let mut app_server = Box::pin(crate::start_embedded_app_server_for_picker(&app.config)).await?;
|
||||
while events.try_recv().is_ok() {}
|
||||
@@ -35,7 +36,7 @@ async fn worktree_creation_event_requires_feature() -> Result<()> {
|
||||
_ => None,
|
||||
})
|
||||
.expect("disabled feature message");
|
||||
insta::assert_snapshot!(message, @"■ Enable worktrees in /experimental to create a worktree.");
|
||||
insta::assert_snapshot!(message, @"■ Enable worktrees in your Codex configuration to create a worktree.");
|
||||
assert!(!app.config.codex_home.join("worktrees").exists());
|
||||
app_server.shutdown().await?;
|
||||
Ok(())
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
use super::*;
|
||||
use codex_app_server_protocol::JSONRPCErrorError;
|
||||
use codex_app_server_protocol::ThreadBackgroundTerminalsListResponse;
|
||||
use pretty_assertions::assert_eq;
|
||||
|
||||
#[test]
|
||||
fn old_local_daemon_worktree_error_suggests_update() -> Result<()> {
|
||||
let target = AppServerTarget::LocalDaemon {
|
||||
endpoint: crate::RemoteAppServerEndpoint::UnixSocket {
|
||||
socket_path: AbsolutePathBuf::relative_to_current_dir("codex.sock")?,
|
||||
},
|
||||
};
|
||||
let missing_method = |code, message: &str| {
|
||||
Err(TypedRequestError::Server {
|
||||
method: "thread/backgroundTerminals/list".to_string(),
|
||||
source: JSONRPCErrorError {
|
||||
code,
|
||||
message: message.to_string(),
|
||||
data: None,
|
||||
},
|
||||
})
|
||||
};
|
||||
let message = managed_worktree_creation::background_terminals_blocker(
|
||||
missing_method(-32601, "method not found"),
|
||||
&target,
|
||||
)
|
||||
.expect("unsupported daemon must block worktree creation");
|
||||
let cell = crate::history_cell::new_error_event(message.to_string());
|
||||
insta::assert_snapshot!(
|
||||
lines_to_single_string(&cell.display_lines(/*width*/ 120)),
|
||||
@"■ The local Codex service cannot check background terminals. Run `codex app-server daemon update`, then restart Codex."
|
||||
);
|
||||
assert_eq!(
|
||||
managed_worktree_creation::background_terminals_blocker(
|
||||
missing_method(
|
||||
-32600,
|
||||
"Invalid request: unknown variant `thread/backgroundTerminals/list`"
|
||||
),
|
||||
&target,
|
||||
),
|
||||
Some(message),
|
||||
);
|
||||
assert_eq!(
|
||||
managed_worktree_creation::background_terminals_blocker(
|
||||
missing_method(-32600, "Invalid request: unknown variant `another/method`"),
|
||||
&target,
|
||||
),
|
||||
Some("Active background terminals block /cd."),
|
||||
);
|
||||
assert_eq!(
|
||||
managed_worktree_creation::background_terminals_blocker(
|
||||
missing_method(-32601, "method not found"),
|
||||
&AppServerTarget::Embedded,
|
||||
),
|
||||
Some("Active background terminals block /cd."),
|
||||
);
|
||||
assert_eq!(
|
||||
managed_worktree_creation::background_terminals_blocker(
|
||||
Ok(ThreadBackgroundTerminalsListResponse {
|
||||
data: Vec::new(),
|
||||
next_cursor: None,
|
||||
}),
|
||||
&target,
|
||||
),
|
||||
None,
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
Reference in new issue
Block a user