mirror of
https://github.com/openai/codex.git
synced 2026-09-03 14:59:03 +00:00
changes
This commit is contained in:
@@ -35,6 +35,7 @@ use codex_app_server_protocol::AppTemplateUnavailableReason;
|
||||
use codex_app_server_protocol::AppsListParams;
|
||||
use codex_app_server_protocol::AppsListResponse;
|
||||
use codex_app_server_protocol::AskForApproval;
|
||||
use codex_app_server_protocol::AuthMode;
|
||||
use codex_app_server_protocol::CancelLoginAccountParams;
|
||||
use codex_app_server_protocol::CancelLoginAccountResponse;
|
||||
use codex_app_server_protocol::CancelLoginAccountStatus;
|
||||
|
||||
@@ -832,7 +832,7 @@ impl AccountRequestProcessor {
|
||||
}
|
||||
}
|
||||
|
||||
async fn logout_common(&self) -> Result<(), JSONRPCErrorError> {
|
||||
async fn logout_common(&self) -> std::result::Result<Option<AuthMode>, JSONRPCErrorError> {
|
||||
// Cancel any active login attempt.
|
||||
{
|
||||
let mut guard = self.active_login.lock().await;
|
||||
@@ -846,7 +846,12 @@ impl AccountRequestProcessor {
|
||||
Some(CodexAuth::BedrockApiKey(_))
|
||||
);
|
||||
if self.config.model_provider.is_amazon_bedrock() && !managed_bedrock_auth {
|
||||
return Ok(());
|
||||
return Ok(self
|
||||
.auth_manager
|
||||
.auth_cached()
|
||||
.as_ref()
|
||||
.map(CodexAuth::api_auth_mode)
|
||||
.map(auth_mode_to_api));
|
||||
}
|
||||
|
||||
match self.auth_manager.logout_with_revoke().await {
|
||||
@@ -867,16 +872,26 @@ impl AccountRequestProcessor {
|
||||
clear_user_model_provider_if_bedrock(&self.config_manager).await?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
// Reflect the current auth method after logout (likely None).
|
||||
Ok(self
|
||||
.auth_manager
|
||||
.auth_cached()
|
||||
.as_ref()
|
||||
.map(CodexAuth::api_auth_mode)
|
||||
.map(auth_mode_to_api))
|
||||
}
|
||||
|
||||
async fn logout_v2(&self, request_id: ConnectionRequestId) -> Result<(), JSONRPCErrorError> {
|
||||
let result = self.logout_common().await;
|
||||
let account_updated = if result.is_ok() {
|
||||
Some(self.current_account_updated_notification())
|
||||
} else {
|
||||
None
|
||||
};
|
||||
let account_updated =
|
||||
result
|
||||
.as_ref()
|
||||
.ok()
|
||||
.cloned()
|
||||
.map(|auth_mode| AccountUpdatedNotification {
|
||||
auth_mode,
|
||||
plan_type: None,
|
||||
});
|
||||
self.outgoing
|
||||
.send_result(request_id, result.map(|_| LogoutAccountResponse {}))
|
||||
.await;
|
||||
|
||||
Reference in New Issue
Block a user