Repository navigation
Conversation
Code Review SummaryStatus: No Issues Found | Recommendation: Merge The incremental change ( Coverage matches the new behavior: One design tradeoff, not a finding: a retained draft (which can hold a pasted image as a full base64 data URL) now survives Files Reviewed (8 files)
Previous Review Summaries (2 snapshots, latest commit 6194cde)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit 6194cde)Status: No Issues Found | Recommendation: Merge The incremental change ( Note: the PR description and title still describe preserving drafts "during timeout cleanup" and manual test step 4 says to confirm the draft remains after the timeout, which no longer matches the implementation. Since that line is unchanged relative to Files Reviewed (2 files)
Previous review (commit 432e4ab)Status: 1 Issue Found | Recommendation: Address before merge Overview
Issue Details (click to expand)SUGGESTION
The core change is sound: reusing a retained anonymous draft for One resource consideration: Fix these issues in Kilo Cloud Files Reviewed (5 files)
Reviewed by deepseek-v4.1-flash · Input: 86.2K · Output: 26.9K · Cached: 1.3M Review guidance: REVIEW.md from base branch |
WebReflection
left a comment
There was a problem hiding this comment.
Thanks for fixing the immediate navigation loss. The 77 existing session/worktree tests pass, but independent preservation assertions reproduced the two gaps below. Please address them before treating this as a complete fix for #15066.
| assertEquals(listOf("/test" to "ses_1", "/test" to "ses_2", "/test" to "ses_1"), created) | ||
| } | ||
|
|
||
| fun `test hidden session draft is discarded after timeout`() { |
There was a problem hiding this comment.
The timeout case from #15066 remains unresolved: type a draft in an existing session, open History, wait for the inactivity timeout, then reopen the session. Its composer is empty. This test now asserts that loss rather than the issue requested behavior. Could we retain text and attachments separately from the disposable UI and assert restoration after expiry? This is an incomplete part of the original fix, not a new regression.
There was a problem hiding this comment.
Draft text and attachments now survive timeout cleanup and return when reopening the same session, with regression coverage.
| // mirrors the tool window; WorktreeSessionEditorPanel re-runs start() once | ||
| // migration finishes to create the real session. | ||
| if (currentUi() == null) showBlank() | ||
| if (currentUi() == null) showNewSession() |
There was a problem hiding this comment.
The retained fallback draft can become unreachable on recovery: let initial creation fail, enter a draft in the fallback composer, then retry after the backend recovers. The success branch opens a fresh persisted UI with an empty composer. The new release guard retains the old draft/UI, but the worktree New Session override bypasses draft reuse and no list row exposes it. Please transfer/reuse the draft during recovery and extend the existing retry test to cover this.
There was a problem hiding this comment.
The fallback draft now moves into the recovered worktree session, and the retry test verifies that text and attachments survive
|
@WebReflection I've addressed the latest changes as requested. It would probably be a good idea to retest everything, since I haven't tested the latest changes myself. I can help with that, but I don't have time today. |
|
1 . Each existing session keeps its own unique draft when switching between sessions multiple-session-drafts-after.mp4
session-timeout-draft-after.mp4
worktree-recovery-draft-after.mp4NoteAutomatic database cleanup can delete an expired session even when it has an unsent draft, because drafts don’t protect sessions from deletion. |
Issue
Fixes #15066
Context
Unsent prompts and attachments could be lost when navigating between sessions or opening History. Starting a new session should also restore a retained anonymous draft.
Implementation
Keep draft text and attachments in memory separately from inactive session UIs. Timeout cleanup still disposes the UI and controller. Reopening an existing session reloads its history under the same session ID and restores the draft. Saved drafts are cleared when their session is deleted or the host closes.
Reuse hidden anonymous drafts during navigation. When worktree session creation recovers after a backend failure, transfer the fallback composer's draft into the persisted session and dispose the fallback UI.
Screenshots / Video
Before
new-chat-draft-lost-on-history.mp4
After
new-chat-draft-lost-on-history-after.mp4
How to Test
Manual/local verification
./gradlew typecheckpassed frompackages/kilo-jetbrains/../gradlew :frontend:test --tests ai.kilocode.client.session.SessionSidePanelManagerTest --tests ai.kilocode.client.agentManager.worktree.WorktreeSessionEditorManagerTest --tests ai.kilocode.client.session.ui.PromptPanelTest --tests ai.kilocode.client.session.subagent.SubagentSessionEditorHostTestpassed: 189 tests.git diff --cached --checkpassed.git diff --checkpassed.Reviewer test steps
packages/kilo-jetbrains/, run./gradlew --no-configuration-cache runIdeSplitMode.kilo.session.inactive.disposeTimeoutMs), then reopen that session from History. Confirm its history and session ID remain, and the draft text and attachment return.Blocked checks and substitute verification
./gradlew :frontend:detektreports 2,196 existing findings under Java 21. Comparing against the current PR commit found the same findings and no added diagnostics. Typechecking and the focused tests pass.Checklist