Fix CLI subagent task routing, Ctrl+C cancellation, and session restore reliability

- Construct ServerTask directly for Bedrock CLI subagents so messages route
  correctly without needing a server CreateTask upgrade
- Handle CliAgentUserQuery input type in both request translators, including
  running command context and terminal output
- Add force_cancel_all_streaming_exchanges fallback for when Ctrl+C finds no
  in-flight streams (stuck subagent / unexpected stream end)
- Cancel active conversation on Ctrl+C in agent view compose state
- Skip agent view entry when agent is tagged-in for a running command
- Set root_task_id on Bedrock requests for proper optimistic task upgrade
- Persist app state on will_terminate to avoid losing sessions
- Trust persisted CWD without is_dir() recheck (fixes network mount restore)
- Log warning instead of silently dropping tabs with unreadable root nodes

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Ryan Ward
2026-06-25 08:43:10 -05:00
co-authored by Claude Opus 4.6
parent 148c97eab1
commit 57c843d1de
11 changed files with 338 additions and 19 deletions
+8 -4
View File
@@ -1552,10 +1552,14 @@ impl PaneGroup {
});
let raw_cwd = terminal_snapshot.cwd.clone();
let startup_directory = terminal_snapshot
.cwd
.map(PathBuf::from)
.filter(|path| path.is_dir());
// Trust the persisted CWD without re-checking is_dir(). The path
// was validated at save time. If the directory no longer exists at
// restore time (e.g. deleted, network mount unavailable), the shell
// bootstrap script's `cd` will fail gracefully and fall back to HOME.
// Previously, the is_dir() check here would discard valid paths that
// were temporarily unavailable (e.g. network mounts not yet mounted
// at startup), causing sessions to always restore to ~/.
let startup_directory = terminal_snapshot.cwd.map(PathBuf::from);
log::info!(
"[session-restore] pane=terminal raw_cwd={raw_cwd:?} \