Add retry logic to interpreter.py for transient sandbox errors#157
Open
mendral-app[bot] wants to merge 1 commit into
Open
Add retry logic to interpreter.py for transient sandbox errors#157mendral-app[bot] wants to merge 1 commit into
mendral-app[bot] wants to merge 1 commit into
Conversation
Add exponential backoff retry to the CodeInterpreter's run_code() and create_code_context() methods for transient sandbox errors (404 with WORKLOAD_UNAVAILABLE body, 502, 503, 504). This matches the retry hardening already applied to filesystem.py, process.py, and drive.py in commit 9da4668, using the same settings.sandbox_read_retries budget and backoff parameters (0.5s base, 30s max) that the backend advises in its error responses.
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
CodeInterpreter.run_code()andcreate_code_context()for transient sandbox errors (404 WORKLOAD_UNAVAILABLE, 502, 503, 504)Details
The Blaxel sandbox backend returns transient errors when workloads are momentarily unavailable. The backend explicitly advises clients to retry with exponential backoff (500ms → 30s). This was already implemented for
filesystem.py,process.py, anddrive.py, but the interpreter module raisedRuntimeErrorimmediately on any error status.This change wraps the interpreter's HTTP calls in a retry loop using the same
settings.sandbox_read_retriesbudget (default 5 attempts) and matching backoff parameters.Insight: Flaky Integration Tests: sandbox transient errors
Note
Created by Mendral. Tag @mendral-app with feedback or questions.