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

@@ -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]