Fix HTTPS response reads for evidence and SAT - #151
Conversation
http.client clears HTTPSConnection.sock for connection-close responses before the caller finishes consuming the body. Preserve the connected TLS socket for deadline refreshes and stop once HTTPResponse closes, so both evidence and SAT collection complete without weakening the shared timeout or body cap. Cover both routes with a real TLS HTTP/1.1 Content-Length plus Connection: close regression.
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_b178d85c-1716-4965-bb12-81aefed62b1a) |
|
PM after #151 merge ( Live cathedral.computer catalog unchanged (validator HTTPS collect, not a site/PolarIS deploy). PolarIS prod still CI: Python 3.11, 3.12, Publisher, Integration green. Honesty N/A (no customer copy). This unblocks Content-Length + Connection: close on Next: rebuild the independent proof runner from PolarIS #1163 stays draft: anonymous GHCR pull of Did not ping Astro. |
Outcome
Restore the live pre-registration validator proof path when a miner returns a bounded HTTPS response with
Content-Lengthand closes the connection.After merge, both
/v1/evidenceand/v1/sat-workmust complete without dereferencing a clearedHTTPSConnection.sock, while retaining the existing total deadline, SPKI observation, credential-free request, and 128 KiB response cap.Production failure
The live SN39 proof reached the miner over HTTPS, then failed in the response loop with:
AttributeError: 'NoneType' object has no attribute 'settimeout'For a connection-close response, Python's
http.clienttransfers the socket toHTTPResponseand clearsHTTPSConnection.sockbefore body consumption finishes. The loop then tried to refresh the timeout through the cleared connection attribute.Change
HTTPResponsereports closure.http.clientregression using HTTP/1.1, exactContent-Length, andConnection: close.Outcome targets
/v1/evidencereturns its complete bounded body underContent-Lengthplus connection close./v1/sat-workreturns its complete bounded body under the same behavior.NoneType.settimeoutdereference remains in this path.Authorizationheader.Verification
da2607018ec1d9a48518440c9e6063f4c31add2e: 2 failures, one per route, both at the cleared-socket dereference.tests/thin/test_independent_runtime.py: 50 passed.tests/thin: 1,793 passed, 4 skipped, 20 failed.date/sed, absent/usr/bin/python3.12, and Darwin errno naming.git diff --check: passed.Review boundary
This PR proves the source and deterministic transport regression. It does not claim merge, deployment, live QVL success, registration, axon announcement, weight submission, or rewards.
Note
Medium Risk
Touches the live miner HTTPS collect path used for pre-registration proofing; behavior is narrowly scoped but failures here block validator evidence and SAT rounds.
Overview
Fixes live validator HTTPS collection when miners return a short JSON body with
Content-LengthandConnection: close. In that casehttp.clientcan clearHTTPSConnection.sockwhile the response body is still being read; the transport previously refreshed timeouts viaconnection.sock, which triggeredAttributeError: 'NoneType' object has no attribute 'settimeout'and broke both/v1/evidenceand/v1/sat-work.HttpsEvidenceTransport._post_peernow keeps the TLS peer socket after the handshake, errors if it is missing, applies the shared remaining deadline on that socket for the POST and each read, and stops reading whenHTTPResponse.isclosed()instead of looping on a cleared connection socket. SPKI capture, the single request deadline, the 128 KiB cap, and credential-free POSTs are unchanged.Adds a real TLS
http.serverregression (exactContent-Length,Connection: close) parameterized for both evidence and SAT paths.Reviewed by Cursor Bugbot for commit 213a5e8. Bugbot is set up for automated code reviews on this repo. Configure here.