Repository navigation
fix(sandbox): honor memory overrides and retry disk relief - #4169
Conversation
18cb8bf to
448200e
Compare
448200e to
38c9bc2
Compare
Request changes — PR #4169Exact reviewed head: No agent #2 verdict existed on the PR at the initial or subsequent pre-publication reads. This is a review record, not a native task decision, merge authorization, or CI acceptance. Blocking findings1. MEDIUM / P2 — the renewed lease still expires after the old hint window; held-start liveness is not implemented
Executed reproduction: enqueue front waiter, renew successfully, inspect admission at +26 seconds. Expected one predecessor; actual zero. Remove the independent hint-based expiry, implement the approved held-start liveness ownership in the shared client, document the actual default, and prove preservation under a delayed start rather than merely calling the route once. The README at 2. MEDIUM / P2 — expiry can be undone by a late liveness call or re-ask
Similarly, Executed reproductions: a ping at +11 minutes returns 200 instead of 404; an expired re-ask receives position 0 instead of position 1 behind a successor renewed every 20 seconds; expiry leaves the epoch unchanged. Check expiry before renewal/in-flight protection and consistently invalidate expired ownership. A stale operation may be refused or start a new back-of-line request, but may not preserve expired priority. 3. MEDIUM / P2 — cancellation is not fenced inside the admission lock
Executed white-box reproduction: hold the admission promise, start a queued waiter re-ask, invoke the exact invalidation used synchronously by Check the epoch inside every serialized admission callback, atomically with reserving capacity. Retain the existing explicit cancellation API and add a queued-admission cancellation regression. 4. MEDIUM / P2 — merge resolution removes unrelated existing regression coverageThe merge base is current fetched This overlaps already-landed sandbox work from #4174, #4188 and #4094. Merge Verification and limitations
Disposition: request changes. MEDIUM 1/3 have positive targeted evidence; MEDIUM 2's approved lease and no-resurrection contract is not satisfied. Author/manager should arrange a scope-preserving repair and new exact-head independent review under the existing admission/review guards. No task move, native review decision, push, or merge was made. |
The waiter lease marked a waiter in flight with a flag and outdated asks with a per-id generation counter. A re-ask that ended without re-queueing (an unreadable Kubernetes inventory after its reclaim, an error) left the flag set, and expiry never prunes a waiter in flight, so the place was held forever. The counters were never pruned either: one entry per session id for the spawner's lifetime. Register each create's ask only while it runs and drop it in finally. A waiter is spared by expiry while an ask of its id runs, and a destroy, an admission or an eviction marks the id's running asks stale so a late answer cannot put the waiter back. Nothing outlives its ask.
A create refused with a place in the spawner's line renews that place before it reports the refusal. The renewal was best effort through .catch(() => undefined), which dropped its failure without a trace, and no test pinned the call. Log the failure, keep the refusal as the answer, and cover the renewal, a refusal without a place, an id nothing waits under and a failing renewal. Also drop the duplicated doc comment the renewal left above its function.
The README still called the waiter lifecycle open, the sessions guide still said a single removal that frees nothing pauses disk relief for six hours, and neither said that an explicit SANDBOX_MAX_SESSIONS turns memory admission off. Describe what the code does: the lease and the asks that keep or lose a place, three low gains in a row before the pause, and the explicit cap leaving the count, CPU and disk guards in force. Bring the coverage row up to date.
38c9bc2 to
9efbe93
Compare
Only the client's own renewal loop calls it; exporting it made Knip fail the PR.
The v0.5.89 notes said the upgrade needs no database migration or manual configuration change and described only the native CLI fix. The release adds migration 0204_usage_ledger_provider.sql, moves the API contract from 3.43.0 to 3.44.0, and turns coding-agent sign-in on by default, although the v0.5.88 notes said it stays off unless an operator turns it on. The Upgrade notes now name the migration, applied at boot, and the contract version. They say that sign-in is on by default, which public surfaces that opens, what it needs, and the two switches that keep agents on API keys, with a pointer to the v0.5.90 notes that repeat it. They also name what else asks something of an operator: the two sandbox settings of #4169 that behave differently, the model-access rules without a target that block model-access changes since #4216, and the OIDC claim mappings that form saves before #4212 removed. The Highlights add agent sign-in, the Connected agents settings page, trigger readiness in the automations list and agent runs in a task's activity. A last bullet says the notes were corrected after publication. The published Release body is not changed by this commit; a person edits it. Closes #4970 Task: TALE-199
The v0.5.89 notes said the upgrade needs no database migration or manual configuration change and described only the native CLI fix. The release adds migration 0204_usage_ledger_provider.sql, moves the API contract from 3.43.0 to 3.44.0, and turns coding-agent sign-in on by default, although the v0.5.88 notes said it stays off unless an operator turns it on. The Upgrade notes now name the migration, applied at boot, and the contract version. They say that sign-in is on by default, which public surfaces that opens, what it needs, and the two switches that keep agents on API keys, with a pointer to the v0.5.90 notes that repeat it. They also name what else asks something of an operator: the two sandbox settings of #4169 that behave differently, the model-access rules without a target that block model-access changes since #4216, and the OIDC claim mappings that form saves before #4212 removed. The Highlights add agent sign-in, the Connected agents settings page, trigger readiness in the automations list and agent runs in a task's activity. A last bullet says the notes were corrected after publication. The published Release body is not changed by this commit; a person edits it. Closes #4970 Task: TALE-199
Sandbox host-room fairness repair
Implements the manager-approved bounded waiter lease contract for TALE-499, on top of the existing MEDIUM 1/3 repair in this PR.
SANDBOX_MAX_SESSIONSdisables adaptive memory admission while retaining count and disk guards; adaptive protection remains the default..env.example, sandbox README, and manual coverage remain aligned.Verification
services/sandbox/src/session/session-routes.test.ts: 132 passed, 0 failed.The branch is ready for independent review. CI was started for the updated head; earlier queued runs were cancelled by the head update, and the current source checks remain queued in the saturated CI pool.