diag(byoc): surface real signer error behind opaque IncompleteRead(85, 108)#38
diag(byoc): surface real signer error behind opaque IncompleteRead(85, 108)#38seanhanca wants to merge 1 commit into
Conversation
…pleteRead
When the remote signer (/generate-live-payment) advertises a Content-Length
but closes the connection early, urllib raises http.client.IncompleteRead and
discards the partial body. That body carries the real signer error
(e.g. {"error":{"message":"..."}}), so the failure surfaces as an opaque
"IncompleteRead(85 bytes read, 108 more expected)" with no diagnostic value.
Capture the partial bytes in _create_byoc_payment and re-raise them inside the
existing LivepeerGatewayError so the underlying signer failure is legible. Also
guard the HTTPError path against a truncated error body.
Diagnostic only: does not change control flow (still funnels into existing
except handling at the call site) and does not fix payment generation.
Co-authored-by: Cursor <cursoragent@cursor.com>
|
Warning Review limit reached
Next review available in: 17 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
What & why
Diagnostic-only change. During a billed E2E run, BYOC payment fails inside
_create_byoc_payment(src/livepeer_gateway/byoc.py) when reading the signer response from/generate-live-payment.The signer advertises a
Content-Length(~193 bytes) but closes the connection after delivering only ~85 bytes. urllib then raises:Because urllib discards the partial body on
IncompleteRead, we lose the real signer error payload ({"error":{"message":"..."}}) and are left blind — the failure surfaces as an opaqueIncompleteRead(85, 108)with zero diagnostic value.Change
import http.client._create_byoc_payment, catchhttp.client.IncompleteReadon the response read and re-raise the partial bytes inside the existingLivepeerGatewayError, so the underlying signer error becomes legible.HTTPErrorpath against a truncated error body too (keep whatever bytes arrived rather than losing the message entirely).This is low-risk: control flow is unchanged (it still funnels into the same
except/LivepeerGatewayErrorhandling at the call site) — only the error message improves.What this does NOT do
This does not fix payment generation or unblock generation. The root cause is the signer/DMZ truncating its response (likely a wallet/ticket panic mid-write). That fix belongs to @j0sh's DMZ wallet/image work. This PR only makes the failure legible so the real signer error can be read from logs.
Context
.../generate-live-payment(behind the DMZ).Test plan
python -m py_compile src/livepeer_gateway/byoc.pypytest tests/→ 9 passed.tests/test_byoc_payment_truncation.py(2 tests) — asserts a truncated 200 and a truncated error-status body both surface the partial signer body in the raisedLivepeerGatewayError. Full suite → 11 passed.IncompleteRead(85, 108).Base branch note
_create_byoc_paymentwith the/generate-live-paymentlogic lives onmain(and is mirrored across several feature branches). Based onmainsince that is where this code path currently resides; no dedicated WIP branch owns it.cc @j0sh for review (repo CODEOWNER).
Made with Cursor