Skip to content

fix(vscode): preserve activity during routine reconnects - #13553

Merged
marius-kilocode merged 1 commit into
mainfrom
investigate-kio-server-crashes
Aug 28, 2026
Merged

fix(vscode): preserve activity during routine reconnects#13553
marius-kilocode merged 1 commit into
mainfrom
investigate-kio-server-crashes

Conversation

@marius-kilocode

Copy link
Copy Markdown
Collaborator

What Problem This Solves

Agent Manager shares one backend connection across worktrees. A routine event-stream reconnect changed every active or blocked session to an error indicator, making a brief connection retry look like all agents had failed. The directory-level activity cache was also cleared during connecting.

Why This Change Was Made

Treat connecting as a transition, not a new failure. Preserve the last confirmed connection-failure state until the connection succeeds: an ordinary reconnect keeps activity visible, but reconnecting after an explicit error or disconnection does not hide that failure.

Keep the worktree activity cache during this transition while invalidating pending snapshots from the previous stream. A successful reconnection refreshes the cache, and late responses from the old stream cannot overwrite the recovered state.

This changes status presentation and refresh handling only. It does not change transport retry behavior, prevent backend crashes, or establish the cause of the original reconnect.

User Impact

  • Running sessions keep their loading spinner during routine reconnects.
  • Waiting and completed sessions retain their status. The input still shows “Connecting to server…” while disconnected from the stream.
  • Confirmed connection failures remain red until recovery. Session failures remain visible independently of connection recovery.

Evidence

  • The new regressions failed before the fix and pass afterward. Coverage includes rendered session indicators, waiting sessions, failure persistence through retries, cache retention, and rejection of old in-flight snapshots.
  • Rebased branch: 4,456 unit tests passed, plus typecheck, lint, unused-code checks, source-marker checks, and the extension/webview build.
  • Isolated VS Code was exercised with ten synthetic worktree cards. Before the fix, sending only connected → connecting turned all ten cards red. After the fix, all ten kept their running indicator. Mixed failed/waiting/completed states and explicit connection failure followed by recovery were also verified. These were controlled UI-message scenarios, not a reproduction of the unknown transport trigger. The isolated instance was cleaned up.

Before: routine reconnect displays ten errors

Before the fix, ten synthetic worktree cards show error indicators during a routine reconnect

After: routine reconnect keeps the running indicators

After the fix, ten synthetic worktree cards retain running indicators while the input shows Connecting to server

@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 (5 files)
  • .changeset/stable-reconnect-activity.md
  • packages/kilo-vscode/src/agent-manager/worktree-activity.ts
  • packages/kilo-vscode/tests/fixtures/session-provider-activity.tsx
  • packages/kilo-vscode/tests/unit/worktree-activity.test.ts
  • packages/kilo-vscode/webview-ui/src/context/session.tsx

Reviewed by grok-4.6 · Input: 162.4K · Output: 15.2K · Cached: 540.5K

Review guidance: REVIEW.md from base branch main

@marius-kilocode
marius-kilocode merged commit f93583f into main Aug 28, 2026
24 checks passed
@marius-kilocode
marius-kilocode deleted the investigate-kio-server-crashes branch August 28, 2026 13:30
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