Repository navigation
Prepare no sandbox for expired input - #971
Merged
Merged
Conversation
A never-allocated Environment whose initial input expired, with no live input, is no longer placement demand; it waits again from its live input's creation once new input arrives. Provisioning rechecks the same query before creating a workspace for a new or released allocation, and ReserveAllocation rechecks it under the deployment lock; a failed recheck releases that attempt's node reservation like any failed preparation.
Read live input through the unique pending row and the input history only for an Environment never allocated, so the demand scan no longer grows with history. The preparation check lists only Environments the view marks as not waiting, so reset, failed and not-ready cases keep their own errors; a lapsed refusal rescans placement at once. Document the pending state of an Environment whose input expired.
The never-allocated demand test reads a Session's initial input through a partial index, so the scan no longer reads its whole input history. Tests pin that reset, failed and not-ready cases keep their own errors and that a lapsed release wakes the placement scan.
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
ReserveAllocation(under the deployment lock) recheck the rule; a lapsed Environment gets nothing prepared, its node reservation is released and the scheduler rescans at once. Reset, failed Environments and unready workspaces keep their own errors.runtime_placement_demandview (migration 000016). The scan and the per-Environment check read it; the check is its ownid = $1statement so it keeps an index plan under a cached generic plan. Live input is read through the one-pending partial index and the initial input through a new partial index, so the cost does not grow with input history (first scan page at ~1.1M reservation rows: main 75 ms, this branch 70–83 ms; per-Environment check 0.2–0.7 ms).sandbox-deployment.mdplacement paragraph andenvironment-files.md(en, zh). No ordering guarantee between placements and checkpoint restores is added.Direct deployments (E2B, OpenSandbox) are unchanged: they provision any active hosted Environment without an allocation regardless of its input state.
Test plan
ReserveAllocationrefusals; other refusals keep their errorsgo testdeployment/..., migrations, integration-run 'RuntimeNode|Placement';make check-sqlc;go vet ./services/core/...; website translation testOpen in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.