mirror of
https://github.com/Kilo-Org/kilocode.git
synced 2026-10-29 18:52:45 +08:00
fix(cli): release session busy state while suggest tool waits for user
The suggest tool blocks on a promise that only resolves when the user accepts or dismisses a suggestion. While blocked, the runner stayed in Running state and the session status remained busy — if the suggestion was never answered (e.g. VS Code was closed), the session was stuck forever and follow-up prompts appeared queued. Mark the session idle while awaiting the user's response; the loop will set it back to busy when the suggestion resolves and processing continues. Fixes #9150
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"kilo-code": patch
|
||||
---
|
||||
|
||||
Fix a stuck session state when the suggest tool was left open. If the suggestion was never accepted or dismissed (for example, because VS Code was closed while it was showing), the session stayed marked as busy and any follow-up messages appeared queued forever. The session is now marked idle while waiting for a response to a suggestion.
|
||||
@@ -5,6 +5,8 @@ import { Effect } from "effect"
|
||||
import DESCRIPTION from "./tool.txt"
|
||||
import { Tool } from "../../tool/tool"
|
||||
import { Suggestion } from "./index"
|
||||
import { SessionStatus } from "../../session/status"
|
||||
import { SessionID } from "../../session/schema"
|
||||
|
||||
const log = Log.create({ service: "tool.suggest" })
|
||||
|
||||
@@ -71,6 +73,13 @@ export const SuggestTool = Tool.define<typeof Params, Meta, never, "suggest">(
|
||||
})
|
||||
ctx.abort.addEventListener("abort", listener, { once: true })
|
||||
|
||||
// Mark the session as idle while waiting for user interaction so the
|
||||
// session doesn't appear stuck/busy. The loop will set it back to busy
|
||||
// when the suggestion resolves and processing continues.
|
||||
await SessionStatus.set(SessionID.make(ctx.sessionID), { type: "idle" }).catch((err) => {
|
||||
log.warn("failed to set idle status", { err })
|
||||
})
|
||||
|
||||
const action = await promise
|
||||
.catch((error) => {
|
||||
if (error instanceof Suggestion.DismissedError) return undefined
|
||||
|
||||
@@ -99,5 +99,6 @@ export namespace SessionStatus {
|
||||
|
||||
export const list = () => runPromise((svc) => svc.list())
|
||||
export const get = (sessionID: SessionID) => runPromise((svc) => svc.get(sessionID))
|
||||
export const set = (sessionID: SessionID, status: Info) => runPromise((svc) => svc.set(sessionID, status))
|
||||
// kilocode_change end
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user