Skip to content

feat(cloud-agent-next): retain session operation results - #5913

Merged
eshurakov merged 1 commit into
eshurakov/recovery-observationfrom
eshurakov/recovery-results
Sep 7, 2026
Merged

feat(cloud-agent-next): retain session operation results#5913
eshurakov merged 1 commit into
eshurakov/recovery-observationfrom
eshurakov/recovery-results

Conversation

@eshurakov

@eshurakov eshurakov commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Persist session operation results on the wrapper so later recovery can observe attach/prompt outcomes instead of replaying them blindly.
  • Extract session-operation handling from sandbox control handlers.

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

One commit. Unique vs parent.

@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

Executive Summary

The follow-up commit fixes nested transactionSync persistence and abort-time wrapper retirement; no remaining issues in the incremental diff.

Files Reviewed (5 files)
  • 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/session-operation.test.ts
  • services/cloud-agent-next/wrapper/src/control/session-operation.ts
Previous Review Summaries (3 snapshots, latest commit f62807a)

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

Previous review (commit f62807a)

Status: 2 Issues Found | Recommendation: Address before merge

Overview

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

CRITICAL

File Line Issue
services/cloud-agent-next/src/sandbox-session/session-operation.ts 231 Nested transactionSync will throw when persisting a retained result
services/cloud-agent-next/wrapper/src/control/session-operation.ts 375 Aborting an in-flight prompt retires the wrapper
Files Reviewed (37 files)
  • services/cloud-agent-next/src/persistence/SandboxControl.ts
  • services/cloud-agent-next/src/sandbox-control/frames.test.ts
  • services/cloud-agent-next/src/sandbox-control/frames.ts
  • services/cloud-agent-next/src/sandbox-control/session-forwarding.test.ts
  • services/cloud-agent-next/src/sandbox-control/session-forwarding.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-control/waiters.ts
  • services/cloud-agent-next/src/sandbox-session/SandboxSession.ts
  • services/cloud-agent-next/src/sandbox-session/control-rpc.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.test.ts
  • services/cloud-agent-next/src/sandbox-session/session-operation.ts - 1 issues
  • services/cloud-agent-next/src/shared/sandbox-control-protocol.ts
  • services/cloud-agent-next/test/integration/sandbox-control.test.ts
  • services/cloud-agent-next/test/unit/wrapper/worktree-credential-refresh.test.ts
  • services/cloud-agent-next/wrapper/src/control/apply-attach.ts
  • services/cloud-agent-next/wrapper/src/control/control-handler-result.ts
  • services/cloud-agent-next/wrapper/src/control/control-test-fixtures.ts
  • services/cloud-agent-next/wrapper/src/control/main.ts
  • services/cloud-agent-next/wrapper/src/control/operation-intent.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/operation-result-delivery.test.ts
  • services/cloud-agent-next/wrapper/src/control/operation-result-delivery.ts
  • services/cloud-agent-next/wrapper/src/control/retained-operation-notifications.test.ts
  • services/cloud-agent-next/wrapper/src/control/retained-operation-notifications.ts
  • services/cloud-agent-next/wrapper/src/control/sandbox-control-client.test.ts
  • services/cloud-agent-next/wrapper/src/control/sandbox-control-client.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-cleanup.test.ts
  • services/cloud-agent-next/wrapper/src/control/session-operation.test.ts
  • services/cloud-agent-next/wrapper/src/control/session-operation.ts - 1 issues
  • services/cloud-agent-next/wrapper/src/control/worktree-mutation-notifications.test.ts
  • services/cloud-agent-next/wrapper/src/control/worktree-runtime.test.ts

Fix these issues in Kilo Cloud

Previous review (commit 28f461e)

Status: No Issues Found | Recommendation: Merge

Files Reviewed (37 files)
  • services/cloud-agent-next/src/persistence/SandboxControl.ts
  • services/cloud-agent-next/src/sandbox-control/frames.test.ts
  • services/cloud-agent-next/src/sandbox-control/frames.ts
  • services/cloud-agent-next/src/sandbox-control/session-forwarding.test.ts
  • services/cloud-agent-next/src/sandbox-control/session-forwarding.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-control/waiters.ts
  • services/cloud-agent-next/src/sandbox-session/SandboxSession.ts
  • services/cloud-agent-next/src/sandbox-session/control-rpc.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.test.ts
  • services/cloud-agent-next/src/sandbox-session/session-operation.ts
  • services/cloud-agent-next/src/shared/sandbox-control-protocol.ts
  • services/cloud-agent-next/test/integration/sandbox-control.test.ts
  • services/cloud-agent-next/test/unit/wrapper/worktree-credential-refresh.test.ts
  • services/cloud-agent-next/wrapper/src/control/apply-attach.ts
  • services/cloud-agent-next/wrapper/src/control/control-handler-result.ts
  • services/cloud-agent-next/wrapper/src/control/control-test-fixtures.ts
  • services/cloud-agent-next/wrapper/src/control/main.ts
  • services/cloud-agent-next/wrapper/src/control/operation-intent.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/operation-result-delivery.test.ts
  • services/cloud-agent-next/wrapper/src/control/operation-result-delivery.ts
  • services/cloud-agent-next/wrapper/src/control/retained-operation-notifications.test.ts
  • services/cloud-agent-next/wrapper/src/control/retained-operation-notifications.ts
  • services/cloud-agent-next/wrapper/src/control/sandbox-control-client.test.ts
  • services/cloud-agent-next/wrapper/src/control/sandbox-control-client.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-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-mutation-notifications.test.ts
  • services/cloud-agent-next/wrapper/src/control/worktree-runtime.test.ts

Previous review (commit e3df8d7)

Status: No Issues Found | Recommendation: Merge

Files Reviewed (37 files)
  • services/cloud-agent-next/src/persistence/SandboxControl.ts
  • services/cloud-agent-next/src/sandbox-control/frames.test.ts
  • services/cloud-agent-next/src/sandbox-control/frames.ts
  • services/cloud-agent-next/src/sandbox-control/session-forwarding.test.ts
  • services/cloud-agent-next/src/sandbox-control/session-forwarding.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-control/waiters.ts
  • services/cloud-agent-next/src/sandbox-session/SandboxSession.ts
  • services/cloud-agent-next/src/sandbox-session/control-rpc.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.test.ts
  • services/cloud-agent-next/src/sandbox-session/session-operation.ts
  • services/cloud-agent-next/src/shared/sandbox-control-protocol.ts
  • services/cloud-agent-next/test/integration/sandbox-control.test.ts
  • services/cloud-agent-next/test/unit/wrapper/worktree-credential-refresh.test.ts
  • services/cloud-agent-next/wrapper/src/control/apply-attach.ts
  • services/cloud-agent-next/wrapper/src/control/control-handler-result.ts
  • services/cloud-agent-next/wrapper/src/control/control-test-fixtures.ts
  • services/cloud-agent-next/wrapper/src/control/main.ts
  • services/cloud-agent-next/wrapper/src/control/operation-intent.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/operation-result-delivery.test.ts
  • services/cloud-agent-next/wrapper/src/control/operation-result-delivery.ts
  • services/cloud-agent-next/wrapper/src/control/retained-operation-notifications.test.ts
  • services/cloud-agent-next/wrapper/src/control/retained-operation-notifications.ts
  • services/cloud-agent-next/wrapper/src/control/sandbox-control-client.test.ts
  • services/cloud-agent-next/wrapper/src/control/sandbox-control-client.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-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-mutation-notifications.test.ts
  • services/cloud-agent-next/wrapper/src/control/worktree-runtime.test.ts

Reviewed by grok-4.6 · Input: 117.3K · Output: 13.9K · Cached: 414.8K

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

@eshurakov
eshurakov force-pushed the eshurakov/recovery-results branch from e3df8d7 to 28f461e Compare September 7, 2026 08:36
@eshurakov
eshurakov force-pushed the eshurakov/recovery-results branch from 28f461e to f62807a Compare September 7, 2026 09:33

@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-results branch from f62807a to 22932ee Compare September 7, 2026 12:35
@eshurakov

Copy link
Copy Markdown
Contributor Author

Both Kilobot criticals were real.

  1. Nested transactionSync: commitSessionOperationResult opened a transaction, then saveMessages opened another. Cloudflare throws on nested transactionSync, so retained results with events never persisted. Message commit now runs inside the outer transaction.

  2. Aborting an in-flight prompt retired the wrapper whenever the native promise rejected (including MessageAbortedError after a confirmed abortSession). Native settlement (resolve or reject) is now success; only a timeout retires.

@eshurakov
eshurakov merged commit 368d604 into main Sep 7, 2026
17 checks passed
@eshurakov
eshurakov deleted the eshurakov/recovery-results 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