Surface model provider authentication recovery progress (#41239)

## What changed

- Emit turn-scoped authentication recovery started and completed events when a model provider refreshes expired credentials.
- Add stable `modelProvider/authRecoveryStarted` and `modelProvider/authRecoveryCompleted` app-server notifications with the thread, turn, provider, and user-facing message.
- Show recovery progress in the TUI and `codex exec`, including Amazon Bedrock session reauthentication.

## Testing

- Cover provider recovery success and failure events, app-server routing, client rendering, and Amazon Bedrock credential refresh.

GitOrigin-RevId: 3010c38d0676f18bced27761cf86dd38344d09f9
This commit is contained in:
alexsong-oai authored and copyberry committed 2026-08-28 01:14:02 +00:00
1 parent f1bb4c168d
commit 41d3dc56a0
33 files changed
+611 -11

No files matched your search

+8
View File
@@ -152,6 +152,14 @@ impl ChatWidget {
ServerNotification::ModelSafetyBufferingUpdated(notification) => {
self.on_model_safety_buffering_updated(notification, replay_kind)
}
ServerNotification::AuthRecoveryStarted(notification) => {
self.add_info_message(notification.message, /*hint*/ None)
}
ServerNotification::AuthRecoveryCompleted(notification) => {
self.add_plain_history_lines(vec![
vec!["✓ ".green(), notification.message.into()].into(),
]);
}
ServerNotification::Warning(notification) => self.on_warning(notification.message),
ServerNotification::GuardianWarning(notification) => {
if !notification
@@ -1,4 +1,5 @@
use super::*;
use codex_app_server_protocol::AuthRecoveryNotification;
use codex_protocol::error::CodexErr;
use codex_protocol::error::CodexErrorDetails;
use pretty_assertions::assert_eq;
@@ -730,6 +731,32 @@ async fn live_app_server_warning_notification_renders_message() {
),
"expected warning guidance, got {rendered}"
);
let notification = AuthRecoveryNotification {
thread_id: "thread-1".to_string(),
turn_id: "turn-1".to_string(),
provider: "example".to_string(),
message: "Session expired. Sign in again.".to_string(),
};
let mut recovery_messages = String::new();
for notification in [
ServerNotification::AuthRecoveryStarted(notification.clone()),
ServerNotification::AuthRecoveryCompleted(AuthRecoveryNotification {
message: "Signed in successfully.".to_string(),
..notification
}),
] {
chat.handle_server_notification(notification, /*replay_kind*/ None);
let [cell] = drain_insert_history(&mut rx)
.try_into()
.expect("expected one authentication recovery history cell");
recovery_messages.push_str(&lines_to_single_string(&cell));
}
insta::assert_snapshot!(recovery_messages, @r"
• Session expired. Sign in again.
✓ Signed in successfully.
");
}
#[tokio::test]