Repository navigation
fix(ui): keep Gateway presentation through reconnects - #174044
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: af6f69be47
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| (!view().nativeEmbed && view().pageActionsBlocked) || | ||
| (view().mobileNavLayout && view().navDrawerOpen) | ||
| } | ||
| inert={view().mobileNavLayout && view().navDrawerOpen} |
There was a problem hiding this comment.
Keep channel setup gated while disconnected
When an authenticated admin's connection enters reconnecting or offline, the retained hello.auth keeps canAdmin true in channels-page.tsx, so the newly interactive page leaves Run Setup enabled. createChannelSetup then passes snapshot.client to the wizard without checking the live phase, and wizard.start immediately rejects with gateway not connected; therefore a brief disconnect now exposes a server-only workflow that can only fail. Gate this action on the live Gateway state before removing the shell fence.
AGENTS.md reference: ui/AGENTS.md:L15-L19
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 6a8c9c9: Setup actions now require a live Gateway connection while channel details remain browsable offline, with regression coverage for disconnect and recovery.
| const desktopPanelAvailable = canPresentGatewayMethod( | ||
| gatewaySnapshot, | ||
| "desktop.observe", | ||
| "operator.admin", | ||
| ); |
There was a problem hiding this comment.
Do not advertise an unusable offline Desktop command
With a retained handshake advertising desktop.observe, this presentation-only check keeps Desktop in the command palette during reconnect/offline. However, ShellPanelOwner.handleDeferredDesktopToggle still calls connected-only isDesktopPanelAvailable, prevents the event, and the palette closes, so selecting the visible command silently does nothing. Either keep this executable command live-only or render it disabled with an explicit reconnect outcome.
AGENTS.md reference: AGENTS.md:L79-L83
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 6a8c9c9: The Desktop command now uses the same live availability check as the panel opener so it cannot be selected while offline.
|
Codex review: needs changes before merge. What this changesThis PR retains Gateway presentation metadata during disconnects and replaces page-wide interaction blocking with individual action guards. Example: An administrator loses the Gateway connection for two seconds while viewing Automations.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Needs changes before merge - 6 items remain Keep open for focused repair: this maintainer-directed change is useful, but it introduces offline interaction regressions and leaves affected tests failing. Priority: P2 Before merge
Findings
Tests
Agent review detailsHow this fits togetherThe Control UI Gateway store publishes connection state and handshake metadata to navigation, panels, and pages; action owners use the live client to send Gateway requests. flowchart LR
A[Gateway transport] --> B[Gateway store]
B --> C[Retained presentation metadata]
C --> D[Navigation and page views]
B --> E[Live connection checks]
D --> F[Action owners]
E --> F
F --> G[Gateway RPC authorization]
Technical reviewBest possible solution: Retain presentation centrally while action owners enforce live connectivity and same-identity reconnects preserve editable drafts. Do we have a high-confidence way to reproduce the issue? Current-main source directly shows handshake clearing and page-wide disconnect fencing; the reported live before-state is consistent with those paths, but no reproduction was executed during this read-only review. Is this the best way to solve the issue? Separating presentation facts from live dispatch is appropriate, but removing the shared fence requires completing the affected action guards and preserving newly editable state across reconnect. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 330ce7f06f38. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceAcceptance criteria:
What I checked:
Likely related people:
PR surfaceSource -58, Tests +214, Docs +13. Total +169 across 28 files. Added test files: 1. View PR surface stats
LabelsLabel changes:
Label justifications:
Rating scale6/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. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed October 16, 2026, 5:09 AM ET / 09:09 UTC. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a67b4c05d3
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| eventSource, | ||
| fieldErrors, | ||
| canSubmit: !hasCronFormErrors(fieldErrors), | ||
| canSubmit: page.cron().connected && !hasCronFormErrors(fieldErrors), |
There was a problem hiding this comment.
Gate every Cron mutation on connectivity
When an administrator disconnects after loading Cron, the retained handshake keeps canManageCron() true, but this change gates only form submission. Run now, pause/resume, and the job menu therefore remain enabled; their callbacks reach runCronAdminTask, after which withCronBusy returns immediately because state.connected is false, so the click has no visible outcome. Include the live connection in the mutation availability passed to all Cron controls, not only canSubmit.
AGENTS.md reference: AGENTS.md:L81-L81
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Not changing: Cron clears its jobs and selected editor on disconnect, so the reported row actions are absent and offline create submission is already disabled.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 85cc7ad618
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| aria-disabled={ | ||
| view().pageActionsBlocked || view().reloadRequired ? "true" : undefined | ||
| } | ||
| inert={view().reloadRequired} |
There was a problem hiding this comment.
Disable Sessions refresh while disconnected
When an operator is viewing Sessions during reconnecting or offline, removing the shell fence leaves the Refresh button enabled (ui/src/pages/sessions/view.tsx:195), but its handler reaches refreshSessionList(), where captureRequestScope() returns null and the action silently returns (sessions-page-state.ts:531-534). Gate this server-backed control on live connectivity so it does not advertise an action that produces no outcome.
AGENTS.md reference: AGENTS.md:L79-L81
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 6a8c9c9: Sessions Refresh is disabled during reconnect and offline and becomes available again when connected.
Keep channel details browsable while disabling setup until reconnect. Align Desktop command visibility with its live panel opener, and disable Sessions refresh while disconnected. Cover retained handshakes and restored actions through page and shell regressions.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6a8c9c9b50
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| (!view().nativeEmbed && view().pageActionsBlocked) || | ||
| (view().mobileNavLayout && view().navDrawerOpen) | ||
| } | ||
| inert={view().mobileNavLayout && view().navDrawerOpen} |
There was a problem hiding this comment.
Gate channel-detail server actions on connectivity
When an admin has a channel detail open and the Gateway enters reconnecting or offline, removing this shell fence leaves several server-backed controls enabled: view.config.tsx gates Save/Reload only on loading and dirty state, while view.whatsapp.tsx gates login/logout/probe actions only on busy state. Their owners then return without dispatching because the channel/config capabilities are disconnected, so clicks produce no visible outcome; gate these channel-detail controls on the live connection while preserving local form edits.
AGENTS.md reference: AGENTS.md:L79-L81
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 33acceb58c
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| <RouterOutlet | ||
| inert={view().pageActionsBlocked || view().reloadRequired} | ||
| aria-disabled={ | ||
| view().pageActionsBlocked || view().reloadRequired ? "true" : undefined | ||
| } | ||
| inert={view().reloadRequired} | ||
| aria-disabled={view().reloadRequired ? "true" : undefined} |
There was a problem hiding this comment.
Disable Agents file refresh while disconnected
When an authenticated operator loses the Gateway connection while the Agents Files panel is open, removing the outlet fence leaves its Refresh action enabled: panels-files.tsx:149-153 disables it only while loading, but loadAgentFiles() immediately returns when state.connected is false (agents-page-state.ts:588-593). The click therefore has no visible outcome; pass connectivity into this control and disable it offline while keeping the existing file draft readable and editable.
AGENTS.md reference: AGENTS.md:L79-L81
Useful? React with 👍 / 👎.
Keep pending search autofocus when catalog arrival mounts the input after the opening frame, without stealing newer user focus. Add coverage for open, closed, removed, and focus-moved pickers. Join catalog-dependent browser assertions to admitted requests and rendered or enabled controls. Drain a distinct initial catalog response before measuring steady-state rendering, and target keyboard remediation without an unrelated global Tab. Retain all outcome assertions and performance budgets. Proof: 11 picker unit tests and 47 focused E2E cases across eight files passed, with the corrected thinking and budget files rerun together. Formatting, whitespace checks, and focused follow-up review passed.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 344435e02e
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| (!view().nativeEmbed && view().pageActionsBlocked) || | ||
| (view().mobileNavLayout && view().navDrawerOpen) | ||
| } | ||
| inert={view().mobileNavLayout && view().navDrawerOpen} |
There was a problem hiding this comment.
Disable standing-grant revocation while offline
When an operator disconnects after loading Approvals, applyGatewaySnapshot() preserves the loaded grants through resetHistory(false), so removing the shell fence leaves each Revoke button enabled. Clicking it cannot have an effect because revokeGrant() returns when isCurrentRequest() sees state.connected === false; disable this server-backed action while disconnected rather than presenting a silent no-op.
AGENTS.md reference: AGENTS.md:L82-L82
Useful? React with 👍 / 👎.
| aria-disabled={ | ||
| view().pageActionsBlocked || view().reloadRequired ? "true" : undefined | ||
| } | ||
| inert={view().reloadRequired} |
There was a problem hiding this comment.
Disable manual RPC calls while offline
On the Debug route during reconnect or offline, the retained handshake keeps the RPC method list visible and the Call button remains enabled, but callDebugMethod() immediately returns when lifecycle.capture() cannot obtain a live connection. Gate the Call control on the existing connected prop so clicking it does not silently do nothing.
AGENTS.md reference: AGENTS.md:L82-L82
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9cbafbbb52
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| aria-disabled={ | ||
| view().pageActionsBlocked || view().reloadRequired ? "true" : undefined | ||
| } | ||
| inert={view().reloadRequired} |
There was a problem hiding this comment.
Disable Agents refresh while disconnected
When an operator remains on the Agents route during reconnecting or offline, making the outlet interactive leaves the roster Refresh button enabled (ui/src/pages/agents/view.tsx:199-205). Its handler reaches refreshAgents(), but context.agents.refreshList() short-circuits while the capability is disconnected and the subsequent request-scope check also fails, so the click produces no update or error. Gate this control on the live connection before exposing the route offline.
AGENTS.md reference: AGENTS.md:L80-L82
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8e8b3f3366
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| aria-disabled={ | ||
| view().pageActionsBlocked || view().reloadRequired ? "true" : undefined | ||
| } | ||
| inert={view().reloadRequired} |
There was a problem hiding this comment.
Disable Usage refresh while disconnected
When an operator remains on Usage during reconnect or offline, making the outlet interactive leaves the retained page's Refresh button enabled (ui/src/pages/usage/view.tsx:319-325). Its callback reaches loadUsage(), which only marks the load deferred and returns a resolved promise when gateway.connected is false (usage-page-state.ts:409-414), so the advertised action silently does nothing. Pass live connectivity into the Usage view and disable server-backed refresh while offline.
AGENTS.md reference: AGENTS.md:L82-L82
Useful? React with 👍 / 👎.
| (!view().nativeEmbed && view().pageActionsBlocked) || | ||
| (view().mobileNavLayout && view().navDrawerOpen) | ||
| } | ||
| inert={view().mobileNavLayout && view().navDrawerOpen} |
There was a problem hiding this comment.
Disable Model Providers refresh while disconnected
When Model Providers is open during a same-Gateway disconnect, the controller deliberately preserves its visible data, but removing the shell fence leaves both Refresh/Retry buttons enabled because they only check core.loading (ui/src/pages/model-providers/view.tsx:581-594,647-660). The handler then reaches refresh(), which only records a deferred load and returns while disconnected, producing no visible outcome; gate these controls on the existing connected prop.
AGENTS.md reference: AGENTS.md:L82-L82
Useful? React with 👍 / 👎.
|
Merged via squash.
|
* fix(ui): retain presentation through gateway disconnects * fix(ui): clear retained presentation on any connect rejection * test(ui): check persistent navigation rail during reconnect * test(ui): align offline expectations with retained presentation * test(ui): avoid sidebar helper shadowing after main merge * fix(ui): gate offline actions on live Gateway availability Keep channel details browsable while disabling setup until reconnect. Align Desktop command visibility with its live panel opener, and disable Sessions refresh while disconnected. Cover retained handshakes and restored actions through page and shell regressions. * fix(ui): preserve model picker focus during catalog startup Keep pending search autofocus when catalog arrival mounts the input after the opening frame, without stealing newer user focus. Add coverage for open, closed, removed, and focus-moved pickers. Join catalog-dependent browser assertions to admitted requests and rendered or enabled controls. Drain a distinct initial catalog response before measuring steady-state rendering, and target keyboard remediation without an unrelated global Tab. Retain all outcome assertions and performance budgets. Proof: 11 picker unit tests and 47 focused E2E cases across eight files passed, with the corrected thinking and budget files rerun together. Formatting, whitespace checks, and focused follow-up review passed.
What Problem This Solves
Fixes: most of the Control UI goes blank or inert on every brief Gateway disconnect.
The Gateway store nulled the handshake (
hello) and plugin capabilities on every socket close, so a two-second blip looked like "feature gone / permission denied / Gateway too old" to hundreds of consumers: plugin tabs vanished, Cron showed a missing-read-scope message, About lost the version, Home/Custodian availability flickered. On top of that, the shell made 52 of 57 routesinertthe instant the socket dropped (before the 2 s offline grace) under an "Actions are unavailable while the Gateway reconnects" band, blocking reading, scrolling, copying, filtering and local drafting.User Impact
User impact: a brief disconnect no longer changes what you can see or read. Pages stay interactive while reconnecting; only actions that genuinely need the Gateway are disabled until it is back, and the bottom-left connection status explains the state.
Why This Change Was Made
The store keeps the last accepted handshake and plugin capabilities for the same client through transport loss and replaces them on the next hello. They are cleared exactly where identity or authority is invalidated: credential or Gateway change, stop, retired offline recovery, and any server-sent connect rejection (auth, pairing, protocol, build) — one transient-close predicate now shared with the existing self-profile retention.
Live authority is unchanged:
canCallGatewayMethodstill requires a connected client, and the Gateway still authorizes every request. A new presentation-onlycanPresentGatewayMethodbacks navigation/panel availability;isHomePanelAvailabledrops its private last-access cache (it existed only to paper over the nulled handshake) and Custodian availability moves next to it. The blanket inert band is removed; Cron submit, skill import and worktree mutations are explicitly disabled while disconnected.Second PR in the offline-first series (after the bottom-left connection status).
Evidence