Translate terminal sandbox errors to non-retryable ApplicationError#1595
Merged
Conversation
Sandbox integration activities in the OpenAI Agents contrib passed every exception from the agents.sandbox library through as-is, so Temporal treated them all as retryable. A terminal failure (e.g. the sandbox was stopped externally) would retry forever and wedge the workflow. openai-agents 0.17.5 exposes SandboxError.retryable. Wrap each sandbox activity so a SandboxError the library has classified as terminal (retryable is False) is re-raised as a non-retryable ApplicationError; transient and unclassified errors (retryable True or None) still propagate and retry by default. Fixes #1548 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR prevents Temporal workflows using the OpenAI Agents sandbox integration from retrying forever on terminal sandbox failures by translating agents.sandbox.errors.SandboxError instances marked retryable is False into non-retryable temporalio.exceptions.ApplicationError.
Changes:
- Add
_translate_sandbox_errors()and wrap sandbox-related activities so terminalSandboxErrors become non-retryableApplicationErrors. - Add unit tests verifying terminal vs transient/unclassified sandbox errors are handled as intended.
- Bump the
openai-agentsoptional dependency minimum to0.17.5to rely onSandboxError.retryable.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
temporalio/contrib/openai_agents/sandbox/_sandbox_client_provider.py |
Wrap sandbox activities to translate terminal SandboxErrors into non-retryable ApplicationErrors. |
tests/contrib/openai_agents/test_openai_sandbox.py |
Add tests asserting correct retryability mapping behavior for sandbox errors. |
pyproject.toml |
Update openai-agents extra to require >=0.17.5. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
DABH
approved these changes
Jun 15, 2026
DABH
left a comment
Contributor
There was a problem hiding this comment.
Makes sense to me - thanks for the fix
xumaple
commented
Jun 15, 2026
openai-agents 0.17.5 is required for SandboxError.retryable but was published inside the repo's 2-week exclude-newer cooldown, so uv resolved to "only openai-agents<=0.17.4 available" and every CI job failed at dependency install. Exempt openai-agents via exclude-newer-package and regenerate the lock; the >=0.17.5 floor bounds the exemption and the cooldown still applies to all other dependencies. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
tconley1428
approved these changes
Jun 16, 2026
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.
OpenAI Agents sandbox activities passed every
agents.sandboxexception through unchanged, so Temporal treated them all as retryable, and a terminal failure (e.g. the sandbox was stopped externally) retried forever and wedged the workflow.openai-agents 0.17.5 exposes
SandboxError.retryable. This maps aSandboxErrorthe library has classified as terminal (retryable is False) to a non-retryableApplicationError; transient and unclassified errors (retryableTrue or None) still propagate and retry by default.Fixes #1548