fix(mint): avoid crashes on HTTP/2 request resets#846
Conversation
PR SummaryMedium Risk Overview Adds end-to-end regression coverage using a real TLS Cowboy HTTP/2 server that triggers internal errors and mid-stream resets, asserting both Mint’s emitted responses and Tesla’s adapter behavior; also extends push promise coverage to validate pushed-stream responses from a live HTTP/2 server. Reviewed by Cursor Bugbot for commit b3e5d67. Bugbot is set up for automated code reviews on this repo. Configure here. |
There was a problem hiding this comment.
Pull request overview
This PR addresses Tesla’s Mint adapter crash reported in issue #553 by ensuring Mint HTTP/2 stream reset errors (e.g. {:server_closed_request, :internal_error}) are surfaced to callers instead of causing a FunctionClauseError.
Changes:
- Introduces
Tesla.Adapter.Mint.ResponseAccumulatorto reduce Mint responses while halting on request-scoped{:error, ref, error}tuples. - Updates the adapter receive path to use the new accumulator and return the Mint error tuple.
- Adds regression tests, including a live Cowboy HTTP/2 reproduction that triggers an
INTERNAL_ERRORstream reset.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
lib/tesla/adapter/mint.ex |
Adds a response accumulator and integrates it into the Mint adapter receive loop to avoid crashes on request reset errors. |
test/tesla/adapter/mint_test.exs |
Adds unit coverage for the accumulator plus an end-to-end HTTP/2 stream reset reproduction/regression test. |
test/support/mint_internal_error_handlers.ex |
Adds Cowboy request/stream handlers used to reproduce the HTTP/2 reset scenario in tests. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
e7ce8f8 to
0e82fa0
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 0e82fa0. Configure here.
db202ba to
8079462
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
4efc3e7 to
854fe01
Compare
Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
854fe01 to
b3e5d67
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

FunctionClauseErrorinside the adapter