Skip to content
Closed
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/restore-vscode-prompt-history.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"kilo-code": patch
---

Restore the newest prompt to keyboard history when starting a new chat.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,23 @@ describe("PromptInput connection guard", () => {
expect(send).toBeGreaterThan(guard)
expect(clear).toBeGreaterThan(send)
})

it("records a dispatched prompt before returning for a changed draft scope", () => {
// Regression source: fbe5f4cb in PR #11442 made fresh sends set draftSessionID synchronously,
// changing draftKey from :new to :pending:<uuid>. The changed key must block UI cleanup,
// but it must not skip recording the already-dispatched prompt in keyboard history.
const start = src.indexOf("const key = draftKey()")
const command = src.indexOf("session.sendCommand(", start)
const message = src.indexOf("session.sendMessage(", command)
const append = src.indexOf("history.append(draft)", message)
const guard = src.indexOf("if (draftKey() !== key) return", message)

expect(start).toBeGreaterThan(-1)
expect(command).toBeGreaterThan(start)
expect(message).toBeGreaterThan(command)
expect(append).toBeGreaterThan(message)
expect(guard).toBeGreaterThan(append)
})
})

describe("PromptInput sandbox toggle", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1079,9 +1079,9 @@ export const PromptInput: Component<PromptInputProps> = (props) => {
reviewDrafts.delete(key)
imageDrafts.delete(key)
scrolls.delete(key)
history.append(draft)
if (draftKey() !== key) return

history.append(draft)
history.reset()
setText("")
clearReviewComments()
Expand Down