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
+11
View File
@@ -12372,8 +12372,19 @@ impl Input {
// If the agent view is inactive but the current input is detected as AI, submitting
// this query triggers entering the agent view.
//
// Exception: when the agent is "tagged in" for a long-running command, we skip entering
// the agent view (which would fail because `can_start_new_conversation` returns false
// while a command is running). Instead, we fall through to the normal query submission
// path below, which correctly detects the running command and creates a CLI subagent task.
if FeatureFlag::AgentView.is_enabled()
&& !self.agent_view_controller.as_ref(ctx).is_active()
&& !self
.model
.lock()
.block_list()
.active_block()
.is_agent_tagged_in()
{
let prompt = self.editor.as_ref(ctx).buffer_text(ctx);
let prompt = prompt.trim().to_owned();
+5
View File
@@ -6960,6 +6960,11 @@ impl TerminalView {
self.agent_view_controller.update(ctx, |controller, ctx| {
controller.clear_pending_exit_confirmation(ctx);
});
// Also cancel any in-progress conversation so that Ctrl+C while
// composing a message (or after submitting when the buffer hasn't
// cleared yet) properly stops the agent query and returns the
// terminal to a ready state.
self.cancel_active_conversation_via_status_bar(ctx);
return;
}