Skip to content

Commit 74595a4

Browse files
committed
Clean up sandbox directory and guard edit output handling against missing selected root
- in `apps/editor/src/views/prompt/backend/message-handlers/handle-invoke-agentic-cli.ts` only show cli output channel or apply response when the temp folder of the cwd still exists - before disposing the terminal, remove the tmp folder of the sandbox └── apps └── editor └── src ├── commands │ ├── apply-from-terminal-command.ts │ ├── code-at-cursor-command │ │ └── utils │ │ └── perform-code-at-cursor.ts │ └── generate-commit-message-commands │ └── actions │ └── run-generate-action.ts ├── features │ ├── agentic-search │ │ └── agentic-search.ts │ └── search-files │ └── search-modes │ └── perform-intelligent-search-mode.ts ├── utils │ └── agentic-cli-invocation │ ├── agents │ │ ├── antigravity.ts │ │ ├── claude.ts │ │ ├── codex.ts │ │ ├── cursor.ts │ │ ├── devin.ts │ │ ├── grok.ts │ │ ├── index.ts │ │ └── opencode.ts │ ├── index.ts │ ├── invoke-agentic-cli.ts │ ├── types.ts │ └── utils │ ├── check-command-exists.ts │ ├── format-duration.ts │ ├── generate-diff-markdown.ts │ └── get-progress-dots.ts └── views └── prompt └── backend └── message-handlers ├── handle-invoke-agentic-cli.ts ├── handle-patch-repair.ts └── handle-voice-input.ts
1 parent 985fbad commit 74595a4

7 files changed

Lines changed: 20 additions & 20 deletions

File tree

‎apps/editor/src/commands/apply-from-terminal-command.ts‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,15 @@ export const apply_from_terminal_command = (): vscode.Disposable => {
126126
})
127127

128128
if (accepted) {
129+
try {
130+
await fs.promises.rm(cwd_path, { recursive: true, force: true })
131+
} catch (error) {
132+
Logger.error({
133+
function_name: 'apply_from_terminal_command',
134+
message: 'Failed to clean up sandbox directory',
135+
data: error
136+
})
137+
}
129138
active_terminal.dispose()
130139
}
131140
} catch (error) {

‎apps/editor/src/commands/history-command/actions/restore-checkpoint.ts‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,7 @@ export const restore_checkpoint = async (params: {
166166
const history_data =
167167
await vscode.workspace.fs.readFile(history_file_path)
168168
loaded_history = JSON.parse(new TextDecoder().decode(history_data))
169-
} catch {
170-
// Ignore if file doesn't exist
171-
}
169+
} catch {}
172170

173171
if (loaded_history.length > 0) {
174172
params.prompt_view_provider.response_history = loaded_history

‎apps/editor/src/services/websocket-manager.ts‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,7 @@ export class WebSocketManager {
150150
resolve()
151151
return
152152
}
153-
} catch {
154-
// Ignore parse errors and fall through to retry
155-
}
153+
} catch {}
156154
}
157155
retry()
158156
})

‎apps/editor/src/utils/agentic-cli-invocation/invoke-agentic-cli.ts‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -766,9 +766,7 @@ export const invoke_agentic_cli = async (params: {
766766
if (result?.output !== undefined) {
767767
current_agent_output = result.output
768768
}
769-
} catch {
770-
// Ignore parse errors for partial chunks
771-
}
769+
} catch {}
772770
}
773771
} else {
774772
current_agent_output += chunk
@@ -800,9 +798,7 @@ export const invoke_agentic_cli = async (params: {
800798
parsed,
801799
current_agent_output
802800
) ?? current_agent_output
803-
} catch {
804-
// Ignore
805-
}
801+
} catch {}
806802
}
807803

808804
if (

‎apps/editor/src/views/prompt/backend/message-handlers/handle-invoke-agentic-cli.ts‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import * as fs from 'fs'
12
import * as vscode from 'vscode'
23
import { t } from '@/i18n'
34
import { PromptViewProvider } from '@/views/prompt/backend/prompt-view-provider'
@@ -77,12 +78,15 @@ export const handle_invoke_agentic_cli = async (
7778
return
7879
}
7980

80-
const { agent_output, cli_configuration_details } = result
81+
const { agent_output, cli_configuration_details, selected_root } = result
8182

8283
if (
8384
agent_output !== undefined &&
8485
prompt_view_provider.cli_prompt_type === 'edit'
8586
) {
87+
if (!fs.existsSync(selected_root)) {
88+
return
89+
}
8690
if (!agent_output.trim()) {
8791
show_agentic_cli_output_channel()
8892
return

‎apps/editor/src/views/shared/utils/hash-sign-quick-pick/symbols/changes-symbol.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,6 @@ export const handle_changes_item = async (
234234
}
235235
}
236236
} catch {
237-
// ignore
238237
} finally {
239238
if (is_active) {
240239
quick_pick.busy = false

‎apps/editor/src/views/shared/utils/hash-sign-quick-pick/symbols/commit-symbol.ts‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -192,9 +192,7 @@ export const handle_commit_item = async (
192192
['config', '--get', 'remote.origin.url'],
193193
{ cwd: selected_folder.uri.fsPath, encoding: 'utf-8' }
194194
).trim()
195-
} catch {
196-
// ignore
197-
}
195+
} catch {}
198196

199197
const commits_raw = log_output.trim().split('\n')
200198
const commit_items: vscode.QuickPickItem[] = []
@@ -352,9 +350,7 @@ export const handle_commit_item = async (
352350
diff_only_token_count = Math.ceil(
353351
replacement_text_only_diff.length / 4
354352
)
355-
} catch {
356-
// ignore
357-
}
353+
} catch {}
358354

359355
const action_quick_pick = vscode.window.createQuickPick()
360356
const diff_with_message_label = t(

0 commit comments

Comments
 (0)