Repository navigation
Closed
Labels
Description
Split from #4124 (TALE-63), whose remaining items are worked on fix/sandbox-review-follow-ups. This is the second path to #4124's MEDIUM 2 that #4124 (comment) added; #4144's body first recorded it as "a front waiter can lose its place in the spawner's line". MEDIUM 2's first path, a slow re-ask inside the spawner, was fixed by #4169: waitersAhead keeps a waiter while an ask of its own runs its probes.
What happens
I checked it from source on feature-train = 5298776c41a52560a3d6d3b6e45dcd21bb610bbf; nothing was run.
- The spawner drops a waiter that hasn't asked again within
2 × hintMs + QUEUE_LIVE_SLACK_MS(services/sandbox/src/session/session-routes.ts:1275-1290).- For the front of the line that's 25 s (
QUEUE_FRONT_HINT_MS5 s,QUEUE_LIVE_SLACK_MS15 s). - The 10-minute lease (
QUEUE_LEASE_MS) is only an upper bound. Renewing it throughPOST /v1/sessions/:id/wait(renewWaiter,:1354) also refresheslastAtMs.
- For the front of the line that's 25 s (
- The platform renews the place only once, right after a 429 that names it (
services/platform/backend/core/node_only/sandbox/helpers/session_client.ts:1167-1176).- After that, its re-ask is a job on the agent start queues, which run on
AGENT_START_SLOTSone-job slots. - A start that launches holds its slot through the session create (runnerd readiness alone may take 180 s) and its first 90 s drive window (
DRAIN_WINDOW_MS,services/platform/backend/core/chat/external_turn_shared.ts:72).
- After that, its re-ask is a job on the agent start queues, which run on
- The result: under load, a re-ask that is due can wait past 25 s. Its waiter is then pruned, and it rejoins at the back of the line.
Effect: fairness and latency, not data. A run that was first in line can be overtaken by every create that asked while it waited for a start slot.
Options
- While its start job is queued, the platform renews the place at the hint's pace, from outside the start slots.
- The spawner measures liveness from the hint's due time, plus an allowance for the platform's start latency.
- A waiter whose lease is renewed keeps its place until the lease ends or an explicit cancel (fix(sandbox): release resources safely under concurrent load #4150 removes cancelled waiters at once). The
2 × hint + 15 swindow then only applies to a waiter that never renewed.
Acceptance
- A waiter whose re-ask is held past the prune window by a busy start slot keeps its place.
- A waiter that went away is still dropped, by its lease or an explicit cancel, so a ghost holds no slot or memory for longer than today.
- Each changed side has a test that fails before the fix.
- Re-check on the current
mainandrelease/0.6first.
Refs #4124
Activity
tale-code-bot commentedon Oct 31, 2026
Correction to option 3: "#4150 removes cancelled waiters at once" is wrong. The cancelled waiters #4150 removes are in the Docker CLI slot queue (
DockerCliSlotsinservices/sandbox/src/spawn-util.ts), not in this line.The spawner's session waiter line has no cancel call. A place ends in one of three ways:
2 × hint + 15 swindow passes;invalidateWaiterruns, on a destroy of the id, an admission or a queue-cap eviction (services/sandbox/src/session/session-routes.ts).That changes what option 3 costs. Take a waiter the platform renewed once and then abandoned: under option 3 it would keep its place until its lease ends, up to 10 minutes instead of about 25 s. The crawl/render lane abandons waiters this way: it marks a refused create collected without cancelling, and uses a new ID on its next continuation.
Option 3 therefore meets the second acceptance point only with one of these:
Options 1 and 2 are unaffected.
(TALE-63, Coder)
fix(platform): keep a waiting start's place in the sandbox host's line
docs: amend the v0.5.95 release notes
docs: amend the v0.5.95 release notes