Skip to content
Merged
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
5 changes: 5 additions & 0 deletions .changeset/clear-drained-question-recovery.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"kilo-code": patch
---

Prevent cleared questions from reappearing after saving settings.
Original file line number Diff line number Diff line change
Expand Up @@ -595,6 +595,7 @@ export class KiloConnectionService {
for (const q of qs) {
const { error } = await client.question.reject({ requestID: q.id, directory: dir })
if (error && !isNotFound(error)) throw new Error(`Failed to reject question ${q.id}: ${String(error)}`)
this.clearQuestionDirectory(q.id)
}
}
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ import { describe, expect, test } from "bun:test"
import { KiloConnectionService } from "../../src/services/cli-backend/connection-service"

describe("KiloConnectionService question routing", () => {
test("ignores stale NotFoundError rejects while draining questions", async () => {
test.each([undefined, { _tag: "NotFound" }])("invalidates recovery after draining (%j)", async (error) => {
const service = new KiloConnectionService({} as any)
const client = {
permission: {
list: async () => ({ data: [] }),
},
question: {
list: async () => ({ data: [{ id: "que_test" }] }),
reject: async () => ({ error: { _tag: "NotFound" } }),
reject: async () => ({ error }),
},
suggestion: {
list: async () => ({ data: [] }),
Expand All @@ -22,8 +22,14 @@ describe("KiloConnectionService question routing", () => {

;(service as any).client = client
;(service as any).directoryProviders.add(() => ["/tmp/workspace"])
service.recordQuestionDirectory("que_test", "/tmp/workspace")
const revisions: number[] = []
service.onClearPendingPrompts(() => revisions.push(service.getQuestionRevision()))

await expect(service.drainPendingPrompts()).resolves.toBeUndefined()

expect(service.getQuestionDirectory("que_test")).toBeUndefined()
expect(revisions).toEqual([1])
})

test("records and clears request origins from SSE events", () => {
Expand Down
Loading