fix(sandbox): drain discarded GitHub response bodies in runtime detection - #7113
Closed
pedrofrxncx wants to merge 1 commit into
Closed
pedrofrxncx wants to merge 1 commit into
pedrofrxncx wants to merge 1 commit into
Conversation
This was referenced Sep 9, 2026
Collaborator
Author
|
Closing as stale: this PR sat past the bot's 48h merge window, main has moved on, and its CI results no longer reflect the current base. This is a housekeeping close, not a rejection of the change — if the underlying problem still exists, the bot will find it again and open a fresh, rebased PR. [studio-bot:stale-close] |
This was referenced Sep 15, 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 free
to 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.
Follows #7109/#7087/#7104, which fixed the same undrained-body class in the GitHub provider client,
GITHUB_LIST_USER_ORGS, and the file-storage tarball fetch.github-runtime-detect.ts'sfetchGithubFilehad the identical gap.probeRuntime(called fromSANDBOX_START's runtime detection) fires up to 8 parallel GitHub Contents API requests per repo — one per candidate lockfile path (deno.json,bun.lock,pnpm-lock.yaml,package.json, etc.) plus the port-source files. Only one of those paths actually exists in a given repo, so on every other one GitHub answers 404 andfetchGithubFilereturnednullimmediately without drainingres.body. BecauseprobeRuntimeruns the fetches withPromise.all, this leaves several unread response bodies per sandbox start, holding the underlying connections open longer than necessary under Bun's fetch implementation — the same connection-hygiene issue the sibling PRs fixed.Fix: drain the body (
await res.body?.cancel().catch(() => {})) before returningnullon the!res.okpath, matching the pattern already used everywhere else inapps/api/src/git-providers/github/.Behavior is unchanged — same early return, same fallback to clone-only on any non-2xx response — this only ensures the body is released.
Verify:
cd apps/api && bunx tsc --noEmit(clean) andbunx oxlint apps/api/src/shared/github-runtime-detect.ts(0 warnings/errors). No test added — this is a pure resource-drain fix with no behavior change, same as #7109/#7087/#7104 which also shipped without new tests; full CI validates the rest.Summary by cubic
Drains discarded GitHub response bodies during sandbox runtime detection so unread 404 bodies don't hold connections open.
fetchGithubFilenow cancels the body before returningnullon non-OK responses, matching the pattern used elsewhere in the GitHub provider. Behavior is unchanged: failed probes still fall back to clone-only.Written for commit 3e2928b. Summary will update on new commits.