Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src-tauri/src/commands/acp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10116,6 +10116,7 @@ pub async fn acp_connect(
db: State<'_, AppDatabase>,
app_handle: tauri::AppHandle,
window: tauri::WebviewWindow,
conversation_windows: State<'_, crate::commands::windows::ConversationWindowState>,
) -> Result<String, AcpError> {
// Resolve through the effective data dir so a custom `CODEG_DATA_DIR`
// reaches the credential helper script the agent's git subprocess
Expand All @@ -10136,13 +10137,17 @@ pub async fn acp_connect(
verify_agent_installed(agent_type).await?;

let emitter = EventEmitter::Tauri(app_handle);
// Not `window.label()` directly: a conversation window is a view the user
// can close mid-turn, so the connection it starts is owned by the workspace
// that opened it. Every other window resolves to itself.
let owner_window_label = conversation_windows.resolve_owner_window(window.label());
manager
.spawn_agent(
agent_type,
working_dir,
session_id,
runtime_env,
window.label().to_string(),
owner_window_label,
emitter,
preferred_mode_id,
preferred_config_values.unwrap_or_default(),
Expand Down
7 changes: 6 additions & 1 deletion src-tauri/src/commands/terminal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ pub(crate) fn prepare_credential_env(

#[cfg(feature = "tauri-runtime")]
#[cfg_attr(feature = "tauri-runtime", tauri::command)]
#[allow(clippy::too_many_arguments)]
pub async fn terminal_spawn(
working_dir: String,
shell: Option<String>,
Expand All @@ -72,6 +73,7 @@ pub async fn terminal_spawn(
manager: State<'_, TerminalManager>,
app_handle: tauri::AppHandle,
window: tauri::WebviewWindow,
conversation_windows: State<'_, crate::commands::windows::ConversationWindowState>,
) -> Result<String, TerminalError> {
let terminal_id = terminal_id
.filter(|id| !id.is_empty() && id.len() <= 256)
Expand All @@ -94,7 +96,10 @@ pub async fn terminal_spawn(
SpawnOptions {
terminal_id,
working_dir,
owner_window_label: window.label().to_string(),
// A conversation window's shells belong to the workspace that
// opened it, so closing the view doesn't strand them (only `main`
// is swept by owner on close). See `resolve_owner_window`.
owner_window_label: conversation_windows.resolve_owner_window(window.label()),
shell,
initial_command,
extra_env,
Expand Down
Loading
Loading