Repository navigation
feat(python): add native async sandbox clients - #5168
maxdubrinsky wants to merge 1 commit into
Conversation
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
|
🌿 Preview your docs: https://nvidia-preview-pr-5168.docs.buildwithfern.com/openshell |
Signed-off-by: Max Dubrinsky <mdubrinsky@nvidia.com>
6aae4ae to
d2c03fb
Compare
Compatibility review (advisory)New or updated breaking changes; see the full report for all findings. 1. python-sdk — No explicit risk acceptance foundThe RPM's openshell initializer previously imported installed synchronous modules but now unconditionally imports _async_runtime and aio, neither included by openshell.spec.
Review details
Advisory review; publication gates are unchanged. |
TaylorMutch
left a comment
There was a problem hiding this comment.
Reviewed commit d2c03fb86327661287ce0cce2f3fca9cdd225bee. Requesting changes for the following findings:
-
RPM installs break existing synchronous imports.
python/openshell/__init__.py:8-15now unconditionally imports_async_runtimeandaio, butopenshell.specinstalls neither module. Staging the exact top-level files selected by the spec, plus generated RPC modules, confirms thatfrom openshell import SandboxClientsucceeds at the base (b35e39f64bcef8cc904d8d981db423c50f1076b0) and fails at this head withModuleNotFoundError: No module named 'openshell._async_runtime'. Please install both_async_runtime.pyand generatedaio.pyin the RPM and add an installed-package import check covering the synchronous and asynchronous exports. -
Per-call deadline overrides are missing. The generated async methods retain
timeout=self._timeoutand expose no RPC deadline argument; for example,AsyncSandboxClient.get()accepts onlynameandworkspace. Before using these high-level helpers, consumers can supply deadlines directly on raw RPC calls; the new helpers cannot express different deadlines for concurrent operations on a shared client. Issue #5164 explicitly requests per-call deadlines. Please expose and forward a per-operation deadline override, preserving the client default when omitted, and test concurrent calls with different deadlines.timeout_secondsfor command execution is a separate server-side execution limit and should not substitute for an RPC deadline. Relevant sources:tasks/scripts/generate_python_async.pyand the generated client methods. -
Request IDs stop at
exec_stream().python/openshell/sandbox.py:1355addsrequest_idtoexec_stream(), butexec()(:1459),exec_python()(:1496), and session wrappers cannot accept or forward it. The generator preserves this omission in the async API. As a result, callers using the ordinary execution helpers must drop to streaming or raw RPCs to supply an execution request ID, despite the issue's requirement to expose IDs on supported RPC operations. Please thread the optional ID through the execution helpers and session wrappers, and verify that the supplied value reachesExecSandboxRequest.
The overall approach sensibly shares request construction through generation while keeping async transport and cleanup handwritten. Validation against this head: 238 affected SDK and wheel-verifier unit tests passed, including all nine new async transport/routing tests, using Python 3.14.5 and grpcio 1.78.0. The RPM import comparison above is a staged-file reproduction, not a full RPM build. Full typing and wheel-build verification remain unverified; local typed generation lacked protoc-gen-mypy_grpc.
Summary
Async Python applications currently drop to raw RPCs or wrap the synchronous SDK in worker threads. Add native async counterparts with the same client structure, generated concrete method signatures, managed authentication, cancellation, pagination, and channel ownership.
Related Issue
Closes #5164
Changes
Release Notes
Testing
Checklist