mirror of
https://github.com/openai/codex.git
synced 2026-11-08 20:40:33 +00:00
Clarify service tier default save errors in the TUI (#49835)
## Why When saving the default service tier fails, users need the underlying configuration error and guidance on how to retry without interrupting their task. ## What changed Format the error with `format_config_error` and explain that the task can continue. Tell users to resolve the error, then switch to a different tier and back to the desired tier to retry saving the default. ## Testing Add a snapshot assertion for a rejected service tier save caused by malformed configuration, covering the detailed error and recovery guidance. GitOrigin-RevId: d666f7915f185d219396d24034412b175c49173e
This commit is contained in:
@@ -2525,8 +2525,10 @@ impl App {
|
||||
}
|
||||
Err(err) => {
|
||||
tracing::error!(error = %err, "failed to persist service tier selection");
|
||||
let error = format_config_error(&err);
|
||||
self.chat_widget.add_error_message(format!(
|
||||
"Failed to save default service tier: {err}"
|
||||
"Failed to save default service tier: {error}\n\
|
||||
You can continue this task. To save the default, resolve the error above, then switch to a different tier and back to the desired tier."
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -164,9 +164,18 @@ async fn model_default_saves_report_server_outcomes_and_target_server_profile()
|
||||
] {
|
||||
Box::pin(app.handle_event(&mut tui, &mut server, event)).await?;
|
||||
}
|
||||
let mut service_tier_error = None;
|
||||
let messages = std::iter::from_fn(|| events.try_recv().ok())
|
||||
.filter_map(|event| match event {
|
||||
AppEvent::InsertHistoryCell(cell) => {
|
||||
if outcome == "rejected" {
|
||||
let text = lines_to_single_string(&cell.transcript_lines(/*width*/ 200));
|
||||
if text.contains("Failed to save default service tier") {
|
||||
service_tier_error = Some(
|
||||
text.replace(&profile_path.display().to_string(), "<config-path>"),
|
||||
);
|
||||
}
|
||||
}
|
||||
Some(lines_to_single_string(&cell.transcript_lines(/*width*/ 80)))
|
||||
}
|
||||
_ => None,
|
||||
@@ -186,6 +195,10 @@ async fn model_default_saves_report_server_outcomes_and_target_server_profile()
|
||||
}
|
||||
let persisted = std::fs::read_to_string(&profile_path)?;
|
||||
if outcome == "rejected" {
|
||||
insta::assert_snapshot!(
|
||||
"service_tier_default_save_error",
|
||||
service_tier_error.expect("expected a service-tier save error")
|
||||
);
|
||||
assert_eq!(persisted, "[broken");
|
||||
assert!(!messages.contains("Model changed"));
|
||||
assert!(!messages.contains("Service tier set"));
|
||||
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
---
|
||||
source: tui/src/app/tests/model_defaults_tests.rs
|
||||
expression: "service_tier_error.expect(\"expected a service-tier save error\")"
|
||||
---
|
||||
■ Failed to save default service tier: config/batchWrite failed in TUI: config/batchWrite failed: failed to load configuration: <config-path>:1:8: unclosed table, expected `]` (code -32603)
|
||||
You can continue this task. To save the default, resolve the error above, then switch to a different tier and back to the desired tier.
|
||||
Reference in New Issue
Block a user