Clean up tests and restore Default behavior

This commit is contained in:
Channing Conger
2026-06-01 16:10:07 -07:00
parent e58037e2ce
commit ce3b18ae1e
2 changed files with 4 additions and 36 deletions
+3 -23
View File
@@ -157,10 +157,11 @@ pub trait CodeModeSessionProvider: Send + Sync {
}
/// Selects how a code-mode session is provisioned for a Codex session.
#[derive(Clone)]
#[derive(Clone, Default)]
pub enum SessionProviderSelection {
InProcess,
#[default]
Disabled,
InProcess,
Custom(Arc<dyn CodeModeSessionProvider>),
}
@@ -894,7 +895,6 @@ mod tests {
use super::PendingRuntimeMode;
use super::RuntimeCommand;
use super::RuntimeResponse;
use super::SessionProviderSelection;
use super::WaitOutcome;
use super::WaitRequest;
use super::WaitToPendingOutcome;
@@ -968,26 +968,6 @@ mod tests {
);
}
#[tokio::test]
async fn provider_selection_can_use_in_process_or_disable() {
let delegate = Arc::new(NoopCodeModeSessionDelegate);
assert!(
SessionProviderSelection::InProcess
.create_session(delegate.clone())
.await
.unwrap()
.is_some()
);
assert!(
SessionProviderSelection::Disabled
.create_session(delegate)
.await
.unwrap()
.is_none()
);
}
#[tokio::test]
async fn stored_values_are_shared_between_cells_but_not_sessions() {
let first_session = CodeModeService::new();
+1 -13
View File
@@ -151,7 +151,7 @@ fn is_multi_agent_v2_usage_hint_message(item: &ResponseItem, usage_hint_texts: &
/// An `AgentControl` instance is intended to be created at most once per root thread/session
/// tree. That same `AgentControl` is then shared with every sub-agent spawned from that root,
/// which keeps the registry scoped to that root thread rather than the entire `ThreadManager`.
#[derive(Clone)]
#[derive(Clone, Default)]
pub(crate) struct AgentControl {
/// ID shared by the whole agent control session. This means every sub-agents from a common
/// root share the same session ID.
@@ -164,18 +164,6 @@ pub(crate) struct AgentControl {
code_mode_session_provider_selection: codex_code_mode::SessionProviderSelection,
}
impl Default for AgentControl {
fn default() -> Self {
Self {
session_id: SessionId::default(),
manager: Weak::new(),
state: Arc::new(AgentRegistry::default()),
code_mode_session_provider_selection:
codex_code_mode::SessionProviderSelection::Disabled,
}
}
}
impl AgentControl {
/// Construct a new `AgentControl` that can spawn/message agents via the given manager state.
pub(crate) fn new(