Skip to content

feat(cloud-agent-next): recover control connections with event receipts - #5918

Merged
eshurakov merged 1 commit into
eshurakov/recovery-native-feedfrom
eshurakov/recovery-control-connection
Sep 7, 2026
Merged

feat(cloud-agent-next): recover control connections with event receipts#5918
eshurakov merged 1 commit into
eshurakov/recovery-native-feedfrom
eshurakov/recovery-control-connection

Conversation

@eshurakov

@eshurakov eshurakov commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Recover control connections using event receipts instead of replaying an unbounded stream.
  • Preserve scoped recovery lifetimes so a newer connection cannot be failed by an older runtime's cleanup.

Stack

Control-plane recovery stack. Merge from the bottom. Each PR targets its parent, not main (except #5912).

  1. fix(cloud-agent-next): isolate observation from liveness #5912 eshurakov/recovery-observationmain
  2. feat(cloud-agent-next): retain session operation results #5913 eshurakov/recovery-resultseshurakov/recovery-observation
  3. feat(cloud-agent-next): coordinate scoped Stop requests #5914 eshurakov/recovery-stop-scopeeshurakov/recovery-results
  4. fix(cloud-agent-next): retire native runtimes safely #5915 eshurakov/recovery-native-cleanupeshurakov/recovery-stop-scope
  5. fix(cloud-agent-next): preserve cleanup retirement target #5916 eshurakov/recovery-session-deliveryeshurakov/recovery-native-cleanup
  6. fix(cloud-agent-next): recover and bound native event feeds #5917 eshurakov/recovery-native-feedeshurakov/recovery-session-delivery
  7. feat(cloud-agent-next): recover control connections with event receipts #5918 eshurakov/recovery-control-connectioneshurakov/recovery-native-feed
  8. fix(cloud-agent-next): control-plane recovery follow-ups #5919 eshurakov/recovery-stackeshurakov/recovery-control-connection
  9. fix(cloud-agent-next): release unadmitted queued messages on quarantine #5920 eshurakov/recovery-not-ready-retryeshurakov/recovery-stack

Do not merge out of order.

Reviewer Notes

Two commits. Unique vs parent.

Comment thread services/cloud-agent-next/wrapper/src/control/control-event-outbox.ts Outdated
@kilo-code-bot

kilo-code-bot Bot commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (1 file)
  • services/cloud-agent-next/wrapper/src/control/worktree-runtime-cleanup.ts
Previous Review Summaries (8 snapshots, latest commit 8629067)

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

Previous review (commit 8629067)

Status: No Issues Found | Recommendation: Merge

Files Reviewed (13 files)
  • services/cloud-agent-next/src/persistence/SandboxControl.ts
  • services/cloud-agent-next/src/sandbox-control/lifecycle.test.ts
  • services/cloud-agent-next/src/sandbox-control/native-runtime-retirement.ts
  • services/cloud-agent-next/src/sandbox-session/SandboxSession.ts
  • services/cloud-agent-next/src/sandbox-session/session-message-queue.test.ts
  • services/cloud-agent-next/src/sandbox-session/session-operation.test.ts
  • services/cloud-agent-next/wrapper/src/control/operation-registry.test.ts
  • services/cloud-agent-next/wrapper/src/control/operation-registry.ts
  • services/cloud-agent-next/wrapper/src/control/sandbox-control-handlers.test.ts
  • services/cloud-agent-next/wrapper/src/control/sandbox-control-handlers.ts
  • services/cloud-agent-next/wrapper/src/control/session-operation.test.ts
  • services/cloud-agent-next/wrapper/src/control/session-operation.ts
  • services/cloud-agent-next/wrapper/src/control/worktree-runtime.ts

Previous review (commit d7a3d7d)

Status: No Issues Found | Recommendation: Merge

Files Reviewed (4 files)
  • services/cloud-agent-next/wrapper/src/control/control-event-outbox.ts
  • services/cloud-agent-next/wrapper/src/control/control-event-outbox.test.ts
  • services/cloud-agent-next/wrapper/src/control/sandbox-control-client.ts
  • services/cloud-agent-next/wrapper/src/control/sandbox-control-client.test.ts

Previous review (commit cd82e52)

Status: 2 Issues Found | Recommendation: Address before merge

Overview

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

WARNING

File Line Issue
services/cloud-agent-next/wrapper/src/control/sandbox-control-client.ts 344 Successful commit reconcile dropped on socket loss, so post-deadline repair cannot ACK
services/cloud-agent-next/wrapper/src/control/control-event-outbox.ts 189 In-flight publish abandoned at deadline; late rejection becomes an unhandled wrapper crash
Files Reviewed (52 files)
  • services/cloud-agent-next/src/persistence/SandboxControl.ts
  • services/cloud-agent-next/src/router/control-plane-session.ts
  • services/cloud-agent-next/src/sandbox-control/backend-recovery-hooks.test.ts
  • services/cloud-agent-next/src/sandbox-control/control-recovery.test.ts
  • services/cloud-agent-next/src/sandbox-control/control-recovery.ts
  • services/cloud-agent-next/src/sandbox-control/deadlines.ts
  • services/cloud-agent-next/src/sandbox-control/durable-state.ts
  • services/cloud-agent-next/src/sandbox-control/frames.ts
  • services/cloud-agent-next/src/sandbox-control/lifecycle.test.ts
  • services/cloud-agent-next/src/sandbox-control/native-runtime-retirement.ts
  • services/cloud-agent-next/src/sandbox-control/recovery-authority.test.ts
  • services/cloud-agent-next/src/sandbox-control/recovery-authority.ts
  • services/cloud-agent-next/src/sandbox-control/recovery-cleanup.test.ts
  • services/cloud-agent-next/src/sandbox-control/recovery-cleanup.ts
  • services/cloud-agent-next/src/sandbox-control/recovery-execution.test.ts
  • services/cloud-agent-next/src/sandbox-control/recovery-execution.ts
  • services/cloud-agent-next/src/sandbox-control/socket.test.ts
  • services/cloud-agent-next/src/sandbox-control/socket.ts
  • services/cloud-agent-next/src/sandbox-session/SandboxSession.ts
  • services/cloud-agent-next/src/sandbox-session/control-event-receipts.test.ts
  • services/cloud-agent-next/src/sandbox-session/control-event-receipts.ts
  • services/cloud-agent-next/src/sandbox-session/session-message-queue.test.ts
  • services/cloud-agent-next/src/sandbox-session/session-message-queue.ts
  • services/cloud-agent-next/src/sandbox-session/session-operation.ts
  • services/cloud-agent-next/src/sandbox-session/session-stop.test.ts
  • services/cloud-agent-next/src/shared/control-event-canonical.ts
  • services/cloud-agent-next/src/shared/control-plane-session.ts
  • services/cloud-agent-next/src/shared/sandbox-control-protocol.ts
  • services/cloud-agent-next/wrapper/src/control/apply-attach.ts
  • services/cloud-agent-next/wrapper/src/control/control-event-ordering.test.ts
  • services/cloud-agent-next/wrapper/src/control/control-event-outbox.test.ts
  • services/cloud-agent-next/wrapper/src/control/control-event-outbox.ts - 1 issue
  • services/cloud-agent-next/wrapper/src/control/control-event-transport.test.ts
  • services/cloud-agent-next/wrapper/src/control/control-event-transport.ts
  • services/cloud-agent-next/wrapper/src/control/feed.ts
  • services/cloud-agent-next/wrapper/src/control/main.ts
  • services/cloud-agent-next/wrapper/src/control/operation-registry.test.ts
  • services/cloud-agent-next/wrapper/src/control/operation-registry.ts
  • services/cloud-agent-next/wrapper/src/control/sandbox-control-client.test.ts
  • services/cloud-agent-next/wrapper/src/control/sandbox-control-client.ts - 1 issue
  • services/cloud-agent-next/wrapper/src/control/sandbox-control-handlers.test.ts
  • services/cloud-agent-next/wrapper/src/control/sandbox-control-handlers.ts
  • services/cloud-agent-next/wrapper/src/control/sandbox-control-runtime.test.ts
  • services/cloud-agent-next/wrapper/src/control/sandbox-control-runtime.ts
  • services/cloud-agent-next/wrapper/src/control/session-operation-cleanup.test.ts
  • services/cloud-agent-next/wrapper/src/control/session-operation.test.ts
  • services/cloud-agent-next/wrapper/src/control/session-operation.ts
  • services/cloud-agent-next/wrapper/src/control/worktree-feed.test.ts
  • services/cloud-agent-next/wrapper/src/control/worktree-feed.ts
  • services/cloud-agent-next/wrapper/src/control/worktree-mutation-notifications.test.ts
  • services/cloud-agent-next/wrapper/src/control/worktree-mutation-notifications.ts
  • services/cloud-agent-next/wrapper/src/control/worktree-runtime.ts

Fix these issues in Kilo Cloud

Previous review (commit 9a82c27)

Status: 2 Issues Found | Recommendation: Address before merge

Overview

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

WARNING

File Line Issue
services/cloud-agent-next/wrapper/src/control/sandbox-control-client.ts 344 Successful commit reconcile dropped on socket loss, so post-deadline repair cannot ACK
services/cloud-agent-next/wrapper/src/control/control-event-outbox.ts 189 In-flight publish abandoned at deadline; late rejection becomes an unhandled wrapper crash
Files Reviewed (52 files)
  • services/cloud-agent-next/src/persistence/SandboxControl.ts
  • services/cloud-agent-next/src/router/control-plane-session.ts
  • services/cloud-agent-next/src/sandbox-control/backend-recovery-hooks.test.ts
  • services/cloud-agent-next/src/sandbox-control/control-recovery.test.ts
  • services/cloud-agent-next/src/sandbox-control/control-recovery.ts
  • services/cloud-agent-next/src/sandbox-control/deadlines.ts
  • services/cloud-agent-next/src/sandbox-control/durable-state.ts
  • services/cloud-agent-next/src/sandbox-control/frames.ts
  • services/cloud-agent-next/src/sandbox-control/lifecycle.test.ts
  • services/cloud-agent-next/src/sandbox-control/native-runtime-retirement.ts
  • services/cloud-agent-next/src/sandbox-control/recovery-authority.test.ts
  • services/cloud-agent-next/src/sandbox-control/recovery-authority.ts
  • services/cloud-agent-next/src/sandbox-control/recovery-cleanup.test.ts
  • services/cloud-agent-next/src/sandbox-control/recovery-cleanup.ts
  • services/cloud-agent-next/src/sandbox-control/recovery-execution.test.ts
  • services/cloud-agent-next/src/sandbox-control/recovery-execution.ts
  • services/cloud-agent-next/src/sandbox-control/socket.test.ts
  • services/cloud-agent-next/src/sandbox-control/socket.ts
  • services/cloud-agent-next/src/sandbox-session/SandboxSession.ts
  • services/cloud-agent-next/src/sandbox-session/control-event-receipts.test.ts
  • services/cloud-agent-next/src/sandbox-session/control-event-receipts.ts
  • services/cloud-agent-next/src/sandbox-session/session-message-queue.test.ts
  • services/cloud-agent-next/src/sandbox-session/session-message-queue.ts
  • services/cloud-agent-next/src/sandbox-session/session-operation.ts
  • services/cloud-agent-next/src/sandbox-session/session-stop.test.ts
  • services/cloud-agent-next/src/shared/control-event-canonical.ts
  • services/cloud-agent-next/src/shared/control-plane-session.ts
  • services/cloud-agent-next/src/shared/sandbox-control-protocol.ts
  • services/cloud-agent-next/wrapper/src/control/apply-attach.ts
  • services/cloud-agent-next/wrapper/src/control/control-event-ordering.test.ts
  • services/cloud-agent-next/wrapper/src/control/control-event-outbox.test.ts
  • services/cloud-agent-next/wrapper/src/control/control-event-outbox.ts - 1 issue
  • services/cloud-agent-next/wrapper/src/control/control-event-transport.test.ts
  • services/cloud-agent-next/wrapper/src/control/control-event-transport.ts
  • services/cloud-agent-next/wrapper/src/control/feed.ts
  • services/cloud-agent-next/wrapper/src/control/main.ts
  • services/cloud-agent-next/wrapper/src/control/operation-registry.test.ts
  • services/cloud-agent-next/wrapper/src/control/operation-registry.ts
  • services/cloud-agent-next/wrapper/src/control/sandbox-control-client.test.ts
  • services/cloud-agent-next/wrapper/src/control/sandbox-control-client.ts - 1 issue
  • services/cloud-agent-next/wrapper/src/control/sandbox-control-handlers.test.ts
  • services/cloud-agent-next/wrapper/src/control/sandbox-control-handlers.ts
  • services/cloud-agent-next/wrapper/src/control/sandbox-control-runtime.test.ts
  • services/cloud-agent-next/wrapper/src/control/sandbox-control-runtime.ts
  • services/cloud-agent-next/wrapper/src/control/session-operation-cleanup.test.ts
  • services/cloud-agent-next/wrapper/src/control/session-operation.test.ts
  • services/cloud-agent-next/wrapper/src/control/session-operation.ts
  • services/cloud-agent-next/wrapper/src/control/worktree-feed.test.ts
  • services/cloud-agent-next/wrapper/src/control/worktree-feed.ts
  • services/cloud-agent-next/wrapper/src/control/worktree-mutation-notifications.test.ts
  • services/cloud-agent-next/wrapper/src/control/worktree-mutation-notifications.ts
  • services/cloud-agent-next/wrapper/src/control/worktree-runtime.ts

Fix these issues in Kilo Cloud

Previous review (commit 672e609)

Status: 2 Issues Found | Recommendation: Address before merge

Overview

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

WARNING

File Line Issue
services/cloud-agent-next/wrapper/src/control/sandbox-control-client.ts 344 Successful commit reconcile dropped on socket loss, so post-deadline repair cannot ACK
services/cloud-agent-next/wrapper/src/control/control-event-outbox.ts 189 In-flight publish abandoned at deadline; late rejection becomes an unhandled wrapper crash
Files Reviewed (1 file)
  • services/cloud-agent-next/test/integration/sandbox-control.test.ts

Fix these issues in Kilo Cloud

Previous review (commit 99a8eb6)

Status: 2 Issues Found | Recommendation: Address before merge

Overview

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

WARNING

File Line Issue
services/cloud-agent-next/wrapper/src/control/sandbox-control-client.ts 344 Successful commit reconcile dropped on socket loss, so post-deadline repair cannot ACK
services/cloud-agent-next/wrapper/src/control/control-event-outbox.ts 189 In-flight publish abandoned at deadline; late rejection becomes an unhandled wrapper crash
Files Reviewed (1 file)
  • services/cloud-agent-next/test/integration/sandbox-control.test.ts

Fix these issues in Kilo Cloud

Previous review (commit 37f4510)

Status: 2 Issues Found | Recommendation: Address before merge

Overview

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

WARNING

File Line Issue
services/cloud-agent-next/wrapper/src/control/sandbox-control-client.ts 344 Successful commit reconcile dropped on socket loss, so post-deadline repair cannot ACK
services/cloud-agent-next/wrapper/src/control/control-event-outbox.ts 189 In-flight publish abandoned at deadline; late rejection becomes an unhandled wrapper crash
Files Reviewed (2 files)
  • services/cloud-agent-next/wrapper/src/control/session-operation.ts
  • services/cloud-agent-next/wrapper/src/control/session-operation.test.ts

Fix these issues in Kilo Cloud

Previous review (commit 94606ae)

Status: 2 Issues Found | Recommendation: Address before merge

Overview

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

WARNING

File Line Issue
services/cloud-agent-next/wrapper/src/control/sandbox-control-client.ts 344 Successful commit reconcile dropped on socket loss, so post-deadline repair cannot ACK
services/cloud-agent-next/wrapper/src/control/control-event-outbox.ts 189 In-flight publish abandoned at deadline; late rejection becomes an unhandled wrapper crash
Files Reviewed (52 files)
  • services/cloud-agent-next/src/persistence/SandboxControl.ts
  • services/cloud-agent-next/src/router/control-plane-session.ts
  • services/cloud-agent-next/src/sandbox-control/backend-recovery-hooks.test.ts
  • services/cloud-agent-next/src/sandbox-control/control-recovery.test.ts
  • services/cloud-agent-next/src/sandbox-control/control-recovery.ts
  • services/cloud-agent-next/src/sandbox-control/deadlines.ts
  • services/cloud-agent-next/src/sandbox-control/durable-state.ts
  • services/cloud-agent-next/src/sandbox-control/frames.ts
  • services/cloud-agent-next/src/sandbox-control/lifecycle.test.ts
  • services/cloud-agent-next/src/sandbox-control/native-runtime-retirement.ts
  • services/cloud-agent-next/src/sandbox-control/recovery-authority.test.ts
  • services/cloud-agent-next/src/sandbox-control/recovery-authority.ts
  • services/cloud-agent-next/src/sandbox-control/recovery-cleanup.test.ts
  • services/cloud-agent-next/src/sandbox-control/recovery-cleanup.ts
  • services/cloud-agent-next/src/sandbox-control/recovery-execution.test.ts
  • services/cloud-agent-next/src/sandbox-control/recovery-execution.ts
  • services/cloud-agent-next/src/sandbox-control/socket.test.ts
  • services/cloud-agent-next/src/sandbox-control/socket.ts
  • services/cloud-agent-next/src/sandbox-session/SandboxSession.ts
  • services/cloud-agent-next/src/sandbox-session/control-event-receipts.test.ts
  • services/cloud-agent-next/src/sandbox-session/control-event-receipts.ts
  • services/cloud-agent-next/src/sandbox-session/session-message-queue.test.ts
  • services/cloud-agent-next/src/sandbox-session/session-message-queue.ts
  • services/cloud-agent-next/src/sandbox-session/session-operation.ts
  • services/cloud-agent-next/src/sandbox-session/session-stop.test.ts
  • services/cloud-agent-next/src/shared/control-event-canonical.ts
  • services/cloud-agent-next/src/shared/control-plane-session.ts
  • services/cloud-agent-next/src/shared/sandbox-control-protocol.ts
  • services/cloud-agent-next/wrapper/src/control/apply-attach.ts
  • services/cloud-agent-next/wrapper/src/control/control-event-ordering.test.ts
  • services/cloud-agent-next/wrapper/src/control/control-event-outbox.test.ts
  • services/cloud-agent-next/wrapper/src/control/control-event-outbox.ts - 1 issue
  • services/cloud-agent-next/wrapper/src/control/control-event-transport.test.ts
  • services/cloud-agent-next/wrapper/src/control/control-event-transport.ts
  • services/cloud-agent-next/wrapper/src/control/feed.ts
  • services/cloud-agent-next/wrapper/src/control/main.ts
  • services/cloud-agent-next/wrapper/src/control/operation-registry.test.ts
  • services/cloud-agent-next/wrapper/src/control/operation-registry.ts
  • services/cloud-agent-next/wrapper/src/control/sandbox-control-client.test.ts
  • services/cloud-agent-next/wrapper/src/control/sandbox-control-client.ts - 1 issue
  • services/cloud-agent-next/wrapper/src/control/sandbox-control-handlers.test.ts
  • services/cloud-agent-next/wrapper/src/control/sandbox-control-handlers.ts
  • services/cloud-agent-next/wrapper/src/control/sandbox-control-runtime.test.ts
  • services/cloud-agent-next/wrapper/src/control/sandbox-control-runtime.ts
  • services/cloud-agent-next/wrapper/src/control/session-operation-cleanup.test.ts
  • services/cloud-agent-next/wrapper/src/control/session-operation.test.ts
  • services/cloud-agent-next/wrapper/src/control/session-operation.ts
  • services/cloud-agent-next/wrapper/src/control/worktree-feed.test.ts
  • services/cloud-agent-next/wrapper/src/control/worktree-feed.ts
  • services/cloud-agent-next/wrapper/src/control/worktree-mutation-notifications.test.ts
  • services/cloud-agent-next/wrapper/src/control/worktree-mutation-notifications.ts
  • services/cloud-agent-next/wrapper/src/control/worktree-runtime.ts

Fix these issues in Kilo Cloud


Reviewed by grok-4.6 · Input: 87.1K · Output: 5.8K · Cached: 301.7K

Review guidance: REVIEW.md from base branch eshurakov/recovery-native-feed

@eshurakov
eshurakov force-pushed the eshurakov/recovery-control-connection branch from 94606ae to 37f4510 Compare September 6, 2026 18:02
@eshurakov
eshurakov force-pushed the eshurakov/recovery-control-connection branch from 37f4510 to 99a8eb6 Compare September 7, 2026 08:39
@eshurakov
eshurakov force-pushed the eshurakov/recovery-control-connection branch from 99a8eb6 to 672e609 Compare September 7, 2026 08:57
@eshurakov
eshurakov force-pushed the eshurakov/recovery-control-connection branch from 672e609 to 9a82c27 Compare September 7, 2026 09:12
@eshurakov
eshurakov force-pushed the eshurakov/recovery-control-connection branch from 9a82c27 to cd82e52 Compare September 7, 2026 09:35

@iscekic iscekic left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@eshurakov
eshurakov force-pushed the eshurakov/recovery-control-connection branch from cd82e52 to d7a3d7d Compare September 7, 2026 10:38
@eshurakov
eshurakov force-pushed the eshurakov/recovery-control-connection branch from d7a3d7d to 8629067 Compare September 7, 2026 12:53
@eshurakov
eshurakov force-pushed the eshurakov/recovery-control-connection branch from 8629067 to 7f3995d Compare September 7, 2026 13:21
@eshurakov
eshurakov merged commit 015da42 into main Sep 7, 2026
80 of 81 checks passed
@eshurakov
eshurakov deleted the eshurakov/recovery-control-connection branch September 7, 2026 13:39
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