Skip to content

Commit 24f883e

Browse files
committed
fix: Fix fmt and pty E2E test timing
1 parent 69b6819 commit 24f883e

12 files changed

Lines changed: 47 additions & 103 deletions

File tree

codex-rs/core/src/lib.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ pub use mcp_connection_manager::SandboxState;
3838
mod mcp_tool_call;
3939
mod message_history;
4040
mod model_provider_info;
41-
4241
pub mod parse_command;
4342
pub mod powershell;
4443
mod response_processing;
@@ -48,12 +47,9 @@ pub mod token_data;
4847
mod truncate;
4948
mod unified_exec;
5049
mod user_instructions;
51-
pub use model_provider_info::CLAUDE_ACP_PROVIDER_ID;
5250
pub use model_provider_info::DEFAULT_LMSTUDIO_PORT;
5351
pub use model_provider_info::DEFAULT_OLLAMA_PORT;
54-
pub use model_provider_info::GEMINI_ACP_PROVIDER_ID;
5552
pub use model_provider_info::LMSTUDIO_OSS_PROVIDER_ID;
56-
pub use model_provider_info::MOCK_ACP_PROVIDER_ID;
5753
pub use model_provider_info::ModelProviderInfo;
5854
pub use model_provider_info::OLLAMA_OSS_PROVIDER_ID;
5955
pub use model_provider_info::WireApi;

codex-rs/core/src/model_family.rs

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
use codex_protocol::config_types::ReasoningEffort;
22
use codex_protocol::config_types::Verbosity;
33

4-
use crate::CLAUDE_ACP_PROVIDER_ID;
5-
use crate::GEMINI_ACP_PROVIDER_ID;
6-
use crate::MOCK_ACP_PROVIDER_ID;
74
use crate::config::types::ReasoningSummaryFormat;
85
use crate::tools::handlers::apply_patch::ApplyPatchToolType;
96
use crate::tools::spec::ConfigShellToolType;
@@ -129,18 +126,6 @@ pub fn find_family_for_model(slug: &str) -> Option<ModelFamily> {
129126
needs_special_apply_patch_instructions: true,
130127
shell_type: ConfigShellToolType::Local,
131128
)
132-
} else if slug.starts_with("gemini") {
133-
model_family!(
134-
slug, GEMINI_ACP_PROVIDER_ID,
135-
supports_parallel_tool_calls: true,
136-
)
137-
} else if slug.starts_with("claude") {
138-
model_family!(
139-
slug, CLAUDE_ACP_PROVIDER_ID,
140-
supports_parallel_tool_calls: true,
141-
)
142-
} else if slug.starts_with("mock") {
143-
model_family!(slug, MOCK_ACP_PROVIDER_ID)
144129
} else if slug.starts_with("gpt-4.1") {
145130
model_family!(
146131
slug, "gpt-4.1",

codex-rs/core/src/model_provider_info.rs

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ const MAX_REQUEST_MAX_RETRIES: u64 = 100;
3636
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Serialize, Deserialize)]
3737
#[serde(rename_all = "lowercase")]
3838
pub enum WireApi {
39-
/// The OpenAI Responses API. This is used by some internal models.
39+
/// The Responses API exposed by OpenAI at `/v1/responses`.
4040
Responses,
4141

42-
/// The OpenAI Chat Completions API. This is the default.
42+
/// Regular Chat Completions compatible with `/v1/chat/completions`.
4343
#[default]
4444
Chat,
4545
}
@@ -216,17 +216,7 @@ pub const DEFAULT_OLLAMA_PORT: u16 = 11434;
216216
pub const LMSTUDIO_OSS_PROVIDER_ID: &str = "lmstudio";
217217
pub const OLLAMA_OSS_PROVIDER_ID: &str = "ollama";
218218

219-
// ACP provider identifiers (used for model inference, not in built_in_model_providers)
220-
// Actual ACP provider configuration is embedded in AcpAgentConfig from codex_acp::registry
221-
pub const CLAUDE_ACP_PROVIDER_ID: &str = "claude-acp";
222-
pub const GEMINI_ACP_PROVIDER_ID: &str = "gemini-acp";
223-
pub const MOCK_ACP_PROVIDER_ID: &str = "mock-acp";
224-
225219
/// Built-in default provider list.
226-
///
227-
/// Note: ACP providers (mock-acp, claude-acp, gemini-acp) are NOT included here.
228-
/// ACP agent configuration is handled by the `codex_acp::registry` module,
229-
/// which embeds provider info directly in `AcpAgentConfig` to avoid circular dependencies.
230220
pub fn built_in_model_providers() -> HashMap<String, ModelProviderInfo> {
231221
use ModelProviderInfo as P;
232222

codex-rs/mock-acp-agent/src/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ use tokio::time::sleep;
1414
use tokio_util::compat::TokioAsyncReadCompatExt as _;
1515
use tokio_util::compat::TokioAsyncWriteCompatExt as _;
1616

17+
#[allow(clippy::large_enum_variant)]
1718
enum MockClientRequest {
1819
ReadFile {
1920
session_id: acp::SessionId,

codex-rs/tui-pty-e2e/src/lib.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use anyhow::Result;
2-
use portable_pty::native_pty_system;
32
use portable_pty::CommandBuilder;
43
use portable_pty::PtySize;
4+
use portable_pty::native_pty_system;
55
use std::collections::HashMap;
66
use std::io::Read;
77
use std::io::Write;
@@ -547,7 +547,8 @@ fn codex_binary_path() -> String {
547547
}
548548

549549
pub const TIMEOUT: Duration = Duration::from_secs(5);
550-
pub const TIMEOUT_INPUT: Duration = Duration::from_millis(300);
550+
pub const TIMEOUT_INPUT: Duration = Duration::from_millis(100);
551+
pub const TIMEOUT_PRESNAPSHOT: Duration = Duration::from_millis(500);
551552

552553
/// Normalize dynamic content in screen output for snapshot testing
553554
pub fn normalize_for_snapshot(contents: String) -> String {

codex-rs/tui-pty-e2e/tests/acp_mode.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@
66
//! 3. Permission requests from ACP agents are properly displayed in the TUI
77
88
use std::time::Duration;
9-
use tui_pty_e2e::normalize_for_input_snapshot;
109
use tui_pty_e2e::Key;
1110
use tui_pty_e2e::SessionConfig;
12-
use tui_pty_e2e::TuiSession;
1311
use tui_pty_e2e::TIMEOUT;
1412
use tui_pty_e2e::TIMEOUT_INPUT;
13+
use tui_pty_e2e::TIMEOUT_PRESNAPSHOT;
14+
use tui_pty_e2e::TuiSession;
15+
use tui_pty_e2e::normalize_for_input_snapshot;
1516

1617
/// Test that ACP mode starts successfully with mock-model
1718
#[test]
@@ -160,8 +161,7 @@ fn test_acp_mode_startup_snapshot() {
160161
.wait_for_text("›", TIMEOUT)
161162
.expect("ACP mode should start");
162163

163-
std::thread::sleep(TIMEOUT_INPUT);
164-
164+
std::thread::sleep(TIMEOUT_PRESNAPSHOT);
165165
insta::assert_snapshot!(
166166
"acp_mode_startup",
167167
normalize_for_input_snapshot(session.screen_contents())

codex-rs/tui-pty-e2e/tests/acp_tool_calls.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,13 @@
2626
//! ```
2727
2828
use std::time::Duration;
29-
use tui_pty_e2e::normalize_for_input_snapshot;
3029
use tui_pty_e2e::Key;
3130
use tui_pty_e2e::SessionConfig;
32-
use tui_pty_e2e::TuiSession;
3331
use tui_pty_e2e::TIMEOUT;
3432
use tui_pty_e2e::TIMEOUT_INPUT;
33+
use tui_pty_e2e::TIMEOUT_PRESNAPSHOT;
34+
use tui_pty_e2e::TuiSession;
35+
use tui_pty_e2e::normalize_for_input_snapshot;
3536

3637
/// Test that an ACP tool call is rendered in the TUI
3738
///
@@ -194,8 +195,7 @@ fn test_acp_tool_call_snapshot() {
194195
.wait_for_text("Read complete", Duration::from_secs(10))
195196
.expect("Should receive response");
196197

197-
std::thread::sleep(TIMEOUT_INPUT);
198-
198+
std::thread::sleep(TIMEOUT_PRESNAPSHOT);
199199
insta::assert_snapshot!(
200200
"acp_tool_call_rendered",
201201
normalize_for_input_snapshot(session.screen_contents())

codex-rs/tui-pty-e2e/tests/input_handling.rs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
use insta::assert_snapshot;
22
use std::time::Duration;
3-
use tui_pty_e2e::normalize_for_input_snapshot;
43
use tui_pty_e2e::Key;
5-
use tui_pty_e2e::TuiSession;
64
use tui_pty_e2e::TIMEOUT;
7-
use tui_pty_e2e::TIMEOUT_INPUT;
5+
use tui_pty_e2e::TIMEOUT_PRESNAPSHOT;
6+
use tui_pty_e2e::TuiSession;
7+
use tui_pty_e2e::normalize_for_input_snapshot;
88

99
#[test]
1010
fn test_ctrl_c_clears_input() {
@@ -23,9 +23,7 @@ fn test_ctrl_c_clears_input() {
2323
.wait_for(|s| !s.contains("draft message"), TIMEOUT)
2424
.expect("Input was not cleared");
2525

26-
std::thread::sleep(TIMEOUT_INPUT);
27-
std::thread::sleep(TIMEOUT_INPUT);
28-
std::thread::sleep(TIMEOUT_INPUT);
26+
std::thread::sleep(TIMEOUT_PRESNAPSHOT);
2927
assert_snapshot!(
3028
"ctrl_c_clears",
3129
normalize_for_input_snapshot(session.screen_contents())
@@ -48,9 +46,7 @@ fn test_backspace() {
4846
session.wait_for_text("Hel", TIMEOUT).unwrap();
4947
session.wait_for(|s| !s.contains("Hello"), TIMEOUT).unwrap();
5048

51-
std::thread::sleep(TIMEOUT_INPUT);
52-
std::thread::sleep(TIMEOUT_INPUT);
53-
std::thread::sleep(TIMEOUT_INPUT);
49+
std::thread::sleep(TIMEOUT_PRESNAPSHOT);
5450
assert_snapshot!(
5551
"typing_and_backspace",
5652
normalize_for_input_snapshot(session.screen_contents())
@@ -72,9 +68,7 @@ fn test_arrows() {
7268
session.send_key(Key::Down).unwrap();
7369
std::thread::sleep(Duration::from_millis(100));
7470

75-
std::thread::sleep(TIMEOUT_INPUT);
76-
std::thread::sleep(TIMEOUT_INPUT);
77-
std::thread::sleep(TIMEOUT_INPUT);
71+
std::thread::sleep(TIMEOUT_PRESNAPSHOT);
7872
assert_snapshot!(
7973
"model_changed",
8074
normalize_for_input_snapshot(session.screen_contents())

codex-rs/tui-pty-e2e/tests/manual-test-cancellation.md

Lines changed: 0 additions & 30 deletions
This file was deleted.

codex-rs/tui-pty-e2e/tests/prompt_flow.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
use insta::assert_snapshot;
2-
use tui_pty_e2e::normalize_for_input_snapshot;
32
use tui_pty_e2e::Key;
43
use tui_pty_e2e::SessionConfig;
5-
use tui_pty_e2e::TuiSession;
64
use tui_pty_e2e::TIMEOUT;
75
use tui_pty_e2e::TIMEOUT_INPUT;
6+
use tui_pty_e2e::TIMEOUT_PRESNAPSHOT;
7+
use tui_pty_e2e::TuiSession;
8+
use tui_pty_e2e::normalize_for_input_snapshot;
89

910
#[test]
1011
fn test_submit_prompt_default_response() {
@@ -30,7 +31,7 @@ fn test_submit_prompt_default_response() {
3031
.wait_for_text("Test message 2", TIMEOUT)
3132
.expect("Did not receive second mock response");
3233

33-
std::thread::sleep(TIMEOUT_INPUT);
34+
std::thread::sleep(TIMEOUT_PRESNAPSHOT);
3435
assert_snapshot!(
3536
"prompt_submitted",
3637
normalize_for_input_snapshot(session.screen_contents())
@@ -67,7 +68,7 @@ fn test_submit_prompt_missing_model() {
6768
)
6869
.unwrap();
6970

70-
std::thread::sleep(TIMEOUT_INPUT);
71+
std::thread::sleep(TIMEOUT_PRESNAPSHOT);
7172
assert_snapshot!(
7273
"missing_model",
7374
normalize_for_input_snapshot(session.screen_contents())
@@ -92,7 +93,7 @@ fn test_submit_prompt_custom_response() {
9293
.wait_for_text("This is a custom test response", TIMEOUT)
9394
.expect("Did not receive custom response");
9495

95-
std::thread::sleep(TIMEOUT_INPUT);
96+
std::thread::sleep(TIMEOUT_PRESNAPSHOT);
9697
assert_snapshot!(
9798
"custom_response",
9899
normalize_for_input_snapshot(session.screen_contents())
@@ -112,7 +113,7 @@ fn test_multiline_input() {
112113
session.wait_for_text("Line 2", TIMEOUT).unwrap();
113114
session.wait_for_text("Line 3", TIMEOUT).unwrap();
114115

115-
std::thread::sleep(TIMEOUT_INPUT);
116+
std::thread::sleep(TIMEOUT_PRESNAPSHOT);
116117
assert_snapshot!(
117118
"multiline_input",
118119
normalize_for_input_snapshot(session.screen_contents())

0 commit comments

Comments
 (0)