Skip to content

Session protection proofs own their HTTP channel - #876

Merged
zlareb1 merged 6 commits into
mainfrom
fix/coordination-channel
Nov 18, 2026
Merged

zlareb1 merged 6 commits into
mainfrom
fix/coordination-channel

Conversation

@zlareb1

@zlareb1 zlareb1 commented Nov 18, 2026 •

Copy link
Copy Markdown
Member

Related: #871

Changelog category

  • Bug Fix (user-visible misbehavior in a release)

Changelog entry

Session-protection proofs use a private HTTP channel so pooled requests do not distribute one named session across different connections.

Why

A named HTTP session belongs to one backend. Pinning the shared driver and its generation still allows consecutive proof statements to use different connections. A checked statement can then refuse with SESSION_NOT_FOUND even though the original session remains on another backend.

Each proof owns a client with a one-connection pool, created from the original endpoint, database and principal configuration. This keeps consecutive statements on one reusable transport when the connection remains open. Backend attestation and checked-session validation still reject discontinuity; a replacement session is never accepted.

Scope and risk

The existing four-unit streaming-connection budget bounds private channels. Waiting for this lifetime capacity consumes the caller's remaining five-second proof deadline. The configured per-statement pool-admission cutoff (500 ms by default) does not govern that lifetime wait. Each statement retains ordinary pool admission and its class deadline, including the advisory schema refresh. Ordinary traffic continues on the shared driver. An unsuccessful or cancelled proof force-closes its owned channel; normal completion closes it before releasing capacity.

The query retry budget is zero for the private channel. The driver's internal network retry behavior remains, so backend and checked-session validation remain necessary. The existing proof deadline, authentication rules, backend identity, nonce checks and refusal behavior are unchanged.

The branch also contains the merged ordering-test fixture repair linked above. Its source matches main; product batching and the callers' assertions are unchanged.

Compatibility, rollout and rollback

  • Wire: no operations, fields or defaults change.
  • Operator steps: none.
  • Rollback: revert the change; no stored data, migrations or generated files change.

Tests

  • The three query, command and raw-query regressions fail with SESSION_NOT_FOUND before the fix and pass after it.
  • pytest -q tests/unit/test_ch_coordination_session.py tests/unit/test_ch_coordination_transport.py: all 31 directly related cases passed. These cover session validation, admission, cancellation, cleanup, shared traffic and ordinary connect settings.
  • A manual-clock regression first reproduced transport admission refusing a fifth proof after 600 ms while four channels were occupied. After the queue correction, it waits without opening a fifth channel, then proceeds when one is released. Controls preserve the original five-second proof timeout and the 500 ms statement-pool admission timeout.
  • The initial candidate's unit suites passed, but two integration jobs exposed refusal of the existing 30-concurrent-request run-begin case. That CI failure remains a failure; the corrected head passes the unchanged concurrency case in native and auth-on isolation CI.
  • mypy server/core/ch.py passed before the queue-only correction; scoped Ruff checks, format checks and git diff --check passed afterward.
  • The linked fixture repair passed its four directly related ordering and clock cases and its full PR CI.
  • All 46 current-head checks and all four workflows passed, including all unit shards, coverage and benchmark gates, native and Postgres integration jobs, isolation gates and both Quickstart builds. The hosted artifacts confirm all 64 coordination and mirror-latch cases passed with no skips.

AI assistance in the code

  • AI-generated: Codex wrote most of the diff. Checked session validation, resource accounting, cancellation, unchanged proof controls and the causal regression results.

  • I can explain every line of this diff and how it interacts with the rest of Loom.

Checklist

  • Full formatting, lint, type, unit and integration gates pass in PR CI.
  • No generated files, schema, wire operations or plugin copies change.
  • No migration or plugin version change is required.
  • No frontend files change.
  • No operator steps or documentation changes are required.
  • Repository text contains no deployment details.
  • Commits are signed off.

Lifetime transport allocation uses the caller deadline. Statement admission retains its existing wait and all four transport units remain bounded.

Signed-off-by: zlareb1 <[email protected]>
@zlareb1
zlareb1 merged commit 1376c03 into main Nov 18, 2026
46 checks passed
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