Skip to content

fix(sandbox): drop in-flight fetches once the pool gives up or the time budget passes - #9793

Merged
waleedlatif1 merged 4 commits into
stagingfrom
fix/ivm-abort-abandoned-fetches
Nov 7, 2026
Merged

waleedlatif1 merged 4 commits into
stagingfrom
fix/ivm-abort-abandoned-fetches

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • The pool brokers sandbox fetch() on the app side. When it gave up on an execution (host timeout, caller abort, worker loss), the outbound request kept running. The only limit was the script-settable idle timeout, which a slow-drip server keeps resetting. The owner's execution slot was already free, so per-owner limits didn't cover these requests
  • Replace the cancelled flag on each pending execution with an abort controller that fires on every give-up path. Pass it into secureFetchWithValidation, which already honors signal through DNS validation and the pinned request
  • Cap each fetch at the execution's own host time budget (timeoutMs + 1s grace), via AbortSignal.any([abort, AbortSignal.timeout(...)]). The pool gives up on the execution no later than that, so the cap never fires while the execution is alive. It only bounds a fetch the script left running after returning, whose response nothing can read
  • Deliberately not aborted on a normal result: a fire-and-forget request (e.g. a webhook POST) is still sent. Only the wait for its unread response is bounded
  • A per-fetch composite signal keeps abort listeners off the shared per-execution signal, so fan-out (Promise.all of many fetches) can't trip MaxListenersExceededWarning or pile up stale redirect-hop listeners on it

Type of Change

  • Bug fix (security / resource)

Testing

  • test-isolated-vm-remote-e2e.ts: 4 new checks against a server that never answers:
    • timed-out execution: the fetch, started late in the run, is dropped within 400ms of the timeout
    • cancelled execution
    • worker killed mid-fetch
    • script returns with a POST still in flight: the request reaches the server and is dropped after the time budget
  • 25/25 pass. Removing each guard on its own turns exactly its own check red: timeout abort, cancel abort, worker-loss abort, time cap. All four new checks fail on staging
  • AbortSignal.any + AbortSignal.timeout behave identically under Node 22 and Bun
  • isolated-vm.test.ts + isolated-vm-worker-hardening.test.ts 28/28; biome, check:test-patterns, check:comment-hygiene, check:utils, check:boundaries, check:source-conventions; full gate left to 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)

🤖 Generated with Claude Code

@vercel

vercel Bot commented Nov 7, 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 7, 2026 10:29pm UTC

Request Review

@greptile-apps

greptile-apps Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no blocking issues were found.

Summary

Bounds sandbox fetches when an execution times out, is cancelled, or loses its worker. Requests left running after a normal return get a time limit instead of being stopped immediately.

  • Sandbox fetches stop when their execution ends or their time budget runs out.

Reviews (4) · Last reviewed commit: "test(sandbox): pin that a fire-and-forge..." · 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 2 files

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

Turn on auto-fix | Re-trigger cubic

Comment thread apps/sim/lib/execution/isolated-vm.ts Resolved
@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 7, 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.

All reported issues were addressed across 2 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 7, 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 2 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 e999cf5 into staging Nov 7, 2026
79 checks passed
@waleedlatif1
waleedlatif1 deleted the fix/ivm-abort-abandoned-fetches branch November 7, 2026 22:33

This branch was previously deployed

1 inactive deployment
Preview — 88442a21 Deployed Nov 7, 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