[chore] add additional_details to StreamErrorEvent + wire through (#8307)

### What

Builds on #8293.

Add `additional_details`, which contains the upstream error message, to
relevant structures used to pass along retryable `StreamError`s.

Uses the new TUI status indicator's `details` field (shows under the
status header) to display the `additional_details` error to the user on
retryable `Reconnecting...` errors. This adds clarity for users for
retryable errors.

Will make corresponding change to VSCode extension to show
`additional_details` as expandable from the `Reconnecting...` cell.

Examples:
<img width="1012" height="326" alt="image"
src="https://github.com/user-attachments/assets/f35e7e6a-8f5e-4a2f-a764-358101776996"
/>

<img width="1526" height="358" alt="image"
src="https://github.com/user-attachments/assets/0029cbc0-f062-4233-8650-cc216c7808f0"
/>
This commit is contained in:
sayan-oai
2025-12-24 10:07:38 -08:00
committed by GitHub
parent 38de0a1de4
commit bf732600ea
12 changed files with 63 additions and 16 deletions

View File

@@ -222,7 +222,15 @@ impl EventProcessor for EventProcessorWithHumanOutput {
EventMsg::BackgroundEvent(BackgroundEventEvent { message }) => {
ts_msg!(self, "{}", message.style(self.dimmed));
}
EventMsg::StreamError(StreamErrorEvent { message, .. }) => {
EventMsg::StreamError(StreamErrorEvent {
message,
additional_details,
..
}) => {
let message = match additional_details {
Some(details) if !details.trim().is_empty() => format!("{message} ({details})"),
_ => message,
};
ts_msg!(self, "{}", message.style(self.dimmed));
}
EventMsg::TaskStarted(_) => {

View File

@@ -145,9 +145,15 @@ impl EventProcessorWithJsonOutput {
};
vec![ThreadEvent::ItemCompleted(ItemCompletedEvent { item })]
}
EventMsg::StreamError(ev) => vec![ThreadEvent::Error(ThreadErrorEvent {
message: ev.message.clone(),
})],
EventMsg::StreamError(ev) => {
let message = match &ev.additional_details {
Some(details) if !details.trim().is_empty() => {
format!("{} ({})", ev.message, details)
}
_ => ev.message.clone(),
};
vec![ThreadEvent::Error(ThreadErrorEvent { message })]
}
EventMsg::PlanUpdate(ev) => self.handle_plan_update(ev),
_ => Vec::new(),
}

View File

@@ -583,6 +583,7 @@ fn stream_error_event_produces_error() {
EventMsg::StreamError(codex_core::protocol::StreamErrorEvent {
message: "retrying".to_string(),
codex_error_info: Some(CodexErrorInfo::Other),
additional_details: None,
}),
));
assert_eq!(