Uh oh!
There was an error while loading. Please reload this page.
fix(cli): clamp edge-runtime nofile ulimit to the host hard limit - #6284
Merged
Conversation
The Edge Runtime container was always created with --ulimit nofile=65536:65536 (raised for many concurrent Deno isolates, #5151). Sandboxed hosts cap the hard nofile limit lower (e.g. 20,000 in Claude Code) and their docker daemon shares that cap, so requesting more failed the container start outright (CLI-2220). On Linux, clamp the requested value to the process's own hard limit (process.report userLimits) — downward only, so a constrained client gets a smaller fd budget instead of a failed start. Elsewhere the daemon runs in a VM with its own limits, so the full 65536 raise is kept. One helper in @supabase/stack serves both docker call sites (stack service defs and legacy functions serve/start). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
Supabase CLI previewnpx --yes https://pkg.pr.new/supabase/cli/supabase@0bda9c4f5a12f9a0266a422006244db895b3c4d3Preview package for commit |
edgeRuntimeNofileUlimit now returns { arg, limit, clampWarning? } instead
of the bare --ulimit string, with the warning present exactly when the
host's hard cap forced the request below the 65536 raise. The host hard
limit is injectable (defaulting to the real process.report probe) so the
clamp decision and message are deterministically unit-testable.
startEdgeRuntimeContainer emits the warning through Output.warn, covering
both `functions serve` and legacy `start`. The stack ServiceDef builder is
pure with no output channel, so that call site just consumes .arg.
Verified end-to-end in a 20000-hard-cap sandbox: the bring-up warns
"Edge Runtime file descriptor limit lowered to 20000: ..." and the
container starts with nofile=20000:20000.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0196hzWc16Jr2cYoYopWkPboThere was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit:05827e1c4a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Uh oh!
There was an error while loading. Please reload this page.
Only the legacy functions serve/start path has an Output channel at bring-up time; the @supabase/stack ServiceDef builder is pure and, in managed mode, runs inside the daemon process with no user terminal, so it applies the clamp silently until a BuildResult diagnostics channel exists. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
avallete
enabled auto-merge
August 20, 2026 17:08
jgoux
approved these changes
Aug 20, 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 freeto 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.
Summary
The Edge Runtime container was always created with
--ulimit nofile=65536:65536— a raise inherited from the Go CLI so many concurrent Deno isolates can run (#5151). Sandboxed hosts cap the hard nofile limit lower (e.g. 20,000 in the Claude Code sandbox), their docker daemon shares that cap, and requesting more than the daemon can grant fails the container start outright.This adds
edgeRuntimeNofileUlimit(platformOs)in@supabase/stackand uses it at both docker call sites (stack service defs for the next shell, andshared/functions/serve.tsfor legacyfunctions serve/start):process.report.getReport().userLimits.open_files(the standard runtime API, implemented by both Bun and Node — verified under Bun in a Linux container with a constrained--ulimit).Output.warninstartEdgeRuntimeContainer, covering bothfunctions serveand legacystart; the stackServiceDefbuilder is pure with no output channel and stays silent.The Go-parity divergence is documented in
apps/cli/docs/go-cli-divergences.md.Reviewer notes: the helper stays a plain sync leaf (no failure modes/retries/resources) per the repo's Effect-native carve-out — both call sites are sync
ServiceDefbuilders — and takesplatformOsas input to match how the stack threadsplatform.osinstead of readingprocess.platformambiently. It now returns{ arg, limit, clampWarning? }with the host hard limit injectable (defaulting to the realprocess.reportprobe), so the clamp decision and warning text carry deterministic unit coverage alongside the pure seams (hardNofileLimitFromReport,clampNofileLimit), including the 20,000-cap case.Linked issue
Closes CLI-2220 (Linear)
open-for-contributionlabel (or I'm a Supabase maintainer).Checklist
fix(cli): …).pnpm check:allandpnpm testpass for the workspace(s) I touched.🤖 Generated with Claude Code