Repository navigation
fix(cloud-agent): stop terminal input from extending sandbox lifetime - #7946
Merged
Merged
Conversation
Contributor
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Executive SummaryReviewed the 8-file change removing terminal input from control-plane heartbeat activity; the change is a consistent, well-covered contract update with no correctness issues found in the changed lines. Files Reviewed (8 files)
Verification Notes
Reviewed the documented behavior trade-off (a terminal-only session no longer pins the sandbox/lease) and consider it intentional per the PR description rather than a defect. Reviewed by deepseek-v4.1-flash · Input: 89.3K · Output: 13.1K · Cached: 1.3M Review guidance: REVIEW.md from base branch |
iscekic
approved these changes
Oct 19, 2026
This was referenced Oct 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
lastFrameAt. Reconnect and inactive heartbeat processing still do not refreshlastActivityAtor renew the provider lease.docs/control-plane.mdsection 6 and stale terminal activity contracts. No new timer,idleMs/unattendedIdleMschange, or production logic moved outsidewrapper/src/control-plane/.Intended Trade-Off
An interactive terminal without an agent turn now lets the sandbox stop after the applicable idle window, even while terminal input continues. This is the intended trade-off, not a regression: terminal-only workloads must not hold a container and its provider lease indefinitely. Preparation, native compute, pending delivery, and finalization keep their existing protection. The existing 10-minute interactive and 1-minute unattended policies remain unchanged.
Regression Coverage
active: trueand passes after it.Verified
pnpm --filter cloud-agent-next run test: 224 files passed; 6,819 tests passed, 3 skipped.pnpm --filter cloud-agent-next run typecheck: passed, including wrapper typecheck.pnpm --filter cloud-agent-next run lint: passed, 0 warnings/errors.pnpm --filter cloud-agent-next run build:wrapper: passed; all five bundles rebuilt, includingcontrol-plane-wrapper.js.services/cloud-agent-next/wrapper,bun test src/control-plane/main.test.ts src/control-plane/session-host.test.ts src/control-plane/terminals.test.ts src/control-plane/connection.test.ts: 79 passed, 0 failed.pnpm --filter cloud-agent-next exec vitest run src/control-plane/sandbox/allocation.test.ts src/control-plane/session/terminals.test.ts: 17 passed.pnpm format;git diff --check origin/main...HEADpassed.Live Local Acceptance: Passed
Follow-up verification on 2026-10-18 used
bash .kilo/cloud-agent-setup.sh, thenpnpm dev:start --no-attach agents fake-llm. The supported script installed Docker/tmux, configured the environment/database, and built the sandbox images. The local stack was real Worker + Durable Objects + Docker sandbox + wrapper + Kilo CLI7.8.1, with deterministic fake inference. No idle values or timer divisor were changed: the running wrapper reported divisor1, and public status reported600000ms.A one-off ignored driver at
services/cloud-agent-next/.wrangler/terminal-idle-acceptance.tscreated a fresh browser worktree and a gated bootstrap turn. It connected two real terminal PTYs in the SAME exclusively owned sandbox: one silent/open and one sending harmlessprintfinput every five seconds. Output confirmation required actual RS/US-delimited command results, not terminal command echo. Input began before releasing the bootstrap gate; after bootstrap completed, no further turns were sent and native idle/message/inference state was checked throughout.Measured run:
terminal-idle-fa89e112-ee60-4b3c-a5af-3ad02ca7ae53.2fad31d778a1775ad417cf7b1a03dcf4d1810f7ee63ef4d5399c1014726950f7. The running wrapper process allocation ID matched the owned SQLite allocation45a77299-c79c-4820-b187-4adfb1f01ca4.lastActivityAtstayed fixed at2026-10-18T20:17:02.393Z; the advertised sleep deadline stayed fixed at20:27:02.393Z. There were 117 observed advances of accepted-heartbeatlastFrameAtwhile activity and deadline did not move.610035ms; maximum confirmed round-trip cadence gap was5061ms. Both PTYs stayed connected through the deadline. No later native turn-open was observed; scoped fake inference remained exactly one request, including an independent final check after physical stop.connected -> stoppingfromtickwithstopReason=sandbox_stoppedat20:27:02.401Z. Providernative_stopwas correlated by the SAME allocationintentId, started at20:27:02.404Z, and returnedterminalat20:27:02.705Z.0e25d4095718recorded physicaldieat20:27:02.674000659Z, 281ms AFTER the unchanged deadline, anddestroyat20:27:02.688324911Z. Public status became sleeping. Probe acceptance was recorded at20:27:04.030Z; cleanup began only afterward at20:27:04.031Z. Thus cleanup did not produce the observed stop.services/cloud-agent-next/.wrangler/terminal-idle-evidence/terminal-idle-fa89e112-ee60-4b3c-a5af-3ad02ca7ae53/{evidence.jsonl,result.json}; result ispassed: true. The probe/evidence are ignored local verification artifacts, not committed tests. An owned local egress proxy retained after the main runtime stop was cleaned up separately afterward; this result does not claim a proxy-lifecycle fix.Remaining Verification Limits
pnpm --filter cloud-agent-next run test:wrapperdid not complete within the 210-second environment limit. It reported unchanged restore-timing, connection-snapshot, and certificate-refusal failures; restore/connection passed in isolation, while local certificate refusal assumes a CA file absent that is present here. That exact local aggregate invocation remains incomplete. Subsequent CI passed BOTH normal wrapper partitions:bun test ./src/control-plane/process.test.tsandbun test src --path-ignore-patterns=**/control-plane/process.test.ts.Wrapper Build / Version
No wrapper version bump is required by the current source-based build, and the heartbeat wire protocol is unchanged.
WRAPPER_VERSIONremains2.4.0. The wrapper bundles were rebuilt successfully;wrapper/dist/is repository-ignored and is not committed. Shipping still requires the normal rebuilt sandbox image/runtime artifact path.