Skip to content

Commit 59a5bf2

Browse files
committed
Track cancelled invocation count and filter empty agent outputs to preserve partial results when only some parallel invocations are cancelled
- in agentic search: cancelling one of multi-invocations break the flow and results from remaining are never shown └── apps └── editor ├── package.json └── src ├── extension.ts ├── features │ ├── agentic-search │ │ └── agentic-search.ts │ └── search-files │ ├── search-files.ts │ ├── search-modes │ │ └── perform-intelligent-search-mode.ts │ └── utils │ ├── prompt-for-intelligent-search-results.ts │ └── show-search-results-quick-pick.ts ├── utils │ └── agentic-cli-invocation │ └── invoke-agentic-cli.ts └── views ├── prompt │ ├── backend │ │ ├── message-handlers │ │ │ └── handle-agentic-search.ts │ │ └── prompt-view-provider.ts │ └── frontend │ ├── Main │ │ └── Main.tsx │ ├── Prompt.tsx │ └── hooks │ └── use-prompt │ └── use-prompt.ts └── settings ├── backend │ └── message-handlers │ ├── handle-get-agentic-search-invocation-count.ts │ └── handle-update-agentic-search-invocation-count.ts ├── frontend │ ├── Home │ │ └── sections │ │ └── GeneralSection.tsx │ └── hooks │ └── use-settings.ts └── types └── messages.ts
1 parent ec9f85a commit 59a5bf2

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,7 @@ export const invoke_agentic_cli = async (params: {
594594
}
595595

596596
const invocation_count = params.invocation_count || 1
597-
let is_cancelled = false
597+
let cancelled_count = 0
598598
const agent_outputs: string[] = []
599599

600600
output_channel.clear()
@@ -617,7 +617,7 @@ export const invoke_agentic_cli = async (params: {
617617
})
618618

619619
if (token.isCancellationRequested) {
620-
is_cancelled = true
620+
cancelled_count++
621621
return
622622
}
623623

@@ -695,7 +695,7 @@ export const invoke_agentic_cli = async (params: {
695695
})
696696

697697
token.onCancellationRequested(() => {
698-
is_cancelled = true
698+
cancelled_count++
699699
child.kill()
700700
resolve()
701701
})
@@ -779,12 +779,12 @@ export const invoke_agentic_cli = async (params: {
779779
break
780780
}
781781

782-
if (is_cancelled) {
782+
if (cancelled_count === invocation_count) {
783783
go_back_to_caller = true
784784
break
785785
}
786786

787-
const agent_output = agent_outputs.join('\n\n')
787+
const agent_output = agent_outputs.filter(Boolean).join('\n\n')
788788

789789
Logger.info({
790790
function_name: 'invoke_agentic_cli',

0 commit comments

Comments
 (0)