Skip to content

ui-server: join announced session binding before relay admission snapshots #3725

Closed

Description

@schlessera

Out of scope

Do not relax safety, scope, authority, recording or destination fences; add provider retries; alter policy or conversation prefixes; or change chat indicator/review behavior. This is an availability defect, not a finding that unsafe dispatch succeeds.

Context

Part of #3596. Found while qualifying #3605 / #3662.

onSessionInfo (packages/ui-server/src/ws/bridge-capabilities/emission.ts:125) changes the turn session synchronously, submits catalog creation and governance binding, and retains their pending settlement. Permissions join this pending binding (packages/ui-server/src/ws/bridge-capabilities/permissions.ts:192). createEffectiveSafety (packages/ui-server/src/governance/effective-safety.ts:14) correctly changes its scope when the canonical binding commits. prepareTurnEgress (packages/ui-server/src/brain/turn-egress.ts:248) joins only this proxy's prior egress records before inference/provider admission. The proxy's initial and final reads (packages/ui-sdk/src/server/egress-proxy.ts:204 and :221) correctly refuse a scope change.

A controlled real FULL SQLite writer and real Unix-socket inference relay reproduce a healthy refusal at source head 8a21eb3ac035c1a0a738003ac5ed911ed6fe16c5 (base 18a0ba34049a72d36ae81eb7c3a9dce034aa1f6a; these production boundaries are byte-identical to main). Hold the writer, emit this turn's first session identity, submit its catalog/binding, and release the writer between admission reads. All sampled recording/authority values remain true, complete coverage has zero unresolved inputs, but scope changes from provisional to bound. The relay returns 403 Inference network admission refused, durable egress says denied / safety_changed, and the loopback provider gets zero requests. Both controlled interleavings fail the expected-200 assertion; the already-committed control passes with one request. No production sources or guard results are mocked or changed. A bounded read wrapper coordinates the actual writer, returning each original snapshot unchanged.

This matches the symptom of #3662 selected native job 128429399767, but that failed run did not capture its snapshots/reason and cannot establish retrospective root-cause identity. The later healthy diagnostic native run is comparison evidence only.

Scope

Make announced same-turn session identity settlement part of host egress preparation before taking a new admission snapshot. Audit both inference and provider-relay siblings through the shared path. Reuse concrete host binding ownership; do not create a general extension interface.

Acceptance criteria

  • An announced same-turn binding queued on the real writer is joined before a new inference/provider admission snapshot. Its healthy commit alone does not cause a false 403; the real loopback origin receives exactly one request, with no automatic retry.
  • Settlement is bounded and cancellation/retirement/failure refuses without dispatch. A failed or indeterminate binding cannot borrow a later turn's identity.
  • Independent pending input, shared recorder loss, principal/authority changes and relevant trust changes remain restrictive during settlement; no other turn's work is silently exempted.
  • Initial and final synchronous safety fences remain intact. A genuinely changed scope or authority after the admitted snapshot still refuses before irreversible dispatch. Ordinary policy remains turn-bound and provider history remains append-only.
  • Both real-writer interleavings fail for the intended behavior before correction and pass afterward, alongside healthy and adverse controls. The selected supported-host native cells and both actual provider-history guards pass for the delivered candidate; draft feedback is not proof.

Verification

Use a FULL writer transaction held by a shared-memory gate, actual host session emission/catalog/governance binding, the original effective-safety reader and the real Unix relay plus loopback origin. Capture original snapshots, durable bounded egress reasons and request counts. Cover both host relay variants and bounded/cancelled/failed settlement. Restore a mutation that omits the settlement and retain the named assertion failure. Run contribution preflight and complete selected candidate proof without weakening tests or rerunning the unexplained native failure to obtain green.

Contract impact

Internal host ordering correction only; no new client, HTTP, MCP or provider-visible shape. Keep all existing external contracts. Add the consumer-visible fix changeset.

Observed 2026-11-08. The original failed native run remains unqualified; the controlled reproduction identifies a concrete defect without claiming retrospective certainty.

Proof sequencing update 2026-11-11: #3726 is refreshed at 397a602cd5d7ffdee0aeff4d8ae58e903c167c18 over 4a8c43f383ffd9806e5bedd1e4e00d2400f03149, composing current live-provider selection, conversation-host/hello lifecycle and Start-card changes. All eight contribution inputs remain byte-identical to prior a0bec4038. Fresh exact-head proof passes 459 tests / 2582 assertions / 22 files, including current provider-selection and WS lifecycle cases, plus strict typecheck at repository CI's 6144 MiB setting. Exact-head preflight passes all five gates with 997 tests / 6578 assertions / 42 files. All five original criteria and refusal assertions remain unchanged; restored mutations retain their original execution identities. Under the hybrid ruling on #2934 (comment 6763098096), complete fast candidate proof precedes merge and all selected own-main/native/both-provider-history proof precedes successful delivery. #3662 has been reopened and refreshed at e21f23b62 on this same base; it remains draft pending this fix, with #3605's seven criteria unchanged. Refs keeps this issue open through required qualification.

Qualification correction 2026-11-10: fast confirmation at 3b23172381e11c23847d4a1f388f66f3b5f927ae failed in both Pi (unit 3) and Claude (unit 2) provider-history beforeAll, before prefix assertions; the proof aggregate correctly refused the failed selected suite. The shared test host omitted live principal authority and correctly met production default denial. A scoped fixture correction creates a real owner principal, binds coordinator/client identity to it, and resolves the durable row for each host authority check. Four runtime relay probes reproduce the original 403, pass after correction, and fail their revocation assertions under a cached-principal mutation; restored controls pass. The original session-binding implementation and all five criteria remain unchanged. Fresh exact-candidate confirmation and actual supported-host native/both-provider-history qualification remain required. This issue stays open under Refs through required main proof.

Delivery checkpoint — 2026-11-11

Merged as 40dbae0a2f332eb20c52c2a967611894ca30d289, with exact parent 4a8c43f383ffd9806e5bedd1e4e00d2400f03149 and tree 4d4b56c3da6ddac03c1a4b264b2b9e963a5d618a. The squash is on main and its tree matches the confirmed candidate.

Ready-candidate run 42991638294, attempt 1, passed changeset, verify, pack, all four unit shards and proof. Every successful selected job's actual checkout is 52e3f26729c64f6519fbc2ea3bebc08fd0a63b1a, whose immutable parents/tree match this head/base. The separate contract job checked out head 397a602cd5d7ffdee0aeff4d8ae58e903c167c18 and passed. Both actual installed-backend provider-history suites and their Apify suites pass all 35 declared tests; no test name from those suites is skipped or failed. Their source titles and actual pass lines were matched individually because concurrent CI log groups interleave.

The squash's original main run 42995520839 failed in the mounted tracker announcement test. Its other selected categories passed, but that run remains failed and does not establish complete delivery. The failure is tracked by #3973.

Recovery fix #3980 has merged as 0f6296a791061c5343230e303117f8278093340b, directly after this squash. Its ready-candidate run 43008356069, attempt 1, passed all eight selected jobs and all 35 actual provider-history cases; actual job checkouts and immutable candidate/squash trees were verified. The six heavy categories intentionally excluded from that candidate are not claimed as executions.

The automatic recovery main run 43012208838, attempt 1, passed all 17 selected jobs at 0f6296a791061c5343230e303117f8278093340b. Every actual job checkout matches that squash, whose parent is this issue's delivered 40dbae0a2f332eb20c52c2a967611894ca30d289. Fresh main proof passed all four unit shards, verification/packaging, runtime/runtime_host, all browser/layout shards, captures, endurance and the integrated aggregate. All 35 actual installed-backend provider-history cases and all 13 mounted tracker browser cases passed, with individual source-title/pass-line matching and no matching failure or skip.

Native artifact evidence independently confirms four healthy Claude/Pi and UID 0/1000 hosted-app executions, each exiting zero with owned cleanup complete. The separate retained-index namespace control failed as intended and its verification passed; it is not counted as a healthy cell. The shared main-status record now reports red: false with no open incident. The earlier failed run remains failed.

All five acceptance criteria and required delivery verification are complete. The issue can close with milestone 0.45.0 retained. #3977 can now request ordinary confirmation; #3662 remains a separate draft and will refresh after that safety-client fix has qualified delivery.

Qualification completion 2026-11-11: verified the original candidate, actual squash, distinct recovery-main checkouts, native controls and both provider-history guards. No failed run or retained execution was relabeled as fresh proof.

Activity

  1. added this to the 0.45.0 milestone on Nov 8, 2026
  2. added
    type: fix
    area: ui-sdk
    area: ui-server
    priority: p2
    agent-ready
    on Nov 8, 2026
  3. self-assigned this
    on Nov 8, 2026
  4. schlessera commented on Nov 8, 2026

    @schlessera
    OwnerAuthor

    Claiming #3725 for the reproduced same-turn binding ordering defect. Claim token: safety-3725-binding-parent-20261108. Intended branch: fix/3725-relay-session-binding-20261108. I will preserve final synchronous fences, use real-writer/loopback adverse controls and qualify both relay siblings. Collision scan: closure: #3056, #3059, #3069, #3116, #3336, #3393, #3437, #3458, #3464, #3581, #3622, #3662, #3673, #3676, #3717, #3719, #3721, #3722, #3724. #3662 stays draft pending this correction and complete selected/native proof.

  5. schlessera commented on Nov 9, 2026

    @schlessera
    OwnerAuthor

    Field evidence from a hosted 0.44.0 install (2026-11-09). The trigger may differ from the one reproduced above.

    In one Claude session, three model requests were refused with egress_connection outcome: denied, inference: true, reason: safety_changed across two consecutive turns, with zero bytes sent. Each refusal came within about 1 s of a burst of parallel WebFetch calls. Every fetch recorded a taint occurrence (web_fetch), plus an egress_connection taint for the fetched host, whose exposure finalised as interrupted_unknown. This was mid-session, not at the first session identity. The session had been bound for several minutes and had already been tainted earlier in the same turn.

    So the refusal also fires when new taint occurrences land while an inference admission is in flight, not only when the session binding commits. If that is a different path from the one reproduced here, it may need its own issue. The data that would show it: prepareTurnEgress reading the effective safety before and after a parallel tool's taint occurrence commits.

  6. added
    priority: p1
    and removed
    priority: p2
    on Nov 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

agent-readyarea: ui-sdkarea: ui-serverpriority: p1type: fix

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions