It is possible, when the agent is streaming the tool call, that we will get a permission request on an existing terminal and we need to render that. When Zed controls the terminal this won't happen, but when we are just rendering the output, it can happen and we need to show it. Release Notes: - agent: Fix permission options not rendering on terminal commands
Unified · Split
| @@ -4479,6 +4479,12 @@ impl AcpThreadView { · 4478 unmodified lines | ||
| 4479 | 4479 | ToolCallStatus::Rejected | ToolCallStatus::Canceled | ToolCallStatus::Failed |
| 4480 | 4480 | ); |
| 4481 | 4481 | |
| 4482 | + let confirmation_options = match &tool_call.status { | |
| 4483 | + ToolCallStatus::WaitingForConfirmation { options, .. } => Some(options), | |
| 4484 | + _ => None, | |
| 4485 | + }; | |
| 4486 | + let needs_confirmation = confirmation_options.is_some(); | |
| 4487 | + | |
| 4482 | 4488 | let output = terminal_data.output(); |
| 4483 | 4489 | let command_finished = output.is_some(); |
| 4484 | 4490 | let truncated_output = |
| @@ -4547,7 +4553,7 @@ impl AcpThreadView { · 62 unmodified lines | ||
| 4547 | 4553 | .color(Color::Muted), |
| 4548 | 4554 | ), |
| 4549 | 4555 | ) |
| 4550 | − .when(!command_finished, |header| { | |
| 4556 | + .when(!command_finished && !needs_confirmation, |header| { | |
| 4551 | 4557 | header |
| 4552 | 4558 | .gap_1p5() |
| 4553 | 4559 | .child( |
| @@ -4725,6 +4731,14 @@ impl AcpThreadView { · 171 unmodified lines | ||
| 4725 | 4731 | })), |
| 4726 | 4732 | ) |
| 4727 | 4733 | }) |
| 4734 | + .when_some(confirmation_options, |this, options| { | |
| 4735 | + this.child(self.render_permission_buttons( | |
| 4736 | + options, | |
| 4737 | + entry_ix, | |
| 4738 | + tool_call.id.clone(), | |
| 4739 | + cx, | |
| 4740 | + )) | |
| 4741 | + }) | |
| 4728 | 4742 | .into_any() |
| 4729 | 4743 | } |
| 4730 | 4744 | |