Skip to content

feat(vscode): edit queued messages in the prompt input - #13556

Merged
marius-kilocode merged 2 commits into
mainfrom
allow-editing-queued-messages
Aug 28, 2026
Merged

feat(vscode): edit queued messages in the prompt input#13556
marius-kilocode merged 2 commits into
mainfrom
allow-editing-queued-messages

Conversation

@marius-kilocode

@marius-kilocode marius-kilocode commented Aug 28, 2026

Copy link
Copy Markdown
Collaborator

What Problem This Solves

Queued messages can be removed, but correcting one currently requires deleting it and reconstructing the prompt. Editing must also remove the message from the queue before it can run, rather than leave a live queued copy behind.

Why This Change Was Made

Add the standard small Edit action beside queued-message removal. It waits for confirmed, queue-only deletion before restoring the prompt to the input. The backend rejects messages that have already started, including messages that finish before the deletion request arrives. Failed deletion leaves the message untouched.

The implementation reuses the existing prompt restoration and draft storage. It does not add an inline editor or edit-specific toasts. Missing deletion responses time out after 10 seconds; disconnects and session deletion also release the pending edit and its listener.

User Impact

  • Edit removes the selected queued message and restores its content to the focused prompt input.
  • Edit is disabled while the input already contains text, images, or review comments, or while an input operation is pending.
  • Other queued messages keep their order. Submitting the edited prompt queues it at the end with a new message ID.
  • Pasted images and exact file/session references are retained. Restored drafts stay scoped to their session and prompt box.

Evidence

  • Extension build, host/webview type checks, ESLint, and Knip passed after rebasing onto current main.
  • All 4,488 extension unit tests passed, plus 48 backend route/queue tests. Coverage includes waiting-message removal, rejection of active/completed messages, and real-timer cleanup for missing responses, disconnects, errors, and session deletion; backend type checking passed.
  • Real isolated VS Code tests used a deterministic loopback provider, without real credentials or external model calls. The provider recorded Second queued message followed by Edited first message; First queued message was never sent.
  • Screenshots below cover every tested UI case. Timing-only rejection and missing-response cleanup are covered by integration and unit tests. Images are hosted separately and are not included in the code diff.
1. Multiple queued messages and an existing draft

With an empty input, both queued messages expose Edit. Entering a draft disables both Edit buttons without changing the draft, deleting either queued message, or showing a toast.

Two queued messages with Edit available and an empty prompt input An existing input draft disables both queued-message Edit buttons
2. Move to input and resubmit without sending the original

Editing the first message removes only that queued row and focuses its content in the input. After editing and resubmitting, the remaining second message runs first, followed by the edited message.

The first queued message is restored to the input while the second stays queued The second queued message runs before the resubmitted edited first message
3. Image-only queued messages

An image-only message exposes the same Edit action. Editing removes its queued row and restores the image attachment to the otherwise empty input.

An image-only queued message exposes the standard Edit action The image is restored to the input and its queued row is gone
4. Exact file mentions and session-isolated drafts

A filename containing a space and Unicode characters remains a recognized mention after editing. Switching to another tab and entering a different draft does not overwrite the restored prompt. Switching back retains the exact mention; returning to the other tab also retains its draft.

The restored prompt retains the exact notes résumé.ts file mention A different session keeps its own input draft Switching back restores the original prompt and recognized file mention

Comment thread packages/kilo-vscode/webview-ui/src/context/session.tsx Outdated
@kilo-code-bot

kilo-code-bot Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (3 files)
  • packages/kilo-vscode/tests/unit/session-queue.test.ts
  • packages/kilo-vscode/webview-ui/src/context/session-queue.ts
  • packages/kilo-vscode/webview-ui/src/context/session.tsx
Previous Review Summary (commit 52d4247)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit 52d4247)

Status: 1 Issue Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 0
Issue Details (click to expand)

WARNING

File Line Issue
packages/kilo-vscode/webview-ui/src/context/session.tsx 2750 deleteQueuedMessage can hang forever and leak its listener, leaving the prompt locked
Files Reviewed (22 files)
  • .changeset/edit-queued-messages.md
  • packages/kilo-ui/src/components/message-part.tsx
  • packages/kilo-vscode/src/KiloProvider.ts
  • packages/kilo-vscode/tests/unit/kilo-provider-load-messages.test.ts
  • packages/kilo-vscode/tests/unit/prompt-drafts.test.ts
  • packages/kilo-vscode/webview-ui/src/components/chat/ChatView.tsx
  • packages/kilo-vscode/webview-ui/src/components/chat/MessageList.tsx
  • packages/kilo-vscode/webview-ui/src/components/chat/PromptInput.tsx
  • packages/kilo-vscode/webview-ui/src/components/chat/TranscriptRow.tsx
  • packages/kilo-vscode/webview-ui/src/components/chat/VscodeUserMessage.tsx
  • packages/kilo-vscode/webview-ui/src/context/session-types.ts
  • packages/kilo-vscode/webview-ui/src/context/session.tsx - 1 issue
  • packages/kilo-vscode/webview-ui/src/types/messages/extension-messages.ts
  • packages/kilo-vscode/webview-ui/src/types/messages/webview-messages.ts
  • packages/kilo-vscode/webview-ui/src/utils/draft-store.ts
  • packages/opencode/src/server/routes/instance/httpapi/groups/session.ts
  • packages/opencode/src/server/routes/instance/httpapi/handlers/session.ts
  • packages/opencode/src/server/routes/instance/httpapi/public.ts
  • packages/opencode/test/server/httpapi-session.test.ts
  • packages/sdk/js/src/v2/gen/sdk.gen.ts
  • packages/sdk/js/src/v2/gen/types.gen.ts
  • packages/sdk/openapi.json

Fix these issues in Kilo Cloud


Reviewed by grok-4.6 · Input: 123.9K · Output: 10K · Cached: 433.8K

Review guidance: REVIEW.md from base branch main

copyText?: string
header?: JSX.Element
edit?: { label: string; onClick: () => void; disabled?: boolean }
queuedDisabled?: boolean

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: this is one of those boolean fields I have mentioned in other venues. Nothing wrong with it, but just to underline what I was referring to.

/** When true (subagent viewer), replace the welcome screen with an initializing indicator */
readonly?: boolean
queuedDisabled?: boolean
editDisabled?: boolean

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: two boolean fields added ... I still believe all of them could be aggregated as single, reactive, state field, which most items lack for what I've read so far.

@WebReflection WebReflection left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added comments as notes, as we discussed this internally. Yet looks good to me.

@marius-kilocode
marius-kilocode merged commit 2c3b545 into main Aug 28, 2026
34 checks passed
@marius-kilocode
marius-kilocode deleted the allow-editing-queued-messages branch August 28, 2026 17:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants