Skip to content

fix(cloud-agent): complete idle turns and surface resume/interrupt honestly - #5304

Merged
eshurakov merged 4 commits into
mainfrom
eshurakov/velvet-falcon
Aug 18, 2026
Merged

fix(cloud-agent): complete idle turns and surface resume/interrupt honestly#5304
eshurakov merged 4 commits into
mainfrom
eshurakov/velvet-falcon

Conversation

@eshurakov

@eshurakov eshurakov commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes Cloud Agent idle/resume UX so completed sessions look finished and can be continued. Three P0s from docs/plans/cloud-agent-idle-resume-ux.md:

  • Idle completion: parent session.idle still emits wrapper complete even if SSE timeout / ingest disconnect aborts during auto-commit. Capture complete intent at drain start so post-processing cannot drop it.
  • Partial snapshot restore: incomplete cold restore is no longer logged as success. git apply retries without --3way and writes snapshot after content when present. Session continues with restored files; skipped diffs fail visibly (snapshot_diffs_incomplete).
  • User interrupt: MessageAbortedError / user-interrupt terminalizes as interrupted, and the transcript shows Interrupted instead of a hanging last tool call.

P1 keep-warm is covered by the complete event. Resume path is now explicit in bootstrap progress/telemetry. P2 title-report 502 is left as a follow-up.

Test plan

  • Unit tests for lifecycle complete-after-idle, restore fallbacks, interrupt classification, and Interrupted transcript label
  • Local real-LLM smoke: start a session from /cloud, environment prepares, first turn completes, UI leaves busy state on session.idle (no spinner)

Comment thread services/cloud-agent-next/wrapper/src/restore-session.ts Outdated
Comment thread services/cloud-agent-next/wrapper/src/restore-session.ts
Comment thread services/cloud-agent-next/wrapper/src/session-bootstrap.ts Outdated
Comment thread apps/web/src/components/cloud-agent-next/MessageBubble.tsx Outdated
Comment thread services/cloud-agent-next/src/shared/wrapper-bootstrap.ts
@kilo-code-bot

kilo-code-bot Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Executive Summary

Incremental review of the fix-up commits confirms all five previous findings are resolved: the git reset failure now logs and skips the diff instead of throwing, deleted-file diffs unlink after a failed patch instead of writing empty after-content, the restore progress copy branches on restoreTelemetry.path, the assistant error guard is now error != null, and the telemetry doc comment is back on WrapperBootstrapTelemetry — each covered by a new regression test.

Files Reviewed (7 files, incremental)
  • services/cloud-agent-next/wrapper/src/restore-session.ts — prior issues verified fixed; new unlink fallback and per-diff try/catch reviewed, no issues
  • services/cloud-agent-next/wrapper/src/session-bootstrap.ts — prior issue verified fixed
  • apps/web/src/components/cloud-agent-next/MessageBubble.tsx — prior issue verified fixed
  • services/cloud-agent-next/src/shared/wrapper-bootstrap.ts — prior issue verified fixed
  • services/cloud-agent-next/wrapper/src/restore-session.test.ts — no issues
  • services/cloud-agent-next/wrapper/src/session-bootstrap.test.ts — no issues
  • apps/web/src/components/cloud-agent-next/MessageBubble.test.ts — no issues
Previous Review Summary (commit c70ec24)

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

Previous review (commit c70ec24)

Status: 5 Issues Found | Recommendation: Address before merge

Executive Summary

The snapshot-restore fallback introduces two resilience regressions — an uncaught git reset throw that wipes the workspace instead of skipping one diff, and an after-content write that resurrects deleted files — plus a user-facing null-crash in the new Interrupted rendering path.

Overview

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

WARNING

File Line Issue
services/cloud-agent-next/wrapper/src/restore-session.ts 573 New throw on git reset failure escapes the diff loop → generic bootstrap failure + cleanupWorkspace, contradicting the partial-restore intent
services/cloud-agent-next/wrapper/src/restore-session.ts 588 After-content fallback ignores diff.status — failed deletion patch writes an empty file at a path that should be deleted
services/cloud-agent-next/wrapper/src/session-bootstrap.ts 1261 "Cold restore" progress message also fires on the backup restore path, mislabeling the resume path
apps/web/src/components/cloud-agent-next/MessageBubble.tsx 281 error !== undefined lets runtime null error reach 'data' in null TypeError during render

SUGGESTION

File Line Issue
services/cloud-agent-next/src/shared/wrapper-bootstrap.ts 189 Doc comment about workspaceReady sibling placement now attaches to WrapperRestoreTelemetry instead of WrapperBootstrapTelemetry
Files Reviewed (18 files)
  • services/cloud-agent-next/wrapper/src/restore-session.ts - 2 issues
  • services/cloud-agent-next/wrapper/src/session-bootstrap.ts - 1 issue
  • apps/web/src/components/cloud-agent-next/MessageBubble.tsx - 1 issue
  • services/cloud-agent-next/src/shared/wrapper-bootstrap.ts - 1 issue
  • services/cloud-agent-next/wrapper/src/restore-session.test.ts - no issues
  • services/cloud-agent-next/wrapper/src/session-bootstrap.test.ts - no issues
  • services/cloud-agent-next/wrapper/src/lifecycle.ts - no issues (drain/complete capture verified against all abort entry points; no timer leaks found)
  • services/cloud-agent-next/test/unit/wrapper/lifecycle.test.ts - no issues
  • services/cloud-agent-next/src/websocket/ingest.ts - no issues
  • services/cloud-agent-next/src/websocket/ingest.test.ts - no issues
  • services/cloud-agent-next/src/session/safe-failure-projection.ts - no issues
  • services/cloud-agent-next/src/session/safe-failure-projection.test.ts - no issues
  • services/cloud-agent-next/src/session/wrapper-supervisor.ts - no issues
  • services/cloud-agent-next/src/kilo/wrapper-client.ts - no issues
  • apps/web/src/components/cloud-agent-next/MessageBubble.test.ts - no issues
  • apps/web/src/components/cloud-agent-next/types.ts - no issues (streaming-logic equivalence verified)
  • packages/cloud-agent-sdk/src/session-manager.ts - no issues (streaming-logic equivalence verified)
  • docs/plans/cloud-agent-idle-resume-ux.md - no issues (investigation doc; no images, so markdown-image rule not applicable)

Fix these issues in Kilo Cloud


Reviewed by kimi-k3 · Input: 75.3K · Output: 4.6K · Cached: 275.2K

Review guidance: REVIEW.md from base branch main

Skip a failed three-way reset instead of throwing, unlink deleted files after a failed patch, and treat a null assistant error as no error.
@eshurakov
eshurakov merged commit fb03ea8 into main Aug 18, 2026
39 of 53 checks passed
@eshurakov
eshurakov deleted the eshurakov/velvet-falcon branch August 18, 2026 10:41
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