Skip to content

feat(cloud-agent-next): settle control-plane git refs, callbacks, and runtime death - #6026

Merged
eshurakov merged 6 commits into
mainfrom
eshurakov/playful-cinder
Sep 10, 2026
Merged

feat(cloud-agent-next): settle control-plane git refs, callbacks, and runtime death#6026
eshurakov merged 6 commits into
mainfrom
eshurakov/playful-cinder

Conversation

@eshurakov

Copy link
Copy Markdown
Contributor

Summary

Control-plane attach can check out synthetic review refs (refs/pull/*/head) via exact fetch + FETCH_HEAD, and attach failures keep bounded Git detail on the originating message.

Callbacks for control-plane sessions use a pending-only Durable Object outbox (not the legacy queue). Runtime death proof no longer depends on cgroup rmdir succeeding.

Local E2E can reuse the cloud-worktree-setup GitHub user and prepareSession callbackTarget. Wrangler is pinned to 4.112.0 because 4.127.1 dies locally with ProxyWorker Network connection lost after attach/callback fetch.

Test plan

  • Focused cloud-agent-next + wrapper typecheck, oxlint, oxfmt, Vitest
  • Local E2E on wrangler 4.112.0, --api=legacy, seeded GitHub user, na2-org/hi-how-are-you:
    • completed callback
    • interrupted callback
    • absent refs/pull/999999/head + failed callback
    • PR 23 checkout SHA matches advertised 76ac6cb5…
  • Fake-LLM 402 callback (kilo did not terminalize; unverified)
  • Linux cgroup containment (macOS skip)
  • Workers scheduled-alarm wake-up (mocked only)

4.127.1 dies locally with ProxyWorker Network connection lost after sandbox attach and callback fetch.
… runtime death

Fetch synthetic review refs exactly and check out FETCH_HEAD. Attach failures
carry bounded Git detail on the originating message. Control-plane callbacks
use a pending-only Durable Object outbox. Process death proof no longer
depends on cgroup rmdir. Local E2E can reuse the seeded GitHub user and
prepareSession callbackTarget.
@eshurakov
eshurakov force-pushed the eshurakov/playful-cinder branch from 84eb708 to 8b05dbd Compare September 9, 2026 19:38
…rrors

Attach already reports git diagnostic detail via formatGitResultFailure.
Update the unit assertion so CI matches that message.
… and alarm setup

Exhausted attach rejections now fail the originating message. Pause alarm
setup on storage.getAlarm so a mid-setup accepted-message change is
observable.
CI runners cannot open cgroup.procs. Match sibling tests and skip when
containment is unavailable instead of failing the wrapper suite.
Comment thread services/cloud-agent-next/wrapper/src/control/worktree-runtime.ts Outdated
@kilo-code-bot

kilo-code-bot Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (2 files)
  • services/cloud-agent-next/wrapper/src/control/worktree-runtime.test.ts
  • services/cloud-agent-next/wrapper/src/control/worktree-runtime.ts
Previous Review Summary (commit d9beb36)

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

Previous review (commit d9beb36)

Status: 1 Issue Found | Recommendation: Address before merge

Overview

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

WARNING

File Line Issue
services/cloud-agent-next/wrapper/src/control/worktree-runtime.ts 904 Concurrent attach observation can make deleteDirectory throw after death is already proven
Files Reviewed (33 files)
  • pnpm-lock.yaml
  • pnpm-workspace.yaml
  • services/cloud-agent-next/src/agent-sandbox/cloudflare/cloudflare-agent-sandbox.test.ts
  • services/cloud-agent-next/src/sandbox-session/SandboxSession.ts
  • services/cloud-agent-next/src/sandbox-session/control-dispatch.test.ts
  • services/cloud-agent-next/src/sandbox-session/control-dispatch.ts
  • services/cloud-agent-next/src/sandbox-session/message-callbacks.test.ts
  • services/cloud-agent-next/src/sandbox-session/message-callbacks.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/terminal-lifecycle.test.ts
  • services/cloud-agent-next/src/sandbox-session/terminal-lifecycle.ts
  • services/cloud-agent-next/test/e2e/README.md
  • services/cloud-agent-next/test/e2e/auth.ts
  • services/cloud-agent-next/test/e2e/client.ts
  • services/cloud-agent-next/test/e2e/run.ts
  • services/cloud-agent-next/test/integration/sandbox-control.test.ts
  • services/cloud-agent-next/test/integration/session-observation.test.ts
  • services/cloud-agent-next/test/unit/e2e/client.test.ts
  • services/cloud-agent-next/test/unit/wrapper/worktree-credential-refresh.test.ts
  • services/cloud-agent-next/wrapper/src/control/apply-attach.test.ts
  • services/cloud-agent-next/wrapper/src/control/apply-attach.ts
  • services/cloud-agent-next/wrapper/src/control/owned-processes.test.ts
  • services/cloud-agent-next/wrapper/src/control/owned-processes.ts
  • services/cloud-agent-next/wrapper/src/control/worktree-runtime-cleanup.ts
  • services/cloud-agent-next/wrapper/src/control/worktree-runtime.test.ts - 1 issue
  • services/cloud-agent-next/wrapper/src/control/worktree-runtime.ts - 1 issue
  • services/cloud-agent-next/wrapper/src/git-errors.ts
  • services/cloud-agent-next/wrapper/src/git-review-ref.test.ts
  • services/cloud-agent-next/wrapper/src/git-review-ref.ts
  • services/cloud-agent-next/wrapper/src/session-bootstrap.test.ts
  • services/cloud-agent-next/wrapper/src/session-bootstrap.ts

Fix these issues in Kilo Cloud


Reviewed by grok-4.6 · Input: 46.2K · Output: 8.8K · Cached: 305.4K

Review guidance: REVIEW.md from base branch main

…elete

Successful process-death observation stays joinable, and directory deletion
treats an already-removed entry as retired so homes are still cleaned up.
@eshurakov
eshurakov merged commit e42e6fe into main Sep 10, 2026
51 checks passed
@eshurakov
eshurakov deleted the eshurakov/playful-cinder branch September 10, 2026 07:20
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