Skip to content

Add retry logic to interpreter.py for transient sandbox errors#157

Open
mendral-app[bot] wants to merge 1 commit into
mainfrom
mendral/add-interpreter-retry-logic
Open

Add retry logic to interpreter.py for transient sandbox errors#157
mendral-app[bot] wants to merge 1 commit into
mainfrom
mendral/add-interpreter-retry-logic

Conversation

@mendral-app

@mendral-app mendral-app Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add exponential backoff retry to CodeInterpreter.run_code() and create_code_context() for transient sandbox errors (404 WORKLOAD_UNAVAILABLE, 502, 503, 504)
  • Completes the retry hardening started in commit 9da4668 which covered filesystem/process/drive but missed the interpreter path

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, and drive.py, but the interpreter module raised RuntimeError immediately on any error status.

This change wraps the interpreter's HTTP calls in a retry loop using the same settings.sandbox_read_retries budget (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.

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.
@mendral-app mendral-app Bot requested a review from a team June 10, 2026 18:29
@mendral-app mendral-app Bot marked this pull request as ready for review June 10, 2026 18:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants