Skip to content

[EPIC-U][LOU-U17] Sandboxed HTTP honors cancellation - #72

Merged
LinuxDevil merged 1 commit into
mainfrom
lou-u17-sandbox-fetch-abort
Oct 1, 2026
Merged

LinuxDevil merged 1 commit into
mainfrom
lou-u17-sandbox-fetch-abort

Conversation

@LinuxDevil

Copy link
Copy Markdown
Owner

What

  • sandboxHttpFetch takes an optional signal (SandboxFetchOptions.signal). An already-aborted signal rejects with an AbortError without calling sandbox.run(). An abort mid-flight rejects promptly with an AbortError. The signal is also forwarded to sandbox.run().
  • SandboxRunOptions gains an optional signal. NoopSandbox passes it to execFile, so the sandboxed child process is killed on abort.
  • http.ts: the sandbox transport now forwards init.signal. The caller's signal was already linked into that controller, but the transport dropped it.
  • slack.ts: execute and sandboxExecute now pass the tool's abortSignal to postSlackAlert and postSlackAlertViaSandbox, which hand it to fetch and sandboxHttpFetch.

Why

After LOU-V1, an aborted run left the sandboxed HTTP request (a node -e subprocess run through SandboxAdapter.run) running, because sandboxHttpFetch ignored cancellation. There is no in-process undici request on the sandbox path. The signal is therefore raced against run() so it rejects promptly with any adapter, and it is also passed down via SandboxRunOptions.signal so adapters that support it can kill the process.

Acceptance criteria

  • sandboxHttpFetch accepts an optional signal and rejects with an AbortError, including when the signal is already aborted
  • http.ts and slack.ts sandbox paths pass abortSignal through; the non-sandbox paths do too (http already did, slack now does)
  • Tests: (a) an already-aborted signal rejects without running anything, (b) a mid-flight abort rejects promptly, (c) the signal reaches the run() options. No real network.
  • Small diff; src/execution/* untouched

How verified

  • npx tsc --noEmit: clean
  • npm run lint: 0 errors, no new warnings from this change (the 3 warnings from my test file were fixed; the rest are pre-existing)
  • npm run test:types: no errors
  • npx vitest run: 133 files passed, 1960 passed | 3 skipped (after npm run build; the importGraph tests need dist)
  • npm run build && npm run build --workspace=packages/create-loushy-agent: success
  • npm run test:coverage: 1960 passed | 3 skipped
  • npm run fallow: exit 0, no issues
  • Docs not touched, so snippet and llms checks were not needed.

Not done: SubprocessSandbox (Docker) ignores signal. Abort still rejects promptly at the sandboxHttpFetch level, but the container keeps running until it finishes or times out. This can be a follow-up.

🤖 Generated with Claude Code

https://claude.ai/code/session_016bY29ibQgv3MDdjAbUT4YR


Generated by Claude Code

sandboxHttpFetch now accepts an optional AbortSignal: an already-aborted
signal rejects with an AbortError without running anything, an abort
mid-flight rejects promptly, and the signal is forwarded to
SandboxRunOptions.signal (NoopSandbox passes it to execFile so the child
is killed). http.ts's sandbox transport and slack.ts's execute and
sandboxExecute paths now pass the tool's abortSignal through.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016bY29ibQgv3MDdjAbUT4YR
@LinuxDevil
LinuxDevil merged commit c544456 into main Oct 1, 2026
1 check passed
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.

2 participants