Repository navigation
fix(sandbox): reduce agent overhead and harden session recovery - #4173
Conversation
a1c2f8b to
e9bf623
Compare
|
Source-specific follow-up from the postmerge #4189 review, for this existing lifecycle lane. This is a read-only source finding, not an observed production slow-ping incident or a request for another parallel implementation. At current main This immediate recovery is deliberate in the existing route tests. The unresolved question is whether one transient probe failure is enough evidence to stop the session, rather than merely refuse new work. On this PR's exact head Please evaluate this within your existing health/lifecycle ownership. A bounded causal test should hold a synthetic socket past the production probe deadline, then recover it, and distinguish new-work refusal from destructive recovery. If confidence/hysteresis is needed, scope it to the same engine/session incarnation, do not count repeated reads of one cached failure as independent evidence, reset on healthy observations, and retain bounded recovery for sustained failure. Keep all existing claim/incarnation/pin/busy controls. No runtime was launched and no source changed in this audit. Please retain this as a source-bound acceptance question until the causal controls establish the behavior; do not infer fleet-wide failure or waive the existing unhealthy-recovery tests. Parent coordination is reserving this question to the current #4173 owner, not opening a duplicate writer. |
dfb8e2a to
cd861f9
Compare
cd861f9 to
5ed4056
Compare
Agent sandboxes start an inner Docker engine even when the task never uses it. This PR activates Docker on the first ordinary socket connection, shares concurrent startup, and stops the engine after five idle minutes only when a complete inventory confirms no active containers or enabled restart policies. The next command wakes it with its image store, volumes, networks and workspace intact. Agents need no mode selector; deployment capability restrictions still apply.
Health checks use a bounded supervisor endpoint that keeps intentionally idle Docker available without waking it. One slow probe refuses new work without stopping the session. Probe-based recovery requires three distinct failures spanning five seconds, resets on health recovery or engine replacement, and never counts cached reads again. Confirmed startup failure or unexpected exit is immediate failure evidence. Recovery still requires the atomic idle claim and all existing activity, pin and incarnation fences.
During a rolling upgrade, keep old spawners pinned to their existing runtime image until replacement; older spawners cannot interpret the new recovery-confidence field. A new spawner with an older runtime refuses unhealthy new work while retaining normal idle/lifetime cleanup.
The same change closes recovery and resource-boundary gaps:
English, German and French operator docs describe the automatic lifecycle. Runtime isolation, privileges and configured memory ceilings remain unchanged. Active tools/builders can still grow within their configured limits; these changes do not establish a fleet-wide hard memory or disk quota.
Validation for final head
5ed405612c762d6b6d1b16ed2a7472de393a785b:0121ae742c303de303f011583e9e65288ffc320f.Final log review distinguished real execution from cache replay, checked Playwright diagnostics and existing fixture/cleanup warnings, and verified compatibility with subsequent changes on main. No failed test or flaky retry remains; existing scanner findings and coverage limits are recorded above.