Skip to content

Fix HTTPS response reads for evidence and SAT - #151

Merged
wallscaler merged 1 commit into
mainfrom
codex/https-content-length-socket-20260828
Aug 28, 2026
Merged

wallscaler merged 1 commit into
mainfrom
codex/https-content-length-socket-20260828

Conversation

@wallscaler

@wallscaler wallscaler commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Outcome

Restore the live pre-registration validator proof path when a miner returns a bounded HTTPS response with Content-Length and closes the connection.

After merge, both /v1/evidence and /v1/sat-work must complete without dereferencing a cleared HTTPSConnection.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.client transfers the socket to HTTPResponse and clears HTTPSConnection.sock before body consumption finishes. The loop then tried to refresh the timeout through the cleared connection attribute.

Change

  • Retain the connected TLS peer socket after the handshake.
  • Fail closed if the handshake yields no peer socket.
  • Refresh the shared remaining deadline through the retained socket before the request and every potentially blocking body read.
  • Stop the read loop when HTTPResponse reports closure.
  • Add a deterministic real TLS and http.client regression using HTTP/1.1, exact Content-Length, and Connection: close.
  • Exercise the identical transport behavior for both evidence and SAT routes.

Outcome targets

  • /v1/evidence returns its complete bounded body under Content-Length plus connection close.
  • /v1/sat-work returns its complete bounded body under the same behavior.
  • No NoneType.settimeout dereference remains in this path.
  • The one-total-deadline and 128 KiB body-bound behavior remain intact.
  • The request carries no Authorization header.
  • No wallet, signer, chain-write, trust-policy, or CyberGym behavior changes.
  • Rebuild the proof runner from the merged SHA and repeat the external QVL and SAT proof against the live bounded miner. This is the post-merge live gate, not claimed by this PR.

Verification

  • Regression on exact base da2607018ec1d9a48518440c9e6063f4c31add2e: 2 failures, one per route, both at the cleared-socket dereference.
  • Patched regression: 2 passed.
  • tests/thin/test_independent_runtime.py: 50 passed.
  • Full tests/thin: 1,793 passed, 4 skipped, 20 failed.
  • Exact-base comparison of every failing file: the same 20 failures reproduced unchanged. They are existing macOS portability and environment failures involving BSD date/sed, absent /usr/bin/python3.12, and Darwin errno naming.
  • Full Ruff check: passed.
  • Full Ruff format check: passed.
  • git diff --check: passed.
  • Local Claude Fable final review: APPROVE, no blocking findings.

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-Length and Connection: close. In that case http.client can clear HTTPSConnection.sock while the response body is still being read; the transport previously refreshed timeouts via connection.sock, which triggered AttributeError: 'NoneType' object has no attribute 'settimeout' and broke both /v1/evidence and /v1/sat-work.

HttpsEvidenceTransport._post_peer now 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 when HTTPResponse.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.server regression (exact Content-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.

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.
@cursor

cursor Bot commented Aug 28, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot 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)

@wallscaler
wallscaler merged commit 75eedf8 into main Aug 28, 2026
7 checks passed
@cursor
cursor Bot requested a review from ai-hpc August 28, 2026 14:55
@wallscaler

Copy link
Copy Markdown
Contributor Author

PM after #151 merge (75eedf8 on main).

Live cathedral.computer catalog unchanged (validator HTTPS collect, not a site/PolarIS deploy). PolarIS prod still source_sha=8e1dc3d / migration_head 080 — do not roll alembic 081. Homepage still “Nothing Sealed leaves without a receipt.” Fast Persistent Hetzner $0.15 available, no receipt; one-shot Fast off; GPU unavailable. No SN70.

CI: Python 3.11, 3.12, Publisher, Integration green. Honesty N/A (no customer copy). This unblocks Content-Length + Connection: close on /v1/evidence and /v1/sat-work. It is not live QVL/SAT, registration, axon, or weights.

Next: rebuild the independent proof runner from 75eedf8 and repeat external QVL + canonical SAT against the live bounded miner. No --confirm-canary, no --confirm-uid30-launch, no serve_axon, no emissions.

PolarIS #1163 stays draft: anonymous GHCR pull of ghcr.io/cathedralai/cathedral-sn39-audit-miner@sha256:afdc51a931dec1433981166033cffcebecb8fc3d432b65a6500063bd6a06b032 still 401. Leave CATHEDRAL_SN39_MINER_IMAGE empty until the package is public. CyberGym #146/#147 stay held. #155 bearer still operator-mint / enroll 522.

Did not ping Astro.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant