Repository navigation
feat(fsb): resolve SandboxPool through the shared informer at create - #3120
Merged
Pangjiping merged 2 commits intoNov 26, 2026
Merged
Conversation
The fsb create path learned a pool's resource mode and default profile from FastPath GetPool: one RPC per image/snapshot create, and a 15-minute TTL cache for template creates. Pool mode and action handlers now come from one read of the SandboxPool CR through the shared K8sClient informer, the pool-watch prerequisite of OSEP-0034 (opensandbox-group#3115). - PoolSnapshot/PoolCRReader project the CR as fast-sandbox's ResourceMode() sees it: ResourceAware needs mode, cpu, memory and overcommitRatio, and every other shape keeps the legacy gate. Quantities may be numbers or strings and still compare canonically with the request limits. - The target pool is resolved before mapping (resolve_pool_ref), so each request maps once instead of twice and steady-state creates make no GetPool call. - A 403 on sandboxpools means the server image is newer than its ClusterRole: creates fall back to GetPool without action handlers, and the informer takes over once RBAC converges. The server ClusterRole gains get/list/watch on sandboxpools. action_handlers is parsed but not consumed yet; it feeds the runtime-init binding once opensandbox-group#3115 lands. A create that both targets a missing pool and carries an unsupported field now returns 404 instead of 400, because the pool is resolved before validation. Signed-off-by: 高然 <pangjiping.pjp@alibaba-inc.com>
Pangjiping
marked this pull request as ready for review
November 26, 2026 02:13
Pangjiping
requested review from
Generalwin,
hittyt,
jwx0925 and
ninan-nn
as code owners
November 26, 2026 02:13
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cc6b7dea32
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
The pool is resolved before the request is mapped, so a cold or stale SandboxPool cache makes the create wait on a live API-server GET before the mapping read the clock for expires_at. The TTL then grew by that wait (a 2.5s pool read extended a 3600s TTL by 2.2s) while createdAt stayed at the pre-read timestamp. Pass the captured created_at to both one-pass mappings so expiresAt is createdAt + timeout again. Addresses the Codex review finding on opensandbox-group#3120. Signed-off-by: 高然 <pangjiping.pjp@alibaba-inc.com>
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
SandboxPoolwatch" section of OSEP-0034 (docs(osep): propose OSEP-0034 near-end runtime init for Fast Sandbox #3115):opensandbox-serverresolves the targetSandboxPoolthrough the sharedK8sClientLIST/WATCH informer (PoolCRReader/PoolSnapshot) instead of a per-createFastPath.GetPoolRPC plus the 15-minute_pool_mode_cache.ClusterRolegains read-onlyget/list/watchonsandboxpools.sandbox.fast.io.PoolSnapshot.from_crmirrors fast-sandbox'sSandboxResourceProfile.ResourceMode():ResourceAwarerequiresmode,cpu,memoryandovercommitRatio; every other shape keeps the legacy gate. The OSEP-0026 pool-profile checks are unchanged, and int-or-string quantities compare canonically with the request limits.resolve_pool_ref), so each create maps once and steady-state template, image and snapshot creates make noGetPoolcall.403onsandboxpools(server image newer than itsClusterRole) falls back toGetPoolwith no action handlers and one warning per outage; the watch takes over once RBAC converges.PoolSnapshot.action_handlersis parsed but not consumed yet; it drives theruntime-initbinding in docs(osep): propose OSEP-0034 near-end runtime init for Fast Sandbox #3115.404 FSB_POOL_NOT_FOUNDinstead of400, because the pool is resolved before the single mapping pass.Testing
server:uv run ruff checkis clean anduv run pytest --cov=opensandbox_server --cov-fail-under=80passes (3225 passed, 34 skipped, 87% total coverage). The newtests/test_fsb_cr_reader.pycovers the mode-gate parity matrix,404/403/503mapping, cache-backed reads, watch-driven handler and mode changes, and the stale-cache fallback to the live API.test_fsb_service.pyandtest_templates.pycover zeroGetPoolcalls on steady-state creates, canonical quantity comparison,404on a missing pool, the403fallback, and a same-name pool recreate flipping the mode.manifests:helm lint manifests/charts/serverandhelm templaterender the new rule;scripts/verify-license.shpasses.Not run: the
scripts/fast-sandbox-envintegration stack and the KVM e2e workflow.Breaking Changes
Checklist
GetPool/TTL mechanismsandboxpools; no new data-plane surfaceClusterRolekeeps serving creates through theGetPoolfallback, and the mode gate fails safe