Skip to content

feat(fleets): FleetSandboxService lifecycle backend (OSEP-0007 Phase 1a, T3) - #1571

Open
Pangjiping wants to merge 2 commits into
opensandbox-group:mainfrom
Pangjiping:feat/fleets-sandbox-service
Open

feat(fleets): FleetSandboxService lifecycle backend (OSEP-0007 Phase 1a, T3)#1571
Pangjiping wants to merge 2 commits into
opensandbox-group:mainfrom
Pangjiping:feat/fleets-sandbox-service

Conversation

@Pangjiping

Copy link
Copy Markdown
Collaborator

Summary

Work item T3 of OSEP-0007, Phase 1a: the FleetSandboxService lifecycle backend on top of the fast-sandbox FastPath v2 gRPC API (prereqs: #1558 client, #1559 mapping).

Changes

  • FleetSandboxService(SandboxService, ExtensionService) — full lifecycle surface against FastPath v2:
    • create_sandbox: simplified Create (mapping + pool-profile validation), bounded DataPlaneReady wait, accepted-Pending recovery on ambiguous post-persistence failures
    • get_sandbox / list_sandboxes (exhaust continue tokens → state/metadata filter → OpenSandbox page/total semantics) / delete_sandbox (404-preflight, async finalizer) / renew_expiration / patch_sandbox_metadata (RFC 7396, reserved-key protection)
    • diagnostics backed by GetSandboxDiagnostics; pause/resume/logs/get_endpoint return clear unsupported errors (phase 1a)
  • ExtensionService.get_access_renew_extend_seconds reads the reserved renew-extend-seconds metadata key
  • FastPathClient switched to a synchronous gRPC channel — lifecycle methods run in FastAPI thread-pool handlers and asyncio.to_thread renew workers, where an aio channel bound to another event loop would be unsafe (matches Docker/K8s sync-call pattern)
  • Wiring: FleetsRuntimeConfig, runtime.type = "fleets", AppConfig.fleets, factory registration, snapshot factory → NoopSnapshotRuntime, fleets error codes
  • 21 new unit tests against an in-process fake FastPath server (75 fleets tests total)

Notes

Verification

  • uv run pytest tests/test_fleets_service.py tests/test_fleets_mapping.py tests/test_fleets_fastpath_client.py tests/test_config.py tests/test_snapshot_runtime_factory.py tests/test_runtime_resolver.py — 185 passed
  • uv run ruff check — clean

…ase 1a, T3)

- FleetSandboxService(SandboxService, ExtensionService): create/get/list/
  delete/renew-expiration/patch-metadata/diagnostics against FastPath v2;
  pause/resume/logs/get_endpoint return clear unsupported errors (phase 1a)
- idempotent Create with pool-profile validation and bounded DataPlaneReady
  wait; ambiguous post-persistence failures recover by Get and return
  accepted Pending
- list exhausts FastPath continue-token pages, applies state/metadata
  filters, then computes OpenSandbox page/total/hasNextPage semantics
- Delete preflights Get to preserve the public 404 contract
- ExtensionService reads renew-on-access from the reserved
  renew-extend-seconds metadata key
- FastPathClient switched to a synchronous gRPC channel: lifecycle methods
  run in FastAPI thread-pool handlers and asyncio.to_thread renew workers,
  where an aio channel bound to another loop would be unsafe
- FleetsRuntimeConfig + RuntimeConfig.type=fleets + AppConfig.fleets;
  snapshot factory maps fleets to NoopSnapshotRuntime; factory registers
  the new service; fleets error codes added
@github-actions github-actions Bot added component/server size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Aug 19, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1502b31109

ℹ️ 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".

Comment thread server/opensandbox_server/services/fleets/fleet_service.py
Comment thread server/opensandbox_server/services/fleets/fleet_service.py
Comment thread server/opensandbox_server/services/fleets/fleet_service.py
Comment thread server/opensandbox_server/services/fleets/fleet_service.py Outdated
Comment thread server/opensandbox_server/services/fleets/fleet_service.py
- lazy-connect FastPathClient on first use so production lifecycle calls
  work without an explicit connect() hook
- offload the synchronous create workflow (pool lookup + Create +
  DataPlaneReady wait) to asyncio.to_thread so the event loop stays
  responsive during bounded readiness waits
- enforce server.max_sandbox_timeout_seconds via ensure_timeout_within_limit
  before mapping the create request
- hide fleets-reserved metadata keys from the create response, matching
  get/list behavior
- resolve the tenant namespace for background lookups (renew workers,
  proxy) by scanning the injected tenant provider before falling back to
  the global namespace, mirroring the Kubernetes backend
- tests: lazy connect, reserved-key hiding, max timeout, tenant fallback
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component/server size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant