Skip to content

feat: label prompts Kilo sends on the user's behalf - #14282

Merged
marius-kilocode merged 7 commits into
mainfrom
improve-injected-prompt-ui
Sep 18, 2026
Merged

marius-kilocode merged 7 commits into
mainfrom
improve-injected-prompt-ui

Conversation

@marius-kilocode

@marius-kilocode marius-kilocode commented Sep 18, 2026 •

Copy link
Copy Markdown
Collaborator

What Problem This Solves

Prompts that Kilo composes for the user looked identical to text the user typed. A worktree base update, an expanded slash-command template, and an editor or terminal code action all rendered as ordinary user bubbles. Because a command such as /review expands to a 371-line template, the transcript also filled up with instructions the user never wrote, and there was no way to tell which message came from where.

Why This Change Was Made

The message schema already carries a persisted TextPart.metadata field, and the review and browser-feedback flows already use it to re-render parts after a reload. This change reuses that mechanism instead of adding a new side channel.

  • TextPart.metadata.kilo.injected = { title } marks a prompt Kilo composed. The extension stamps worktree base updates and editor and terminal code actions, and the CLI stamps the expanded slash-command template in KiloSessionProcessor.markCommand.
  • The user message renders a Sent by Kilo · <title> header above the body, reusing the existing Agent Manager attribution row, so peer prompts and injected prompts read the same way.
  • Injected prompts longer than four lines collapse to their first paragraph and expose the full text through a Show prompt toggle. The bubble fades at its bottom edge while collapsed to signal that the prompt continues.
  • The pull request fix instruction is recognised at the start of the body, so an auto-sent fix is labelled as sent by Kilo, and text the user typed alongside it stays visible while the added instruction stays behind the toggle.
  • Revert and Edit, and the Up-arrow prompt history, restore the command title instead of the full template.

Plain user messages are unchanged: no header, no collapse, no metadata.

User Impact

Users can tell at a glance whether a message came from them or from Kilo, and a long template no longer dominates the transcript while remaining fully inspectable and copyable. The header persists across session reloads because the marker lives in the stored part metadata.

Evidence

Focused checks run from packages/kilo-vscode/ and packages/opencode/:

  • bun run compile (type check, lint, bundle), bun run knip
  • bun test tests/unit/injected-prompt.test.ts tests/unit/base-update.test.ts (29 pass)
  • bun test test/kilocode/session-processor-review-telemetry.test.ts (15 pass)
  • bun run script/check-opencode-annotations.ts for the shared-file changes

Live self-test cases in isolated VS Code with DeepSeek V4.1 Flash: injected command bubble and collapse, Up-arrow history, Revert on a command, Revert on a non-command injected prompt, the editor Explain code action, and the terminal Fix terminal command action.

Screenshots

Live capture from the isolated vscode-self-test run. A /review worktree command collapses the 371-line template to its first paragraph, fades the bottom edge, and offers Show prompt:

Collapsed slash command bubble with a Sent by Kilo header, a Show prompt toggle, the first paragraph of the review template, and a fade at the bottom edge

Editor and terminal code actions are labelled too. Live capture of the Generate terminal command action, including the assistant reply:

Sent by Kilo Generate terminal command bubble with the prompt text and an ls -la assistant reply

Component states from the visual-regression baselines.

A short injected prompt shows the header and the full text, with no toggle:

Sent by Kilo Update from main with the full short prompt text and no toggle

A long single paragraph shows in full, with no false collapse, no fade, and no toggle:

Sent by Kilo /demo with five lines shown in full and no fade or toggle

An auto-sent pull request fix is detected from the body:

Sent by Kilo Fix pull request feedback with the push instruction text

User text sent with the push instruction keeps the user text visible and puts the added instruction behind the toggle:

Kilo added push fixes to the pull request header with the user text visible and a Show prompt toggle

marius-kilocode and others added 2 commits September 18, 2026 11:07
Prompts that Kilo composes for the user (worktree base updates and expanded
slash-command templates) rendered as ordinary user messages. Long templates
also flooded the transcript.

Stamp those parts with metadata.kilo.injected in the message metadata, which
persists with the session. The user bubble now shows a Sent by Kilo header
with the prompt title, collapses long prompts to the first paragraph, and
reveals the full text through Show prompt.

The pull request fix instruction is recognised in the message body so an
auto-sent fix is labelled, and text the user typed alongside it stays visible
while the added instruction stays behind the toggle.
Comment thread packages/kilo-vscode/src/shared/injected-prompt.ts Outdated
@kilo-code-bot

kilo-code-bot Bot commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Summary

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/components/chat/VscodeUserMessage.tsx 61 bubble memo re-runs on every toggle because it reads open()/collapsed(), replacing the focused toggle button and remounting the tooltip.
Files Reviewed (6 files)
  • packages/kilo-docs/public/img/screenshot-tests/kilo-vscode/visual-regression/chat/user-message-injected-command-chromium-linux.png - CI-generated baseline
  • packages/kilo-docs/public/img/screenshot-tests/kilo-vscode/visual-regression/chat/user-message-injected-short-chromium-linux.png - CI-generated baseline
  • packages/kilo-docs/public/img/screenshot-tests/kilo-vscode/visual-regression/chat/user-message-injected-single-paragraph-chromium-linux.png - CI-generated baseline
  • packages/kilo-docs/public/img/screenshot-tests/kilo-vscode/visual-regression/chat/user-message-push-auto-sent-chromium-linux.png - CI-generated baseline
  • packages/kilo-docs/public/img/screenshot-tests/kilo-vscode/visual-regression/chat/user-message-push-mixed-chromium-linux.png - CI-generated baseline
  • packages/kilo-vscode/webview-ui/src/components/chat/VscodeUserMessage.tsx - 1 carried-forward warning (re-verified)

Fix these issues in Kilo Cloud

Previous Review Summaries (2 snapshots, latest commit 9447d5f)

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

Previous review (commit 9447d5f)

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/components/chat/VscodeUserMessage.tsx 61 bubble memo re-runs on every toggle because it reads open()/collapsed(), replacing the focused toggle button and remounting the tooltip.
Files Reviewed (4 files)
  • packages/kilo-vscode/src/shared/injected-prompt.ts - no new issues
  • packages/kilo-vscode/tests/unit/injected-prompt.test.ts - no issues
  • packages/kilo-vscode/webview-ui/src/stories/chat.stories.tsx - no new issues
  • packages/kilo-vscode/webview-ui/src/components/chat/VscodeUserMessage.tsx - 1 carried-forward warning

Fix these issues in Kilo Cloud

Previous review (commit 48c7b0a)

Status: 3 Issues Found | Recommendation: Address before merge

Overview

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

WARNING

File Line Issue
packages/kilo-vscode/webview-ui/src/components/chat/VscodeUserMessage.tsx 61 bubble memo re-runs on toggle, replacing the focused button and remounting the tooltip

SUGGESTION

File Line Issue
packages/kilo-vscode/src/shared/injected-prompt.ts 43 injectedPreview can return the full body, producing a no-op "Show prompt" toggle and misleading fade
packages/kilo-vscode/webview-ui/src/components/chat/VscodeUserMessage.tsx 118 New injected-prompt UI state has no Storybook story
Files Reviewed (12 files)
  • .changeset/injected-prompt-header.md - no issues
  • packages/kilo-docs/public/img/screenshot-tests/kilo-vscode/visual-regression/agentmanager/full-screen-diff-with-changes-chromium-linux.png - CI-generated baseline
  • packages/kilo-vscode/src/agent-manager/base-update.ts - no issues
  • packages/kilo-vscode/src/shared/injected-prompt.ts - 1 suggestion
  • packages/kilo-vscode/src/shared/review-comments.ts - no issues
  • packages/kilo-vscode/tests/unit/base-update.test.ts - no issues
  • packages/kilo-vscode/tests/unit/injected-prompt.test.ts - no issues
  • packages/kilo-vscode/webview-ui/src/components/chat/VscodeUserMessage.tsx - 1 warning, 1 suggestion
  • packages/kilo-vscode/webview-ui/src/styles/chat.css - no issues
  • packages/opencode/src/kilocode/session/processor.ts - no issues
  • packages/opencode/src/session/prompt.ts - no issues
  • packages/opencode/test/kilocode/session-processor-review-telemetry.test.ts - no issues

Fix these issues in Kilo Cloud


Reviewed by deepseek-v4.1-flash · Input: 0 · Output: 0 · Cached: 0

Review guidance: REVIEW.md from base branch main

marius-kilocode and others added 5 commits September 18, 2026 11:26
injectedPreview returned the whole body as its first paragraph when a long
prompt had no blank line, so the bubble showed the fade and a Show prompt
toggle that revealed identical text.

Return no preview when the first paragraph is the entire body. Add unit
coverage and Storybook visual-regression stories for the injected prompt
states: long command, short prompt, single paragraph, auto-sent pull request
fix, and user text with the added push instruction.
…ions

Revert and Edit restored the full expanded template into the prompt input,
and Up-arrow history recalled it. Injected parts now restore only a slash
command title, and other injected prompts restore nothing.

Editor and terminal code actions sent their template as a plain user bubble.
An optional injected title now travels from the extension through the
triggerTask and sendMessage messages, so the host can merge
metadata.kilo.injected without dropping review feedback metadata.
@marius-kilocode
marius-kilocode merged commit 17a5369 into main Sep 18, 2026
34 checks passed
@marius-kilocode
marius-kilocode deleted the improve-injected-prompt-ui branch September 18, 2026 12:45
Le0xFF added a commit to Le0xFF/kilocode that referenced this pull request Sep 26, 2026
Single close-out of the v7.7.5..v7.8.1 (884 commits, 13 slices) upstream window:
- Baselines regenerated once (kilo-vscode store): 24 snapshots updated for window UI changes, 3 broken LFS-pointer baselines recaptured (work-style-onboarding pair, session-tabs pinned), 10 new story baselines added (injected-prompt Kilo-Org#14282 set, pinned/session tabs, full-screen diff); kilo-ui visual job run as health check (store untracked in this fork, outputs not committed).
- Close-out code fixes (2 files, kilo-vscode webview): transcript-search locate() start-anchor boundary attribution and a forceCenter flag for precise Enter-jump centering in MessageList — resolves the window-introduced chat-auto-scroll spec red (pre-sync green, no post-T upstream fix).
- knip.json: ignore @kilocode/sandbox (the sync-introduced unused-dep finding: adopted browser-panel surface imports the new ./destination subpath knip does not track); remaining knip reds pre-date the sync (verified on pre-sync-20260926) and are reported.
- Docs: PRUNE-NOTES history entry for the 2026-09-26 sync + baseline-store path correction (live store = packages/kilo-docs/public/img/screenshot-tests/kilo-vscode, test-fixtures/ absent, LFS rules stale), CHANGELOG 7.8.1 offline-fork section, upstream-sync.md edge-case note (kilo-docs live subtree must never be bulk-removed mid-slice).
- Verified: typecheck/lint/5 guards/check:offline 10/10/check:duplication, test:unit 462/462, test:visual 309 passed+47 skipped+0 failed, offline smoke /provider = 6 local providers only, VSIX re-packed with the fixed bundle (kilo-code-7.8.1-{linux,win32}.vsix), I1-I11 incl. ^1.103.0 floor. No push, no PR.
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