mirror of
https://github.com/openai/codex.git
synced 2026-11-13 06:45:07 +00:00
Clarify session exit messages (#40670)
## What changed - Report `Session archived: <thread-id>` after successfully archiving the current session. - Show the session ID when no resume hint is available, including for non-fatal exits. - Keep deleted-thread exits distinct from successful archive exits. ## Testing - Add coverage for archive lifecycle handling and exit-message formatting. GitOrigin-RevId: 1812374e4c74fa1b3f11feb323de18a9dbff745b
This commit is contained in:
1 parent
afb797cae6
commit
731d969d03
6 files changed
+86
-16
No files matched your search
@@ -790,9 +790,10 @@ fn handle_app_exit(exit_info: AppExitInfo) -> anyhow::Result<()> {
|
||||
eprintln!("ERROR: {message}");
|
||||
true
|
||||
}
|
||||
ExitReason::UserRequested | ExitReason::TurnInterrupted | ExitReason::ThreadRemoved => {
|
||||
false
|
||||
}
|
||||
ExitReason::UserRequested
|
||||
| ExitReason::Archived(_)
|
||||
| ExitReason::TurnInterrupted
|
||||
| ExitReason::ThreadRemoved => false,
|
||||
};
|
||||
|
||||
let update_action = exit_info.update_action;
|
||||
@@ -3788,6 +3789,32 @@ mod tests {
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn format_exit_messages_includes_session_id_without_resume_hint() {
|
||||
let mut exit_info = sample_exit_info(
|
||||
Some("123e4567-e89b-12d3-a456-426614174000"),
|
||||
/*thread_name*/ None,
|
||||
);
|
||||
exit_info.token_usage = TokenUsage::default();
|
||||
exit_info.resume_hint = None;
|
||||
let lines = exit_info.format_exit_messages(/*color_enabled*/ false);
|
||||
insta::assert_snapshot!(lines.join("\n"), @"Session ID: 123e4567-e89b-12d3-a456-426614174000");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn format_exit_messages_confirms_archive() {
|
||||
let mut exit_info = sample_exit_info(
|
||||
Some("123e4567-e89b-12d3-a456-426614174000"),
|
||||
/*thread_name*/ None,
|
||||
);
|
||||
exit_info.exit_reason = ExitReason::Archived(exit_info.thread_id.unwrap());
|
||||
let lines = exit_info.format_exit_messages(/*color_enabled*/ false);
|
||||
insta::assert_snapshot!(lines.join("\n"), @"
|
||||
Token usage: total=2 input=0 output=2
|
||||
Session archived: 123e4567-e89b-12d3-a456-426614174000
|
||||
");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn format_exit_messages_includes_session_id_for_fatal_exit_without_resume_hint() {
|
||||
let exit_info = AppExitInfo {
|
||||
|
||||
Reference in new issue
Block a user