Skip to content

Add retry to exec() - #220

Open
mendral-app[bot] wants to merge 2 commits into
mainfrom
mendral/add-retry-to-exec
Open

Add retry to exec()#220
mendral-app[bot] wants to merge 2 commits into
mainfrom
mendral/add-retry-to-exec

Conversation

@mendral-app

@mendral-app mendral-app Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Wrap SandboxProcess.exec() POST call with retry_on_transient_reset_async, matching the pattern used by get(), list(), and logs() in the same file
  • Prevents httpx.ReadError from stale connections propagating unhandled to callers

Context

Insight: https://app.mendral.com/insights/01M07AAN6MCM0S1MWHKDGTH1XZ

exec() was the only sandbox method missing the transient retry wrapper, causing unhandled ReadError exceptions when the httpx client held a stale TCP connection.


Note

Created by Mendral. Tag @mendral-app with feedback or questions.


Note

Low Risk
Small, localized resilience change aligned with existing sandbox HTTP patterns; no auth or data-model changes.

Overview
SandboxProcess.exec() now wraps its POST /process HTTP call with retry_on_transient_reset_async, matching get(), list(), and logs() in the same module.

That closes a gap where stale pooled connections could raise unhandled httpx.ReadError (and related transient failures) on exec while other process APIs already retried and reset the client.

Reviewed by Cursor Bugbot for commit dded5d3. Bugbot is set up for automated code reviews on this repo. Configure here.

SandboxProcess.exec() calls client.post() directly without the
retry_on_transient_reset_async wrapper that protects other sandbox
methods (get, list, logs). This allows httpx ReadError from stale
connections to propagate unhandled to callers.

Wrap the non-streaming exec path in retry_on_transient_reset_async,
matching the pattern used by other methods in the same file.
@mendral-app
mendral-app Bot requested a review from a team August 17, 2026 07:36
@mendral-app
mendral-app Bot marked this pull request as ready for review August 17, 2026 08:02

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want fixes drafted automatically? Bugbot Autofix can create code changes for findings. A team admin can enable Autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 5ee526d. Configure here.

Comment thread src/blaxel/core/sandbox/default/process.py Outdated
POST /process is a non-idempotent create operation. Retrying after
a transport drop could spawn duplicate processes while callers only
see the later pid. Revert to the original non-retried path, consistent
with the test_process_exec_is_not_retried_on_transport_reset assertion
and the retry helper's documented scope (idempotent reads only).
@mendral-app

mendral-app Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the catch — you're right that POST /process is non-idempotent and retrying could spawn duplicate processes if the server accepts the request but the connection drops before the response arrives.

I've reverted the retry wrapper in dded5d3, restoring the original non-retried path. This is consistent with:

  • The is_transient_reset_error docstring scoping retries to idempotent calls
  • The sandbox_read_retries setting name
  • The existing test_process_exec_is_not_retried_on_transport_reset assertion

The original insight about stale connection errors propagating from exec() remains valid, but the correct mitigation would need to be at a different layer (e.g., connection pool health checks or client keepalive tuning) rather than blindly retrying a mutating operation.

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