Return to the command center while archiving a task (#61619)

## Why

Archiving the current task waits for the server response before returning to the command center, blocking navigation while the request is pending.

## What changed

- Run the archive request in the background after side chat and voice cleanup, hiding the task while it is pending.
- Preserve drafts and approvals until archiving succeeds. On failure, show an error and make the task visible again.
- Keep archive completions across reconnects and route dynamic tool replies through their original reply handles.
- Show `Archiving…` during side chat cleanup. On exit, wait up to five seconds for pending archives and report failures or unconfirmed outcomes.

## Testing

Add coverage for navigation before the archive response, success and failure handling across event channel replacement, preserved drafts, side chat cleanup failures, and exit warnings.

GitOrigin-RevId: 7b6e35cb11159f5be1d0b9fb2082dbd8c7826a94
This commit is contained in:
Benjamin Carlsson
2026-11-15 07:28:15 +00:00
committed by copyberry
parent b016cd1847
commit 02e745f3a0
21 changed files with 498 additions and 102 deletions
+8 -1
View File
@@ -788,7 +788,11 @@ fn handle_app_exit(
};
let update_action = exit_info.update_action;
if !matches!(update_action, Some(UpdateAction::Daemon(_))) {
if matches!(update_action, Some(UpdateAction::Daemon(_))) {
for warning in exit_info.archive_warnings {
eprintln!("{warning}");
}
} else {
let color_enabled = supports_color::on(Stream::Stdout).is_some();
for line in exit_info.format_exit_messages(color_enabled) {
println!("{line}");
@@ -3880,6 +3884,7 @@ enabled = true
thread_id,
thread_name: thread_name.map(str::to_string),
}),
archive_warnings: Vec::new(),
disconnect_info: None,
update_action: None,
exit_reason: ExitReason::UserRequested,
@@ -3892,6 +3897,7 @@ enabled = true
token_usage: TokenUsage::default(),
thread_id: None,
resume_hint: None,
archive_warnings: Vec::new(),
disconnect_info: None,
update_action: None,
exit_reason: ExitReason::UserRequested,
@@ -3952,6 +3958,7 @@ enabled = true
token_usage: TokenUsage::default(),
thread_id: Some(ThreadId::from_string("123e4567-e89b-12d3-a456-426614174000").unwrap()),
resume_hint: None,
archive_warnings: Vec::new(),
disconnect_info: None,
update_action: None,
exit_reason: ExitReason::Fatal("boom".to_string()),