Preserve HTTP errors from streaming bundle downloads - #4138
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Warning
- Copilot's review of this pull request may be incomplete because some of the changed files are excluded by your Copilot content exclusion settings. See Excluding content from Copilot for details.
Copilot review overview
🟢 Approval recommended
The behavioral change is well-scoped and validated with targeted tests; only a minor error-message consistency nit was identified.
Review tier: Lite
Findings: 1
New issues introduced by this change (1)
| Severity | Finding |
|---|---|
src/tools-download.ts — response.statusCode is treated as potentially undefined (you already fall back to 0 for the… |
What changed in this PR
This PR improves error handling for streaming CodeQL bundle downloads by preserving HTTP status codes (notably 404) so callers can distinguish “missing bundle” from transient download failures, while ensuring the extraction directory is cleaned up on failures.
Changes:
- Throw a typed
HTTPErrorfrom streaming downloads when the HTTP status is not 200, and rethrow 404s without falling back to buffered download. - Always clean the destination extraction directory when the streaming path fails, before retrying/falling back/rethrowing.
- Add tests covering rethrow-on-404 behavior and fallback-on-5xx behavior, and tighten assertions around cleanup.
| File | Description |
|---|---|
| src/tools-download.ts | Preserves HTTP status via HTTPError, cleans extraction dir on streaming failure, and bypasses fallback for 404s. |
| src/tools-download.test.ts | Adds coverage for 404 rethrow (no retry) and 500 fallback, plus cleanup assertions. |
| lib/entry-points.js | Generated JS output (excluded by policy; not reviewed). |
Files excluded by content exclusion policy (1)
- lib/entry-points.js
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Warning
- Copilot's review of this pull request may be incomplete because some of the changed files are excluded by your Copilot content exclusion settings. See Excluding content from Copilot for details.
Copilot review overview
🟢 Approval recommended
The implementation matches the stated behavior and includes focused regression coverage.
Review tier: Balanced
Findings: None
Resolved findings (1)
Files excluded by content exclusion policy (1)
- lib/entry-points.js
mbg
left a comment
There was a problem hiding this comment.
Looks OK, but with a design question about defaulting to 0 for the status code -- see the detailed comments.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>


Preserve HTTP status codes when streaming CodeQL bundle downloads fail, so callers can distinguish a missing bundle from other download failures. Rethrow 404s without retrying the same URL through buffered downloading.
Clean up the extraction directory before retrying or rethrowing. Other streaming failures continue to fall back to downloading the bundle before extracting it.