Skip to content

fix(control-ui): prevent extra connections on cached reloads - #185886

Merged
steipete merged 7 commits into
mainfrom
steipete/coldload-warm-connect-regression
Oct 27, 2026
Merged

steipete merged 7 commits into
mainfrom
steipete/coldload-warm-connect-regression

Conversation

@steipete

@steipete steipete commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes the extra connection on warm chat/dashboard reloads introduced by #185558. Cached content can mount while device identity is being prepared. Session-link decoration then issues sessions.resolve before connect; the Gateway rejects it with INVALID_REQUEST, closes the socket with 1008, and the browser reconnects.

The introducing-commit bisect found no failures in 11 parent reloads and 10 failures in 11 introducing-commit reloads. The native regression reproduces the first-frame violation on both routes without changing the early cached-content rendering.

Why This Change Was Made

The shared Gateway protocol client now enforces the handshake boundary. Ordinary requests enter the existing pending-request map immediately, retaining their original deadline and abort handling, but stay unsent until hello is accepted and published. The internal connect request alone bypasses that hold. The map drains in FIFO order, including reentrant requests from hello/onSent callbacks, and checks current socket authority before each send. Close/stop rejects held requests without replaying writes on a replacement socket.

This replaces consumer-specific readiness policy with one transport owner. Browser and Node adapters share the invariant; cached session titles remain available while live resolution waits for hello. No protocol field, schema, configuration option, or second queue is added.

User Impact

The cached page still renders before the connection is ready, while the first socket completes its handshake normally. The unchanged offline regressions retain cached transcript, board, and reconnect-indicator coverage when the socket is unavailable.

Evidence

Native regression

Both chat and dashboard cases render an unresolved cached session link while native identity work is held, then release the handshake and perform another natural warm reload. Each candidate reload must have one socket, exactly one connect, zero closes, and connect as its first request. Main fails with sessions.resolve first and a native 1008 close. There is no client close call in the failing trace. The controlled hold prevents main's first connect from reaching the wire before the close, isolating the same violation behind natural two-connect reloads.

The new protocol regression also fails against the baseline and passes with the fix. Its distinct boundaries cover opening/signing, hello publication, FIFO/reentrancy, original timeout, cancellation, close/stop, asynchronous Node acceptance, and retirement during queue draining.

Size and simplification

Application runtime delta: +28 LOC. Requested non-test diff: +34 LOC, including six README lines. The existing pending map owns the hold and its cleanup; the initial consumer guard is removed. Runtime growth is required to enforce the first-frame contract while preserving cancellation, deadlines, and live socket authority.

Tests/support add 587 net lines. The existing test-line ceiling increases by exactly 587, preserving main's allowance without additional slack. Fixtures that previously injected private transport state or treated hello receipt as publication now complete the real protocol lifecycle. Four shell transport cases and the existing Talk catalog cases move into focused files without duplication; main's newer history fixture is retained intact.

Review and proof

Independent local review is clean through P2 for the complete transport/fixture cutover and subsequent narrow repairs. Broad UI unit/browser proof passed 1,899 files and 20,973 tests, with three existing skips, on the same production fix before the final metadata/rebase changes. The final head is separately covered below by focused/native tests, full UI e2e, and exact-head CI.

Final candidate: 9087178ddeb5e41f82c0f435f4dee3e92c91f2c8; pinned main: 7a95ec8a4d64d8f34bc3c025aabb89d95878b1b1. AWS c7a.4xlarge, lease cbx_64f25b0ec7d9, run run_80adc9c8d1b3654601864789d33fbe37. Chromium 156.0.8078.4; 3,000 retained sessions; nine tall assistant rows including table/image; Details open on chat; signed-in admission; 80 ms CDP network shaping; eleven interleaved AB/BA warm pairs per route. Quiet-host sample: 93.06% CPU idle across 16 CPUs. CDP shaping is not calibrated per-RPC wire RTT.

Route Main reconnect failures Candidate
Chat 0/11; one connect per load 0/11; one connect per load
Dashboard 9/11; two connects and native 1008 close in each failure 0/11; one connect per load

Candidate: 22/22 one-connect warm loads, zero 1008 closes, connect first on every socket.

Chat timings

Median [Q1, Q3]; deltas are candidate minus main. Lower is better.

Metric Main Candidate Paired delta Better / worse pairs
Hello handled (ms) 508.13 [482.61, 516.77] 502.12 [492.88, 509.25] -4.77 [-28.45, 21.86] 6 / 5
Last visual change (ms) 1211.42 [1149.36, 1266.12] 1281.57 [1235.31, 1313.08] 57.42 [12.58, 142.96] 2 / 9
FCP (ms) 70.42 [68.87, 72.11] 70.68 [68.62, 72.29] -0.12 [-0.43, 1.02] 6 / 5
Rows DOM/rAF proxy (ms) 491.57 [479.62, 513.47] 491.55 [483.56, 505.51] -0.00 [-25.93, 21.97] 6 / 5
Final rows DOM (ms) 987.42 [973.68, 1023.15] 1011.08 [1001.51, 1025.81] 13.28 [-4.82, 46.92] 3 / 8
LoAF blocking (ms) 168.80 [153.85, 186.25] 183.10 [171.80, 192.60] -0.60 [-12.40, 35.20] 6 / 5
CLS 0.01033 [0.01033, 0.01033] 0.01109 [0.01030, 0.01128] 0.00000 [-0.00012, 0.00095] 5 / 5
Whole-page visible states 14.00 [13.00, 14.50] 15.00 [15.00, 15.00] 2.00 [0.00, 2.00] 1 / 7
Pair Hello Δ ms Last visual Δ ms FCP Δ ms Rows proxy Δ ms Final rows Δ ms LoAF Δ ms CLS Δ
1 -26.40 123.65 -0.33 -0.00 50.90 -12.80 -0.00002
2 -49.35 -114.74 -0.44 -51.85 -37.15 -34.50 -0.00085
3 20.03 82.16 -0.12 -4.17 43.23 38.30 0.00000
4 -4.77 55.93 -2.83 20.03 -10.57 -0.60 -0.00021
5 34.50 172.35 3.12 51.90 50.60 43.80 0.00095
6 -31.17 12.43 0.31 -23.97 7.23 -12.00 0.00095
7 29.48 12.73 1.74 3.98 13.28 32.10 -0.00021
8 -24.30 162.28 3.03 -36.00 16.00 -19.90 -0.00002
9 22.82 57.42 0.26 43.92 0.92 7.00 0.00164
10 -30.50 -22.27 -0.41 -27.90 -10.60 -1.90 0.00076
11 20.90 169.30 -3.87 23.90 80.30 43.50 0.00095

Dashboard timings

Median [Q1, Q3]; deltas are candidate minus main. Lower is better.

Metric Main Candidate Paired delta Better / worse pairs
Hello handled (ms) 1629.33 [1597.56, 1684.43] 657.49 [641.57, 692.81] -957.34 [-986.36, -923.79] 11 / 0
Last visual change (ms) 2115.06 [2079.59, 2163.74] 1216.11 [1189.20, 1252.90] -903.03 [-926.84, -782.35] 10 / 1
FCP (ms) 61.83 [55.48, 64.95] 61.07 [54.94, 63.38] -3.81 [-10.14, 7.07] 6 / 5
Rows DOM/rAF proxy (ms) 391.51 [387.47, 411.50] 391.39 [381.56, 425.45] -11.91 [-25.91, 30.04] 6 / 5
Final rows DOM (ms) 1884.04 [1849.89, 1936.89] 843.59 [810.67, 863.22] -1044.36 [-1080.31, -831.84] 11 / 0
LoAF blocking (ms) 193.10 [164.05, 220.55] 192.00 [186.20, 207.60] -3.60 [-25.05, 40.70] 6 / 5
CLS 0.04797 [0.04797, 0.04797] 0.00333 [0.00333, 0.00333] -0.04465 [-0.04465, -0.04324] 10 / 1
Whole-page visible states 22.00 [21.50, 22.00] 22.00 [22.00, 23.00] 1.00 [0.00, 1.00] 2 / 6
Pair Hello Δ ms Last visual Δ ms FCP Δ ms Rows proxy Δ ms Final rows Δ ms LoAF Δ ms CLS Δ
1 -23.07 7.15 12.18 -23.97 -52.67 -21.20 0.00002
2 -957.34 -918.55 12.85 -27.84 -1032.44 -27.20 -0.04465
3 -924.85 -862.23 -17.49 3.75 -1003.25 55.70 -0.04465
4 -957.72 -895.80 8.57 -36.02 -1063.22 -3.60 -0.04465
5 -1001.17 -933.29 4.63 20.03 -1091.97 68.00 -0.04465
6 -116.42 -305.69 5.58 -255.92 -475.82 -175.20 -0.00280
7 -938.46 -903.03 -3.81 40.04 -1044.36 25.70 -0.04465
8 -1063.97 -964.35 -8.34 -11.97 -1139.07 -22.90 -0.04465
9 -971.56 -920.40 -4.89 59.84 -1068.66 5.60 -0.04465
10 -1093.21 -987.21 -16.38 -11.91 -1170.61 -79.10 -0.04465
11 -922.73 -702.48 -11.94 251.97 -660.43 234.30 -0.04183

The row metric is the rig's DOM/rAF proxy, not audited compositor paint. Last visual change uses the compositor-frame visible-change census. Representative chat and dashboard side-by-side sheets were inspected; they contain only the synthetic fixture. These counts include all page regions and are not a claim that the separate two-state paint-holding goal is complete.

Open secondary: chat last visual change is +57.42 ms by paired median, worse in 9/11, meeting the declared regression threshold. Every final change is in the sidebar. Main-pane region timing has mixed signs; hello/first rows are essentially unchanged. The fresh A/B repeat and same-code A/A control below show a similarly directed arm difference with identical code; causal attribution to the transport remains inconclusive. No chat settle improvement is claimed. Dashboard hello is 657.49 ms on this newer base; this comparison does not establish the historical 494 ms absolute target.

Validation and inherited failures

Final-head proof Result Wall time
Gateway-client focused package, one worker 282 tests pass 13.64 s
Focused UI owners, one worker 199 tests pass 10.48 s
TUI / Gateway startup-deadline owners, one worker 22 tests pass 66.40 s
Native widget/warm-connect + offline dashboard files, one worker 6 cases pass 228.27 s
Baseline queue regression Fails at the premature physical-send assertion 3.57 s
Full UI e2e Completed exit 1; six inherited files and one obsolete fixture wait, fixed upstream in #185839 4531.49 s
Chat A/A, same candidate in both arms 11 pairs complete; identical UI hashes; tables below 579.58 s

Exact-head CI run is complete. Every leaf check passes except test-line baseline ratchets; the aggregate CI gate consequently fails. The job's merge target is main bc197791931b3e98dd09a19c68ae3077478c5e2a. Its only changes since the pinned main are two production files; ratchet code, ceiling, and all counted test/support inputs are identical.

Matched controls use the same checker and common reference c168d2b0b7fb11f4cd463191a4f508c6775fbc9b with --no-merge-base, so both arms include their actual growth rather than receiving the zero-delta exemption:

Source Actual test/support lines Ceiling Excess
Main 6,286,060 6,285,000 1,060
Candidate / CI merge 6,286,647 6,285,587 1,060

The PR reserves its own 587 lines and leaves the inherited 1,060-line debt visible. No CI rerun or unrelated budget increase is used to chase green.

Main also reproduces the changed-check dead-export failure: runPrompt / scheduleLine in extensions/knowledge/src/scribes-catalog.ts, and SessionColdOversized in src/config/sessions/session-accessor.sqlite-archive-types.ts. The final changed-file run is still in progress; the earlier run passed types, lint, formatting, and all other listed guards, with only those same unused exports failing.

Merge status: merged externally as a6c11850723c4c47fa30eba37d7a58dff9ef8ec4 at 16:31:42 UTC while this final-head proof run was active. The validation and open secondary above remain explicit.

Synthetic before/after

Main is on the left and candidate on the right. Chat shows the open late-facts secondary; dashboard shows the reconnecting baseline versus the connected candidate.

Synthetic chat warm reload main left candidate right

Synthetic dashboard warm reload main reconnecting left candidate connected right

Fresh chat repeat and A/A control

Both use the same retained AWS c7a.4xlarge (cbx_a731d41e659f), 11 interleaved warm pairs, the same signed-in synthetic Team-scale fixture and 80 ms CDP shaping. Fresh A/B compares the same pinned source heads as above. A/A serves the candidate UI in both arms; the UI index hashes are identical. No Mac timings are included.

The original chat last-visual result (+57.42 ms paired, 9/11 worse) remains visible above. Fresh A/B gives +41.79 ms paired, 7/11 worse with overlapping IQRs. A/A gives +32.60 ms paired, 9/11 worse; the arm medians themselves rise 55.91 ms despite identical code. Thus this sidebar-settle metric is arm-sensitive and the original result does not establish a causal transport regression. It remains inconclusive; this report does not claim a chat settle improvement. Hello remains essentially unchanged. All warm chat loads in both experiments send exactly one connect with zero 1008 closes. Representative filmstrips were inspected; late Details, image, and sidebar facts remain outside this fix.

Fresh A/B chat

Metric Arm A median [Q1, Q3] Arm B median [Q1, Q3] Paired delta median [Q1, Q3] Better / worse
Hello handled (ms) 505.33 [475.17, 510.74] 504.45 [501.90, 513.58] -3.22 [-8.81, 36.34] 6 / 5
Last visual change (ms) 1192.03 [1166.62, 1305.34] 1305.20 [1195.73, 1384.25] 41.79 [-41.50, 147.16] 4 / 7
FCP (ms) 70.32 [67.91, 70.87] 69.87 [69.31, 72.01] -0.23 [-1.29, 3.61] 6 / 5
Rows DOM/rAF proxy (ms) 479.43 [467.59, 493.61] 499.65 [491.52, 519.45] 23.92 [-3.90, 43.90] 3 / 8
Final rows DOM (ms) 995.03 [978.05, 1031.99] 1033.21 [1016.72, 1043.65] 24.12 [5.97, 56.74] 3 / 8
LoAF blocking (ms) 166.70 [151.85, 181.25] 188.60 [181.10, 193.40] 25.00 [-10.05, 40.20] 4 / 7
CLS 0.01033 [0.01033, 0.01042] 0.01030 [0.01021, 0.01128] -0.00002 [-0.00021, 0.00086] 6 / 5
Whole-page visible states 14.00 [13.00, 15.00] 15.00 [14.00, 16.00] 1.00 [-0.50, 2.00] 3 / 8
Pair Hello Δ ms Last visual Δ ms FCP Δ ms Rows proxy Δ ms Final rows Δ ms LoAF Δ ms CLS Δ
1 -8.98 -77.55 -0.23 -7.98 24.12 -8.00 0.00076
2 -8.64 -104.67 3.24 28.16 -14.04 -12.10 -0.00097
3 43.53 173.60 5.86 63.83 -3.17 37.80 -0.00002
4 -5.01 41.79 -1.20 16.19 63.09 25.00 0.00076
5 61.62 248.51 3.98 51.92 75.02 82.30 0.00095
6 -296.18 -323.92 -3.58 43.92 -186.88 -26.00 -0.00665
7 34.97 176.79 2.14 43.87 52.67 42.60 0.00095
8 -3.22 -5.45 -1.10 0.18 37.78 25.30 -0.00021
9 37.72 71.60 4.22 23.92 60.82 58.10 -0.00021
10 -20.93 120.72 -1.42 -8.03 21.97 -16.60 -0.00002
11 2.21 10.75 -1.39 -16.09 15.11 6.80 0.00162

Candidate/candidate A/A chat

Metric Arm A median [Q1, Q3] Arm B median [Q1, Q3] Paired delta median [Q1, Q3] Better / worse
Hello handled (ms) 510.24 [496.40, 513.65] 500.48 [497.36, 508.93] -1.43 [-14.92, 15.17] 6 / 5
Last visual change (ms) 1262.54 [1214.50, 1312.50] 1318.45 [1265.60, 1339.56] 32.60 [3.91, 60.97] 2 / 9
FCP (ms) 71.38 [70.06, 72.61] 70.71 [69.61, 71.86] -0.65 [-1.64, 0.74] 6 / 5
Rows DOM/rAF proxy (ms) 483.62 [475.57, 493.63] 487.59 [475.54, 495.52] 3.83 [-4.02, 12.03] 3 / 8
Final rows DOM (ms) 1018.06 [1002.92, 1034.60] 1012.28 [999.61, 1033.07] -7.29 [-25.32, 7.32] 7 / 4
LoAF blocking (ms) 185.30 [168.25, 190.45] 181.70 [176.60, 186.85] -2.60 [-13.75, 18.90] 6 / 5
CLS 0.01109 [0.01030, 0.01152] 0.01109 [0.01030, 0.01128] 0.00000 [-0.00051, 0.00009] 4 / 3
Whole-page visible states 15.00 [14.00, 16.00] 16.00 [15.00, 16.00] 1.00 [0.00, 2.00] 2 / 7
Pair Hello Δ ms Last visual Δ ms FCP Δ ms Rows proxy Δ ms Final rows Δ ms LoAF Δ ms CLS Δ
1 16.91 40.71 0.53 16.11 -7.29 11.50 0.00000
2 -14.00 -85.82 -10.50 -40.10 -52.20 -39.10 -0.00083
3 8.52 0.77 -1.89 -8.08 -6.98 11.10 0.00000
4 -35.95 70.43 0.49 -39.95 -48.35 -32.80 0.00067
5 -14.87 51.51 -1.07 0.03 -34.87 -17.20 0.00097
6 -34.14 7.04 -2.23 7.96 54.46 -2.60 -0.00146
7 22.77 11.85 -1.39 0.07 2.67 27.60 0.00000
8 -14.96 -74.30 -0.65 7.94 -9.76 -10.30 -0.00019
9 27.46 70.94 0.96 23.86 11.96 26.30 0.00000
10 -1.43 32.60 1.83 24.07 24.17 -7.40 -0.00146
11 13.43 201.40 2.85 3.83 -15.77 26.90 0.00019

Full-UI failure controls

Each of the seven retained failed files was run once on pre-fix main and once on transport head, one worker at a time on cbx_a731d41e659f. Pending handoff (consumed-prompt assertion), outbox migration (roster readiness), startup priority (hidden refresh count), header subagents (Details wait), all three module-boundary placement-recovery variants (roster readiness), and the QA automation second case (private-mutation-boundary setup error) reproduce on main. The QA main control additionally rejects its capture directory outside the detached checkout in its first case; that additional setup error is not a product verdict.

The cached-anchor file passes on main (24.01 s) and fails on the transport head (31.92 s) at its obsolete wait for an unsubscribe before releasing connect. All cached display and geometry assertions passed before the wait. The test-only correction landed upstream in #185839 (5949887220258626159b602e1f6ada8962bac885), preserving held hello and every display/reconciliation assertion. #186131 and #186132 strengthen the no-prehello-subscription assertions. No duplicate PR is needed.

The original full-UI invocation completed with exit 1 after 4,531.49 s. Its final summary was lost when the non-retained lease released; the retained partial log identifies the seven files above. The original full-suite invocation remains failed proof with no invented final pass counts. The fixture correction has passing exact-head upstream CI, documented below. Queue regression wall time with pnpm test packages/gateway-client/src/protocol-client.handshake-queue.test.ts --maxWorkers=1: 3.32 s, passing.

Upstream fixture repair and closeout

Current main already incorporates the needed cached-anchor fixture correction from #185839, with added first-frame assertions from #186131/#186132. The two transport runtime owners and native warm-connect/offline regression files are byte-identical between tested transport head 9087178ddeb5e41f82c0f435f4dee3e92c91f2c8 and inspected main 161c376d51b886186e1a6527775350d4a07f86ab.

Upstream #185839 exact-head CI is independently verified: head eb316f339372f20d5c05b09078a489d62b4fdc60, run 40554442758, completed successfully. Its retained PR evidence also records the corrected anchor case passing once (4.223-second case / 18.374-second total). This does not relabel the original transport head's inherited ratchet failure or claim a passing full-UI-suite replay.

No further source change or duplicate follow-up PR was made. This session did not merge the transport PR or deploy a Gateway.

@clawsweeper

clawsweeper Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-27T16:14:10.283210Z 9087178 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 27, 2026
@clawsweeper

clawsweeper Bot commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR defers unresolved session-link lookups until the Gateway connects and refreshes retained links when hello arrives.

Example: Reload cached chat containing /chat/main/d0effac9 while device identity preparation is pending.

  • Before: sessions.resolve can precede connect, causing an INVALID_REQUEST response, socket closure with code 1008, and a reconnect.
  • After: The link remains navigable while disconnected, then resolves after hello without interrupting connection startup.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The implementation is focused and source-consistent; available candidate validation is limited to reported unit success, and exact-head CI is unresolved.
Proof confidence 🦐 gold shrimp (3/6) The ordinary contributor proof gate is exempt for this maintainer-authored PR; inspected evidence establishes the baseline failure and focused candidate unit success, while the candidate real-Gateway result remains pending.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Reloading cached chat or a dashboard can interrupt Gateway startup and add reconnect backoff.
Reason: This maintainer-authored repair restores the existing handshake contract while retaining the approved cached-rendering behavior.

Merge readiness

✅ Ready for maintainer review

Keep this PR open: it fixes a source-backed reconnect defect through existing owners, and no actionable patch defect was found.

Priority: P2
Reviewed head: cbd37332701bb97f0a749b5b1bb4160eb35cca15

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: The supplied record does not yet show the candidate passing both native warm-route scenarios with connect first, one socket, and no closes.
Agent review details

How this fits together

The Control UI session-link titler consumes registered Markdown links, session roster data, and Gateway connection state; it resolves missing identities through Gateway RPC and decorates links with titles.

flowchart LR
  CachedMarkdown --> RegisteredLinks
  RegisteredLinks --> SessionLinkTitler
  GatewaySnapshot --> CapabilityCheck
  CapabilityCheck --> SessionLinkTitler
  GatewayHello --> ExistingSubscription
  ExistingSubscription --> SessionLinkTitler
  SessionLinkTitler --> GatewayRPC
  GatewayRPC --> TitledLinks
Loading

Technical review

Best possible solution:

Keep admission in the existing titler and hello notification in the existing provider subscription, preserving immediate cached rendering.

Do we have a high-confidence way to reproduce the issue?

Current-main source permits sessions.resolve before hello, matching the supplied real-Gateway INVALID_REQUEST and 1008 traces; this read-only review did not execute the reproduction.

Is this the best way to solve the issue?

The patch addresses request admission at its existing owner and retries deferred decoration through an existing subscription, without delaying cached content or adding competing machinery.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 5bf0c41a03f1.

Provenance checked

  • Session URL resolution keeps the original intent (4f9637d: Resolve accessible session URLs outside the loaded sidebar while preserving ordinary navigation for missing or ambiguous references.)
  • Provider lifetime and Gateway projection keeps the original intent (refactor(ui): register session title targets explicitly #176973: Retain producer-owned title targets across bridge reconnects and retire asynchronous work with connection scope.)
  • Existing Gateway subscription keeps the original intent (870549c: Refresh held hovercard avatar authentication input after reconnect through the existing projection.)

Testing

Proof path: unit tests only.

Security

None.

Evidence

What I checked:

  • Introduced fix: The pinned introduced diff adds existing connected, advertised-method, and scope admission before creating a reference-cache entry, and refreshes titles from the existing Gateway subscription when connected hello changes. (ui/src/components/session-link-titling.ts:315, cbd37332701b)
  • Current-main defect: Fetched main retains the non-null-client-only resolution path; its affected production files have no difference from the PR base. (ui/src/components/session-link-titling.ts:318, 5bf0c41a03f1)
  • Protocol failure boundary: The Gateway rejects a first request other than connect; the browser capability helper requires connected phase, method advertisement, and granted scopes. (src/gateway/server/ws-connection/message-handler.ts:291, cbd37332701b)
  • Supplied behavior evidence: The complete live PR body records failing real-Gateway traces for chat and dashboard and passing focused candidate unit tests; candidate native results remain explicitly in progress, with no subsequent result in the discussion. (cbd37332701b)
  • CI attribution remains incomplete: Exact-head lint annotations name files outside this diff. The core test-types job failed without a useful diagnostic in annotations; its log redirects to a host blocked by the network allowlist. Neither failure is established as caused by this PR. (cbd37332701b)
  • Feature history and original intent: History attributes external-roster URL resolution to fix(ui): session links outside the sidebar show raw URLs instead of titles #172558, explicitly crediting Patrick-Erichsen; later title registration, projection, permission, and reconnect work establishes steipete as the current routing owner. (ui/src/components/session-link-titling.ts:330, 4f9637d3e581)

Likely related people:

  • Peter Steinberger: Raw commit cf80144 adds ui/src/components/session-progress-hovercard.runtime.tsx:495 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: cf801441810c; files: ui/src/components/session-progress-hovercard.runtime.tsx)

PR surface

Source +17, Tests +309. Total +326 across 5 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 2 21 4 +17
Tests 3 309 0 +309
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 5 330 4 +326

Review metrics

Metric Value Why it matters
Production versus test growth Production +21/-4; tests and test support +309/-0 Production growth implements admission and hello invalidation in existing owners; test growth covers deferred cache behavior, retained-link lifecycle, and native socket ordering on both routes.

Labels

Label changes:

  • add P2: Warm reloads can incur an avoidable rejected handshake and reconnect delay, but the reported connection subsequently recovers.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P2: Warm reloads can incur an avoidable rejected handshake and reconnect delay, but the reported connection subsequently recovers.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Finish the existing native chat and dashboard regression runs and inspect their socket traces.
  • Classify the failed exact-head core checks using accessible diagnostics or matching base-failure evidence.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed October 27, 2026, 8:45 AM ET / 12:45 UTC.

@steipete
steipete force-pushed the steipete/coldload-warm-connect-regression branch from cbd3733 to 8532a9a Compare October 27, 2026 13:30
@steipete steipete changed the title fix(control-ui): keep cached session links from interrupting reconnect fix(control-ui): prevent extra connections on cached reloads Oct 27, 2026
@steipete
steipete force-pushed the steipete/coldload-warm-connect-regression branch 2 times, most recently from 8fb8143 to eecd3c8 Compare October 27, 2026 14:35
@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: XL and removed size: L labels Oct 27, 2026
@steipete
steipete force-pushed the steipete/coldload-warm-connect-regression branch 3 times, most recently from a6f388c to 5626e9c Compare October 27, 2026 15:36
@steipete
steipete force-pushed the steipete/coldload-warm-connect-regression branch from 5626e9c to 9087178 Compare October 27, 2026 16:11
@steipete
steipete merged commit a6c1185 into main Oct 27, 2026
118 of 120 checks passed
@steipete
steipete deleted the steipete/coldload-warm-connect-regression branch October 27, 2026 16:31
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 28, 2026
…he first frame (openclaw#185886)

openclaw#185558 rendered cached chats before the Gateway connects; cached session-link title decoration (SessionLinkTitler.resolveReference) then sent sessions.resolve before connect. The Gateway rejected it (INVALID_REQUEST) and closed the socket with 1008 "invalid handshake: first request must be connect", so warm reloads reconnected: on the real-Gateway proof rig, 10/11 dashboard warm reloads sent two connect frames and hello moved 494 -> 1,615 ms (bisected to 7dc64a0; parent 0/11).

The gateway client now owns the invariant that connect is the first frame on every socket: requests issued before hello admission are held with their abort signals/timeouts and released in order after hello for the current socket generation; connect itself bypasses the hold; requests on a socket that already closed still fail with the typed not-connected outcome. Cached session links no longer interrupt a reconnect. Package README documents the contract.

Regressions: handshake-queue unit tests (held requests are not sent before connect and resolve after hello; reentrant hello requests stay behind earlier held work) and a real-Gateway warm-connect e2e asserting exactly one connect and no 1008 close per warm reload. Test fixtures that issued requests before hello now complete the handshake first. All test suites green on the exact head; the test-lines ratchet is over its ceiling on main already (+473) and this PR adds +587 lines of regression coverage — the ceiling is being set to the exact observed total separately (openclaw#185853).

Release-note context: Control UI reloads no longer drop and reopen their first Gateway connection when cached session links are present.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui gateway Gateway runtime P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: XL status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant