Skip to content

fix(cloud-agent): bump CLI to 7.4.20 and default bash timeout to 4m - #5072

Merged
eshurakov merged 1 commit into
mainfrom
fix/cloud-agent-sandbox-timeout-and-cli-7.4.20
Aug 6, 2026
Merged

fix(cloud-agent): bump CLI to 7.4.20 and default bash timeout to 4m#5072
eshurakov merged 1 commit into
mainfrom
fix/cloud-agent-sandbox-timeout-and-cli-7.4.20

Conversation

@eshurakov

@eshurakov eshurakov commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Summary

Cloud Agent sessions were dying during heavy commands (like pnpm typecheck) with a generic wrapper failure, even though the sandbox was still alive.

This PR fixes two things that caused that:

  1. Upgrade Kilo CLI to 7.4.20 — when a command is killed (OOM, SIGKILL, etc.), the agent now gets the exit code immediately and can continue, instead of hanging.
  2. Default shell timeout of 4 minutes — if a command stalls with no output (e.g. thrashing at a memory limit), it is stopped before the 5.5-minute session liveness deadline, so the agent can recover instead of the whole session failing.

Also adds a small env passthrough so the default timeout can be overridden from Worker config if needed.

What we found

We reproduced the failure on a test Worker with a clean checkout of this monorepo:

Setup Result
6 GB sandbox Session dies during install/typecheck
12 GB sandbox Session stays healthy; typecheck can finish
Command killed by signal (on 7.3.x) Agent could hang waiting for exit
Same kill on 7.4.20 Exit 137 right away; agent continues
Long timeout + memory pressure Process stays alive but stuck; session times out after ~5.5 min
Short timeout under same pressure Command fails cleanly; agent runs a follow-up and finishes normally

So there were two separate issues:

  • Killed process not reported → fixed by CLI 7.4.20
  • Stuck-but-alive process → fixed by a 4-minute default shell timeout (under the 5.5-minute liveness limit)

This does not make a full monorepo typecheck fit in 6 GB — that still needs more memory. It makes failures visible and recoverable instead of taking down the session.

Test plan

  • Unit tests for timeout default, override, and env filtering
  • Deployed to Cloudflare test Worker (cloud-agent-next-evgeny-test)
  • Confirmed kilo --version is 7.4.20 on that deployment
  • Signal kill (kill -KILL $$) returns exit 137 immediately; agent runs a follow-up command
  • Heavy stalled command with a short shell timeout fails cleanly; agent recovers and session completes normally
  • Same heavy workload with a long timeout still hits the stuck-but-alive path (confirms why the default timeout is needed)

Ship the Kilo signal-settlement fix and keep stalled shell tools inside
the 330s wrapper no-output deadline so saturated cgroup workloads fail
recoverably instead of as wrapper_error_after_activity.
@eshurakov
eshurakov requested a review from pandemicsyn August 5, 2026 21:22
@kilo-code-bot

kilo-code-bot Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Executive Summary

Reviewed the CLI 7.4.20 bump and KILO_EXPERIMENTAL_BASH_DEFAULT_TIMEOUT_MS=240000 hardcoded default with Worker-env passthrough: env-key allowlisting plus shell-quoting guard injection, override ordering is correct in both the process env record and the inlined command string, plumbing through ensureWrapper/ensureBootstrapWrapper into ensureRunning is intact, version pins are consistent across Dockerfiles, wrangler image_vars, package manifests, and the generated slash-command catalog, and the new tests cover default, override, and key-filtering behavior.

Files Reviewed (16 files)
  • pnpm-lock.yaml
  • services/cloud-agent-next/Dockerfile
  • services/cloud-agent-next/Dockerfile.dev
  • services/cloud-agent-next/Dockerfile.dind
  • services/cloud-agent-next/package.json
  • services/cloud-agent-next/src/agent-sandbox/cloudflare/cloudflare-agent-sandbox.test.ts
  • services/cloud-agent-next/src/agent-sandbox/cloudflare/cloudflare-agent-sandbox.ts
  • services/cloud-agent-next/src/kilo/devcontainer.ts
  • services/cloud-agent-next/src/kilo/wrapper-client.test.ts
  • services/cloud-agent-next/src/kilo/wrapper-client.ts
  • services/cloud-agent-next/src/shared/default-slash-commands.generated.ts
  • services/cloud-agent-next/src/shared/kilo-server-env.ts
  • services/cloud-agent-next/src/types.ts
  • services/cloud-agent-next/test/e2e/README.md
  • services/cloud-agent-next/wrangler.jsonc
  • services/cloud-agent-next/wrapper/package.json

Reviewed by kimi-k3 · Input: 70.3K · Output: 10.5K · Cached: 732.2K

Review guidance: REVIEW.md from base branch main

@eshurakov
eshurakov merged commit 0d4060a into main Aug 6, 2026
72 checks passed
@eshurakov
eshurakov deleted the fix/cloud-agent-sandbox-timeout-and-cli-7.4.20 branch August 6, 2026 07:48
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