Skip to content

refactor(vscode): extract prompt sandbox response handling - #13537

Merged
marius-kilocode merged 1 commit into
mainfrom
refactor-prompt-sandbox-responses
Aug 28, 2026
Merged

refactor(vscode): extract prompt sandbox response handling#13537
marius-kilocode merged 1 commit into
mainfrom
refactor-prompt-sandbox-responses

Conversation

@marius-kilocode

Copy link
Copy Markdown
Collaborator

What Problem This Solves

Sandbox response rules were embedded in the prompt component. Testing late responses, request matching, and retry decisions required source assertions instead of executing the response handler.

Why This Change Was Made

Extract only sandboxDefaultStatus, sandboxStatus, sandboxStatusError, and the existing configUpdated dispatch into a runtime-independent helper. Each response branch has a small function under the normal complexity limit of 20 and reuses applySandboxStates and the existing message/state types.

Signals, request tracking, retry timers, toast rendering, session identity, drafts, sending, keyboard handling, toolbar, rendering, and the current message subscription stay in PromptInput. There are no backend, SDK, configuration, or release-note changes.

User Impact

No intended behavior change. Preserve handled/unhandled results, stale version/revision ordering, matching request cleanup, default versus session handling, and current-session retry callbacks.

Evidence

Passed from packages/kilo-vscode:

bun run lint
bun run typecheck
bun run knip
bun run check-kilocode-change
bun run compile
bun test tests/unit/prompt-sandbox-messages.test.ts tests/unit/prompt-input-utils.test.ts tests/unit/prompt-input-connection-guard.test.ts tests/unit/prompt-send-contract.test.ts

The targeted run passed all 165 tests. The new tests execute the real helper with simple state callbacks. Existing source contracts now check the extracted code and its wiring without removing coverage. An independent read-only review found no behavior changes.

Baseline lint passed at 142db490cc. The earlier session.tsx line-cap failure is not present on this base; no lint caps or shared configuration were changed. The build completed using its active-Bun fallback after the pinned bunx invocation failed. Its unrelated generated SDK change was discarded.

Manual smoke test used isolated VS Code and Kilo storage, a disposable workspace, and a local-only provider. No prompts or model calls were sent. New-chat sandbox toggles received real responses and preserved the draft. Restarting and switching between a draft and a seeded session left the composer usable and restored the draft. The isolated instance and fixture storage were removed.

Manual limit: the empty seeded session received no sandboxStatus, including after an explicit status request and restart, so its sandbox toggle could not be exercised. Session response handling is covered by the runtime tests; this PR does not change request routing.

The sandbox control remains available and the draft is restored after switching sessions

@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 (4 files)
  • packages/kilo-vscode/webview-ui/src/components/chat/prompt-sandbox-messages.ts
  • packages/kilo-vscode/webview-ui/src/components/chat/PromptInput.tsx
  • packages/kilo-vscode/tests/unit/prompt-sandbox-messages.test.ts
  • packages/kilo-vscode/tests/unit/prompt-input-connection-guard.test.ts

Reviewed by grok-4.6 · Input: 204.1K · Output: 9.3K · Cached: 300.5K

Review guidance: REVIEW.md from base branch main

@marius-kilocode
marius-kilocode merged commit 0feab49 into main Aug 28, 2026
23 checks passed
@marius-kilocode
marius-kilocode deleted the refactor-prompt-sandbox-responses branch August 28, 2026 10:46
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