Cloudflare sandbox adapter drops the caller AbortSignal
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 88/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- typescript
Research direction
Start in packages/runtime/src/cloudflare/cf-sandbox.ts at cfSandboxToSandbox.exec and review the CloudflareSandboxStub.exec options. Verify how SessionEnv.exec supplies its AbortSignal, then forward it through the adapter. Done means aborting a running command cancels the container work instead of leaving the sandbox command slot occupied.
Written by the indexing model from the issue text.
Description
@flue/runtime 2.0.8, Cloudflare target.
Summary
cfSandboxToSandbox.exec does not forward the caller's AbortSignal to @cloudflare/sandbox. SessionEnv.exec rejects promptly when the signal aborts, as documented in the 2.0.0 changelog, but the command continues to run in the container.
Observed behaviour
When a caller aborts a running command, Flue's exec abort race releases the tool immediately. The underlying command is not cancelled. With a sandbox that permits one command at a time, reads and commands from the next turn wait until the abandoned command ends.
Cause
In packages/runtime/src/cloudflare/cf-sandbox.ts, the adapter passes only cwd, env, and timeout to sandbox.exec:
const result = await guarded(
'exec',
sandbox.exec(command, {
cwd: execOpts?.cwd,
env: execOpts?.env,
timeout: execOpts?.timeoutMs,
}),
);
@cloudflare/sandbox accepts signal in its exec options, but CloudflareSandboxStub.exec does not declare it and the adapter does not forward it.
Proposed change
export interface CloudflareSandboxStub {
exec(command: string, options?: {
cwd?: string;
env?: Record<string, string>;
timeout?: number;
+ signal?: AbortSignal;
}): Promise<...>;
}
sandbox.exec(command, {
cwd: execOpts?.cwd,
env: execOpts?.env,
timeout: execOpts?.timeoutMs,
+ signal: execOpts?.signal,
})
Impact
An aborted command stops in the container instead of occupying its command slot after the caller has moved on. This lets the next turn use the sandbox without waiting for orphaned work to finish.
- Dominant language
- TypeScript
- Stars
- 8.3k
- Forks
- 496
- Avg merge
- 4h 7m
- Merged PRs (30d)
- 19
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from withastro/flue
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
Difficulty 4/5 3-5 days Newbie friendliness 58/100
-
Difficulty 4/5 3-5 days Newbie friendliness 68/100
Similar issues
-
calcite-components needs triage refactor
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Esri/calcite-design-system#15203 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 91/100
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficulty 1/5 Under an hour Newbie friendliness 95/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Automattic/studio#4908 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 90/100