mirror of
https://github.com/openai/codex.git
synced 2026-04-24 22:54:54 +00:00
Merge branch 'models_manager_config' into renew/cache
This commit is contained in:
@@ -142,17 +142,16 @@ pub async fn run_main(
|
||||
feedback.clone(),
|
||||
)
|
||||
.await;
|
||||
while let Some(msg) = incoming_rx.recv().await {
|
||||
match msg {
|
||||
JSONRPCMessage::Request(r) => processor.process_request(r).await,
|
||||
JSONRPCMessage::Response(r) => processor.process_response(r).await,
|
||||
JSONRPCMessage::Notification(n) => processor.process_notification(n).await,
|
||||
JSONRPCMessage::Error(e) => processor.process_error(e),
|
||||
}
|
||||
while let Some(msg) = incoming_rx.recv().await {
|
||||
match msg {
|
||||
JSONRPCMessage::Request(r) => processor.process_request(r).await,
|
||||
JSONRPCMessage::Response(r) => processor.process_response(r).await,
|
||||
JSONRPCMessage::Notification(n) => processor.process_notification(n).await,
|
||||
JSONRPCMessage::Error(e) => processor.process_error(e),
|
||||
}
|
||||
|
||||
info!("processor task exited (channel closed)");
|
||||
}
|
||||
|
||||
info!("processor task exited (channel closed)");
|
||||
});
|
||||
|
||||
// Task: write outgoing messages to stdout.
|
||||
|
||||
@@ -54,7 +54,12 @@ impl MessageProcessor {
|
||||
config.cli_auth_credentials_store_mode,
|
||||
);
|
||||
let thread_manager = Arc::new(
|
||||
ThreadManager::new((*config).clone(), auth_manager.clone(), SessionSource::VSCode).await,
|
||||
ThreadManager::new(
|
||||
(*config).clone(),
|
||||
auth_manager.clone(),
|
||||
SessionSource::VSCode,
|
||||
)
|
||||
.await,
|
||||
);
|
||||
let codex_message_processor = CodexMessageProcessor::new(
|
||||
auth_manager,
|
||||
|
||||
@@ -3656,9 +3656,8 @@ mod tests {
|
||||
let conversation_id = ThreadId::default();
|
||||
let auth_manager =
|
||||
AuthManager::from_auth_for_testing(CodexAuth::from_api_key("Test API Key"));
|
||||
let models_manager = Arc::new(
|
||||
ModelsManager::new((*config).clone(), auth_manager.clone()).await,
|
||||
);
|
||||
let models_manager =
|
||||
Arc::new(ModelsManager::new((*config).clone(), auth_manager.clone()).await);
|
||||
let agent_control = AgentControl::default();
|
||||
let exec_policy = ExecPolicyManager::default();
|
||||
let (agent_status_tx, _agent_status_rx) = watch::channel(AgentStatus::PendingInit);
|
||||
@@ -3750,9 +3749,8 @@ mod tests {
|
||||
let conversation_id = ThreadId::default();
|
||||
let auth_manager =
|
||||
AuthManager::from_auth_for_testing(CodexAuth::from_api_key("Test API Key"));
|
||||
let models_manager = Arc::new(
|
||||
ModelsManager::new((*config).clone(), auth_manager.clone()).await,
|
||||
);
|
||||
let models_manager =
|
||||
Arc::new(ModelsManager::new((*config).clone(), auth_manager.clone()).await);
|
||||
let agent_control = AgentControl::default();
|
||||
let exec_policy = ExecPolicyManager::default();
|
||||
let (agent_status_tx, _agent_status_rx) = watch::channel(AgentStatus::PendingInit);
|
||||
|
||||
@@ -574,8 +574,8 @@ async fn prefers_apikey_when_config_prefers_apikey_even_with_chatgpt_tokens() {
|
||||
Ok(None) => panic!("No CodexAuth found in codex_home"),
|
||||
Err(e) => panic!("Failed to load CodexAuth: {e}"),
|
||||
};
|
||||
let thread_manager = ThreadManager::new(config.clone(), auth_manager, SessionSource::Exec)
|
||||
.await;
|
||||
let thread_manager =
|
||||
ThreadManager::new(config.clone(), auth_manager, SessionSource::Exec).await;
|
||||
let NewThread { thread: codex, .. } = thread_manager
|
||||
.start_thread(config)
|
||||
.await
|
||||
|
||||
@@ -304,8 +304,8 @@ pub async fn run_main(cli: Cli, codex_linux_sandbox_exe: Option<PathBuf>) -> any
|
||||
true,
|
||||
config.cli_auth_credentials_store_mode,
|
||||
);
|
||||
let thread_manager = ThreadManager::new(config.clone(), auth_manager.clone(), SessionSource::Exec)
|
||||
.await;
|
||||
let thread_manager =
|
||||
ThreadManager::new(config.clone(), auth_manager.clone(), SessionSource::Exec).await;
|
||||
let default_model = thread_manager
|
||||
.get_models_manager()
|
||||
.get_default_model(&config.model, &config, RefreshStrategy::default())
|
||||
|
||||
@@ -104,17 +104,16 @@ pub async fn run_main(
|
||||
std::sync::Arc::new(config),
|
||||
)
|
||||
.await;
|
||||
while let Some(msg) = incoming_rx.recv().await {
|
||||
match msg {
|
||||
JSONRPCMessage::Request(r) => processor.process_request(r).await,
|
||||
JSONRPCMessage::Response(r) => processor.process_response(r).await,
|
||||
JSONRPCMessage::Notification(n) => processor.process_notification(n).await,
|
||||
JSONRPCMessage::Error(e) => processor.process_error(e),
|
||||
}
|
||||
while let Some(msg) = incoming_rx.recv().await {
|
||||
match msg {
|
||||
JSONRPCMessage::Request(r) => processor.process_request(r).await,
|
||||
JSONRPCMessage::Response(r) => processor.process_response(r).await,
|
||||
JSONRPCMessage::Notification(n) => processor.process_notification(n).await,
|
||||
JSONRPCMessage::Error(e) => processor.process_error(e),
|
||||
}
|
||||
|
||||
info!("processor task exited (channel closed)");
|
||||
}
|
||||
|
||||
info!("processor task exited (channel closed)");
|
||||
});
|
||||
|
||||
// Task: write outgoing messages to stdout.
|
||||
|
||||
@@ -58,9 +58,8 @@ impl MessageProcessor {
|
||||
false,
|
||||
config.cli_auth_credentials_store_mode,
|
||||
);
|
||||
let thread_manager = Arc::new(
|
||||
ThreadManager::new((*config).clone(), auth_manager, SessionSource::Mcp).await,
|
||||
);
|
||||
let thread_manager =
|
||||
Arc::new(ThreadManager::new((*config).clone(), auth_manager, SessionSource::Mcp).await);
|
||||
Self {
|
||||
outgoing,
|
||||
initialized: false,
|
||||
|
||||
@@ -394,9 +394,7 @@ async fn make_chatwidget_manual(
|
||||
config: cfg,
|
||||
model: resolved_model.clone(),
|
||||
auth_manager: auth_manager.clone(),
|
||||
models_manager: Arc::new(
|
||||
ModelsManager::new(cfg.clone(), auth_manager).await,
|
||||
),
|
||||
models_manager: Arc::new(ModelsManager::new(cfg.clone(), auth_manager).await),
|
||||
session_header: SessionHeader::new(resolved_model),
|
||||
initial_user_message: None,
|
||||
token_info: None,
|
||||
@@ -437,9 +435,8 @@ async fn make_chatwidget_manual(
|
||||
async fn set_chatgpt_auth(chat: &mut ChatWidget) {
|
||||
chat.auth_manager =
|
||||
AuthManager::from_auth_for_testing(CodexAuth::create_dummy_chatgpt_auth_for_testing());
|
||||
chat.models_manager = Arc::new(
|
||||
ModelsManager::new(chat.config.clone(), chat.auth_manager.clone()).await,
|
||||
);
|
||||
chat.models_manager =
|
||||
Arc::new(ModelsManager::new(chat.config.clone(), chat.auth_manager.clone()).await);
|
||||
}
|
||||
|
||||
pub(crate) async fn make_chatwidget_manual_with_sender() -> (
|
||||
|
||||
@@ -383,9 +383,7 @@ async fn make_chatwidget_manual(
|
||||
config: cfg,
|
||||
model: resolved_model.clone(),
|
||||
auth_manager: auth_manager.clone(),
|
||||
models_manager: Arc::new(
|
||||
ModelsManager::new(cfg.clone(), auth_manager).await,
|
||||
),
|
||||
models_manager: Arc::new(ModelsManager::new(cfg.clone(), auth_manager).await),
|
||||
session_header: SessionHeader::new(resolved_model),
|
||||
initial_user_message: None,
|
||||
token_info: None,
|
||||
@@ -424,9 +422,8 @@ async fn make_chatwidget_manual(
|
||||
async fn set_chatgpt_auth(chat: &mut ChatWidget) {
|
||||
chat.auth_manager =
|
||||
AuthManager::from_auth_for_testing(CodexAuth::create_dummy_chatgpt_auth_for_testing());
|
||||
chat.models_manager = Arc::new(
|
||||
ModelsManager::new(chat.config.clone(), chat.auth_manager.clone()).await,
|
||||
);
|
||||
chat.models_manager =
|
||||
Arc::new(ModelsManager::new(chat.config.clone(), chat.auth_manager.clone()).await);
|
||||
}
|
||||
|
||||
pub(crate) async fn make_chatwidget_manual_with_sender() -> (
|
||||
|
||||
Reference in New Issue
Block a user