Revert "fix: Explicitly exit CLI to prevent hanging subprocesses (#3083)"

This reverts commit a9624c0fff.
This commit is contained in:
Aiden Cline
2025-10-27 01:30:13 -05:00
parent a9624c0fff
commit 1a6fd018f6
7 changed files with 51 additions and 71 deletions

View File

@@ -74,22 +74,13 @@ export namespace SessionPrompt {
callback: (input: MessageV2.WithParts) => void
}[]
>()
const pending = new Set<Promise<void>>()
const track = (promise: Promise<void>) => {
pending.add(promise)
promise.finally(() => pending.delete(promise))
}
return {
queued,
pending,
track,
}
},
async (current) => {
current.queued.clear()
await Promise.allSettled([...current.pending])
},
)
@@ -200,6 +191,28 @@ export namespace SessionPrompt {
processor,
})
// const permUnsub = (() => {
// const handled = new Set<string>()
// const options = [
// { optionId: "allow_once", kind: "allow_once", name: "Allow once" },
// { optionId: "allow_always", kind: "allow_always", name: "Always allow" },
// { optionId: "reject_once", kind: "reject_once", name: "Reject" },
// ]
// return Bus.subscribe(Permission.Event.Updated, async (event) => {
// const info = event.properties
// if (info.sessionID !== input.sessionID) return
// if (handled.has(info.id)) return
// handled.add(info.id)
// const toolCallId = info.callID ?? info.id
// const metadata = info.metadata ?? {}
// // TODO: emit permission event to bus for ACP to handle
// Permission.respond({ sessionID: info.sessionID, permissionID: info.id, response: "reject" })
// })
// })()
// await using _permSub = defer(() => {
// permUnsub?.()
// })
const params = await Plugin.trigger(
"chat.params",
{
@@ -234,15 +247,13 @@ export namespace SessionPrompt {
step++
await processor.next(msgs.findLast((m) => m.info.role === "user")?.info.id!)
if (step === 1) {
state().track(
ensureTitle({
session,
history: msgs,
message: userMsg,
providerID: model.providerID,
modelID: model.info.id,
}),
)
ensureTitle({
session,
history: msgs,
message: userMsg,
providerID: model.providerID,
modelID: model.info.id,
})
SessionSummary.summarize({
sessionID: input.sessionID,
messageID: userMsg.info.id,
@@ -1719,7 +1730,7 @@ export namespace SessionPrompt {
thinkingBudget: 0,
}
}
await generateText({
generateText({
maxOutputTokens: small.info.reasoning ? 1500 : 20,
providerOptions: ProviderTransform.providerOptions(small.npm, small.providerID, options),
messages: [