Skip to content

improvement(sandbox): return a timed-out workbench run's output and the files it already wrote - #9596

Merged
waleedlatif1 merged 2 commits into
stagingfrom
improvement/sandbox-timeouts-and-floor
Nov 3, 2026
Merged

waleedlatif1 merged 2 commits into
stagingfrom
improvement/sandbox-timeouts-and-floor

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • A run_code call stopped at its own timeout returned stdout: "" and only Function execution timed out after Nms, so the model reran long jobs from scratch
  • E2B adapter: the SDK throws a stream-less TimeoutError; a timed-out command now returns the stdout/stderr the stream callbacks already observed
  • Workbench (session sandbox) runs that hit their own timeout throw SandboxExecutionTimeoutError — still a timeout AbortError, so every existing timeout check accepts it — carrying the last 64 KB of output and the files already in the call's output directory (listing bounded to 3 s, best effort)
  • The route returns that output in stdout with the existing 408 and appends: how long the code ran, that the workbench and its files persist, which output files exist, and to rerun only the remaining work
  • Partial output goes through the same session provenance gate (withheld when provenance is unavailable) and secret-name reporting as any other result
  • Unchanged: one-shot sandboxes (Function blocks, documents, vision), the cancellation path, the error prefix, and billing (a timeout still carries no cost)

Type of Change

  • Improvement

Testing

  • New tests, each red on pre-change code and green after: E2B timeout keeps the observed streams; code and shell workbench timeouts report output and exported files (sentinel and directories excluded); listing failure or hang still reports output; huge output keeps only its tail; provenance failure withholds the output; route returns 408 with partial stdout, __resolvedSecretNames, and no cost
  • e2b-session.test.ts, session-sandbox.test.ts, execute-request.test.ts, conformance.test.ts, session-cli.test.ts (422 tests) and bun run lint; type-check and audits run in CI

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing (new tests pass the test-audit authoring gate)
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

…he files it already wrote

A run_code call killed at its own timeout returned an empty stdout and only
"timed out after Nms", so models reran long jobs from scratch. E2B's SDK throws
a stream-less TimeoutError, which dropped the output the stream callbacks had
already observed.

- E2B adapter: a timed-out command returns the stdout/stderr its callbacks observed
- Workbench runs (session sandboxes) that hit their own timeout throw a timeout
  abort carrying the output tail (64 KB) and the files already in the call's
  output directory; every existing timeout check still accepts it
- The route returns that output in stdout with a 408 and says the workbench and
  its files persist, so the next call can rerun only the remaining work
- Output goes through the same session provenance check and secret-name
  reporting as any other result; one-shot sandboxes and billing are unchanged
@vercel

vercel Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
docs Skipped Skipped Nov 3, 2026 2:45am UTC

Request Review

@greptile-apps

greptile-apps Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge.

Summary

Returns partial output and saved file names when a workbench run reaches its own timeout.

  • Timed-out E2B commands keep the output their streams already showed.
  • Timed-out workbench runs carry their output and saved files forward.
  • Function timeout responses show progress from reusable workbench runs.

No actionable new issues or confirmed repository-rule violations were found.

Reviews (2) · Last reviewed commit: "fix(sandbox): keep a cancellation during..." · Reviewed by Greptile

@cubic-dev-ai cubic-dev-ai 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.

All reported issues were addressed across 8 files

Reply with feedback, questions, or to request a fix.

Turn on auto-fix | Re-trigger cubic

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai 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.

No issues found across 8 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Turn on auto-fix | Re-trigger cubic

@waleedlatif1
waleedlatif1 merged commit 3fa33cf into staging Nov 3, 2026
81 checks passed
@waleedlatif1
waleedlatif1 deleted the improvement/sandbox-timeouts-and-floor branch November 3, 2026 03:02

This branch was previously deployed

1 inactive deployment
Preview — 75dcdbf5 Deployed Nov 3, 2026 by vercel[bot]
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.

1 participant