Skip to content

fix(cloud-agent-next): prevent duplicate wrapper starts - #6722

Merged
eshurakov merged 2 commits into
mainfrom
eshurakov/agile-mangrove
Sep 28, 2026
Merged

eshurakov merged 2 commits into
mainfrom
eshurakov/agile-mangrove

Conversation

@eshurakov

Copy link
Copy Markdown
Contributor

Summary

  • Persist wrapper-attempt uncertainty so a timeout or absent probe cannot launch a second wrapper while the prior attempt may still start.
  • Poll late pid-0 starts under a 90s container-work budget; retry only after the retained process exits and a fresh probe confirms absence.
  • Preserve pre-exec resume, billing identity, containment ordering, and cleanup semantics.

Validation

  • Focused sandbox and billing tests: 89 passed.
  • Service/wrapper typecheck, lint, format check, and diff check passed.
  • Local cold-hot echo:hi E2E passed twice on the Cloudflare SandboxContainers path; one wrapper process served the cold start and warm follow-ups. Evidence: .e2e-evidence/cold-hot-wrapper-readiness/.

Limits

  • The E2E exercised ordinary startup, not the pid-0 late-spawn race or a forced 90s native hang; those branches are covered by focused tests.
  • The 90s budget covers container operations. Durable storage writes remain awaited and may delay the outer RPC if storage stalls.

@kilo-code-bot

kilo-code-bot Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Executive Summary

The incremental commit adds a deadline-bounded poll delay before retrying a completed pid: 0 wrapper attempt, resolving the prior tight-respawn warning, with matching fake-timer coverage; no new issues in the changed lines.

Files Reviewed (2 files)
  • services/cloud-agent-next/src/sandbox-containers/SandboxContainers.ts
  • services/cloud-agent-next/src/sandbox-containers/sandbox-containers.test.ts

Resolved since previous review: The WARNING on SandboxContainers.ts (tight respawn loop with no backoff) was fixed in commit 2532b4714 by await this.sleepWithinDeadline(deadlineAt) at line 605, which bounds each retry by the remaining readiness budget.

Previous Review Summary (commit 4b1f06c)

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

Previous review (commit 4b1f06c)

Status: 1 Issues 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/src/sandbox-containers/SandboxContainers.ts 603 Retry path re-execs bun with no backoff when a pid: 0 handle's exitCode fulfils and the fresh probe is absent, allowing a tight respawn loop until the 90s readiness deadline.
Files Reviewed (3 files)
  • services/cloud-agent-next/src/sandbox-containers/SandboxContainers.ts - 1 issue
  • services/cloud-agent-next/src/sandbox-containers/containers-billing.test.ts - 0 issues
  • services/cloud-agent-next/src/sandbox-containers/sandbox-containers.test.ts - 0 issues

Fix these issues in Kilo Cloud


Reviewed by deepseek-v4.1-flash · Input: 0 · Output: 0 · Cached: 0

Review guidance: REVIEW.md from base branch main

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