feat(sandbox): add RemoteOperator with SandboxNextProvider - #1331
Open
Generalwin wants to merge 1 commit into
Open
feat(sandbox): add RemoteOperator with SandboxNextProvider#1331Generalwin wants to merge 1 commit into
Generalwin wants to merge 1 commit into
Conversation
- Add RemoteOperatorConfig to rock/config.py (endpoint, api_key, region, etc.) - Add RemoteProvider Protocol (lifecycle + optional Template API) - Implement SandboxNextProvider (httpx AsyncClient, 5xx retry, state mapping) - Implement RemoteOperator (delegates to provider, Redis merge, graceful fallback) - Extend OperatorContext and OperatorFactory for 'remote' type - Wire remote_config in admin/main.py - Add 43 unit tests (mock httpx MockTransport + AsyncMock provider) - Add design doc (docs/proposals/remote-operator.md) - Add SandboxNext OpenAPI spec (docs/proposals/sandbox-next.yaml) - Update CLAUDE.md module map resolves alibaba#1330
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
Add a new
remoteoperator type for integrating with remote sandbox platforms via HTTP REST API. This follows the same Provider abstraction pattern as K8sOperator (K8sProviderProtocol +BatchSandboxProvider).resolves #1330
Changes
New files
rock/sandbox/operator/remote/— RemoteOperator module (operator, provider Protocol, constants, SandboxNextProvider)tests/unit/sandbox/operator/remote/— 43 unit tests (mock httpx MockTransport + AsyncMock provider)docs/proposals/remote-operator.md— Design documentdocs/proposals/sandbox-next.yaml— SandboxNext Gateway OpenAPI specModified files
rock/config.py— AddRemoteOperatorConfig(endpoint, api_key, region, sandbox_class, etc.)rock/sandbox/operator/factory.py— ExtendOperatorContextwithremote_config, add"remote"branch toOperatorFactoryrock/admin/main.py— Passremote_config=rock_config.remotetoOperatorContextCLAUDE.md— Update module mapDesign highlights
httpx.AsyncClient, 5xx exponential backoff retry (max 3), 4xx immediate return. State mapping table (SandboxNext → Rock State), configurable.get_statusmerges Redis user metadata with provider real-time status. Template API catchesNotImplementedError→BadRequestRockError.host_ip=endpoint_templatestring directly,port_mappinghardcoded{PROXY: 8000, SERVER: 8080, SSH: 22}(same as K8s). ReusesSandboxProxyService(Rocklet RPC).pause501 → fallback todelete.operator_requires_ray("remote")→False.operator_supports_scheduler("remote")→False.Test plan
pytest tests/unit/sandbox/operator/remote/ -v)python-ciworkflow passes