Repository navigation
fix(python): add opt-in sandbox delete timeout - #4697
ericcurtin wants to merge 7 commits into
Conversation
Signed-off-by: Eric Curtin <eric.curtin@docker.com>
|
@krishicks @matthewgrossman could you please triage #4685 so the issue check can pass? @drew @sjenning PTAL, and |
|
/ok to test 14c6a40 |
Compatibility review (advisory)New or updated breaking changes; see the full report for all findings. 1. python-sdk — No explicit risk acceptance found
Review details
Advisory review; publication gates are unchanged. |
|
@ericcurtin please see the compatibility review and address the concern. Thanks! |
Signed-off-by: Eric Curtin <eric.curtin@docker.com>
|
@TaylorMutch Fixed: |
|
/ok to test 42bcba0 |
@TaylorMutch, there was an error processing your request: See the following link for more information: https://docs.gha-runners.nvidia.com/cpr/e/2/ |
|
/ok to test 42bcba0 |
Just FYI we can't use short sha's anymore on /ok to test. |
|
@ericcurtin please see the branch check failures |
…e-timeout/ericcurtin
Signed-off-by: Eric Curtin <eric.curtin@docker.com>
|
@TaylorMutch Fixed the typecheck failure. |
JohnnyWilson16
left a comment
There was a problem hiding this comment.
Tested commit dd5dfad locally:
Backward compatibility verified: SandboxSession.delete() correctly omits the keyword when timeout=None, preserving compatibility with legacy client subclasses.
Defaults preserved: standard callers remain bound to 30s; delete_timeout_seconds=120.0 in e2e/python/conftest.py resolves the Kubernetes pod termination race.
Passing unit tests verified in python/openshell/sandbox_cleanup_test.py and python/openshell/sandbox_test.py.
Looks good to land.
|
/ok to test dd5dfad |
|
@TaylorMutch @mrunalp PTAL when you get a chance. Thank you! |
|
@drew @johntmyers PTAL when you get a chance. CI is green, only a maintainer approval is missing. Thank you! |
rhuss
left a comment
There was a problem hiding this comment.
cc-review Summary
Thanks for this! It is a small, well-scoped fix for #4685, and the opt-in approach matches what the issue asks for.
This is an agent-assisted review, produced with cc-review and several reviewer agents. The failure scenarios in the comments were derived from reading the code and were not executed.
All findings are non-blocking suggestions (Minor or Notable). The two I'd look at first are the test tightening on python/openshell/sandbox_cleanup_test.py:185 and whether the PR should close #4685 before a Kubernetes run is shown. Once those are settled, this looks ready for a maintainer to me.
What Went Well
SandboxSession.delete(python/openshell/sandbox.py:629-639) forwardstimeoutonly when it is set, so existingSandboxClientsubclasses with the old signature keep working. That cleanly answers the compatibility review, andtest_sandbox_session_delete_omits_timeout_for_legacy_clients(python/openshell/sandbox_test.py:3095-3114) pins the contract.SandboxClient.delete(python/openshell/sandbox.py:1096) scopes the override to the singleDeleteSandboxcall, falls back to the client timeout, and still honors an explicit0.delete_timeout_secondsdefaults toNonenext toready_timeout_seconds(python/openshell/sandbox.py:1602), so the SDK default stays unchanged as #4685 requires, and__exit__keeps the delete insidetry/finally, so the client is released even onDEADLINE_EXCEEDED.test_context_cleanup_delete_timeout_is_opt_indrives the real intercepted gRPC stub against an in-process server with a controlled delay, and the newdelete_delaydefaults to0.0, so the existing cleanup tests are unaffected.- The 120s value is scoped to the e2e fixture with a comment explaining why (
e2e/python/conftest.py:98-100), instead of raising the SDK-wide default.
Findings
| Severity | File | Description | Source |
|---|---|---|---|
| Minor | e2e/python/conftest.py:100 |
Direct sandbox_client.delete calls in other e2e tests keep the 30s default (follow-up) |
gator |
| Notable | e2e/python/conftest.py:100 |
Kubernetes run for #4685 criterion 4 not shown, but the PR closes the issue | goal-alignment |
| Minor | python/openshell/sandbox.py:1087 |
Naming nit: per-call timeout vs delete_timeout_seconds / timeout_seconds |
architecture |
| Notable | python/openshell/sandbox.py:1087 |
New public timeout keyword on both delete methods is not listed in the PR description |
goal-alignment |
| Minor | python/openshell/sandbox.py:1602 |
Kubernetes users may not discover delete_timeout_seconds; a docs note would help |
gator |
| Notable | python/openshell/sandbox.py:1733 |
wait_deleted on the ACCEPTED path keeps its fixed 60s bound (informational) |
architecture |
| Minor | python/openshell/sandbox_cleanup_test.py:165 |
No case where the configured delete_timeout_seconds itself expires (#4685 criterion 3) |
goal-alignment |
| Minor | python/openshell/sandbox_cleanup_test.py:185 |
Short deadline also covers __enter__, and the test never asserts DeleteSandbox ran |
test-quality |
All findings are posted as inline comments.
Review Details
- Findings posted: 8
- Findings reviewed and not posted: 0
- Gate outcome: PASS (no Critical or Important findings)
- Participating reviewers: architecture, goal-alignment, test-quality, gator (correctness, production and security also ran and reported no findings)
Signed-off-by: Eric Curtin <eric.curtin@docker.com>
|
Updated: cleanup tests now put only the exit delete under the short deadline and cover |
Signed-off-by: Eric Curtin <eric.curtin@docker.com>
|
Merged main, one docs conflict resolved. Tests pass. |
|
@pimlock @alangou PTAL when you get a chance, and |
Signed-off-by: Eric Curtin <eric.curtin@docker.com>
|
@rhuss @TaylorMutch PTAL, review notes addressed. Could one of you comment ok to test 91ff960? Thank you! |
|
/ok to test 91ff960 |
|
Label |
|
Validated the Python SDK and E2E fixtures at commit
The tests used the PR's fixtures without test-local timeout overrides. A temporary timing wrapper observed Commands, against the isolated registered Kubernetes gateway: E2E_PARALLEL=1 uv run pytest -o python_files='test_*.py *_test.py' -n 0 e2e/python/test_exec_admission.py
E2E_PARALLEL=1 uv run pytest -o python_files='test_*.py *_test.py' -n 0 e2e/python/test_sandbox_api.py::test_sandbox_labels_and_selectorsTemporary test resources were removed afterward. The |
|
@TaylorMutch the two k3s E2E failures are the get.k3s.io installer checksum, fixed on main by #5223. I can merge main, but that dismisses your approval, so shall I? Thank you! |
Summary
Python E2E cleanup no longer fails when Kubernetes pod termination outlasts the 30s delete deadline.
Related Issue
Closes #4685
Changes
delete_timeout_secondstoSandbox. The default is unchanged.timeout_secondskwarg toSandboxClient.deleteandSandboxSession.delete.Testing
Ran
pytest python/,ruffandty. Not run against a Kubernetes gateway.Checklist