Skip to content

fix(dashboard): hide the ask-the-agent hand-off while the gateway is unreachable - #10680

Closed
rubencu wants to merge 1 commit into
kirodotdev:mainfrom
rubencu:fix/hide-ask-agent-while-gateway-unreachable
Closed

rubencu wants to merge 1 commit into
kirodotdev:mainfrom
rubencu:fix/hide-ask-agent-while-gateway-unreachable

Conversation

@rubencu

@rubencu rubencu commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

When the gateway is unreachable (stopped, crashed, or mid-restart), the dashboard's error surfaces still render their "Ask the agent" link — the header's instance bar shows "Failed to fetch Ask the agent", and every other error banner does the same. Clicking it does nothing useful: the agent runs on the gateway, so the hand-off lands in a chat composer that is itself inert ("gateway offline — message will not send").

Why it matters

The most likely error on screen while the gateway is down IS the connectivity failure itself. Offering "Ask the agent" next to it promises help the app cannot deliver, and a call to action that does nothing on click reads as one more broken thing.

What changed (motivation → approach → change)

The hand-off button now hides while the gateway is unreachable, and comes back on its own when the connection returns. The error text and the dismiss control stay.

AskAgentButton cannot read the store's dashboard.connected flag: its callers include ErrorBoundary fallbacks, where the store Provider may be exactly what threw, and the existing tests pin that it mounts with no Provider at all. So the flag is mirrored into a module seam in utils/errorReport.ts — the same shape as the installSoftNavigate seam already there — written by useWebSocket right beside its sseConnected/sseDisconnected dispatches so each WebSocket connect/disconnect transition updates both copies. The button subscribes with useSyncExternalStore, which needs no context, so the boundary-safety contract holds. The seam defaults to connected, so a surface that never mounts the socket (a boundary fallback, a bare test render) keeps the button.

flowchart LR
  subgraph Before
    B1[gateway down]:::ctx --> B2[error banner]:::ctx --> B3["Ask the agent → inert composer"]:::removed
  end
  subgraph After
    A1[gateway down]:::ctx --> A2[error banner]:::ctx --> A3[hand-off hidden until reconnect]:::added
  end
  classDef added fill:#DCFCE7,stroke:#16A34A
  classDef changed fill:#FEF3C7,stroke:#D97706
  classDef removed fill:#FEE2E2,stroke:#DC2626,stroke-dasharray:4 3
  classDef ctx fill:#E0F2FE,stroke:#0284C7
Loading

🟩 added · 🟥 removed · 🟦 unchanged

The gate lives in components/AskAgentButton.tsx (which also serves components/ErrorNotice.tsx, the boundary fallbacks and the header instance bar) and in the Radix menu-item variant ErrorNoticeMenuItem; the seam writes sit in hooks/useWebSocket.ts. The root ErrorBoundary's hard hand-off button is deliberately not gated: at the root, connection state is as suspect as everything else.

Tests

  • errorToAgent.test.tsx: the seam defaults to connected (bare renders keep the button); the button hides on disconnect and reappears on reconnect without a caller re-render; ErrorNotice keeps the diagnostic and dismiss while disconnected; the menu-item hand-off hides too.
  • gatewayConnectedPairing.test.ts: raw sseConnected/sseDisconnected dispatches are confined to the paired WebSocket helpers. This guard does not change or govern the inherited sseStatus reducer.
  • Existing suites pin the unchanged contracts: no-Provider mounting, click-time report resolution, hand-off staging.

Manual verification

Reproduced the exact reported state against a pod built from this branch: authenticated dashboard, then gateway stopped, then reload (assets served by vite, API dead). Before: 4 "Ask the agent" links next to the failure banners. After: 0 — banners and "Try again" intact. Captures below.

Screenshots / video

Before (gateway down — dead-end CTA next to the failure):

Before: Ask the agent rendered beside HTTP 502 while the gateway is down

After (same state — the CTA is gone, the error and retry stay):

After: only the error and Try again remain

Pattern harvest

Not generalizable: one-off UI affordance gating; the reusable part (the context-free connectivity seam) now exists for any future surface with the same dead-end.

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

no linked issue: reported directly by the maintainer in chat, no tracked issue exists.

@rubencu
rubencu requested review from a team and buluoray September 14, 2026 03:27
@github-actions github-actions Bot added the fork Pull request from a fork (external contributor) label Sep 14, 2026
@rubencu

rubencu commented Sep 14, 2026

Copy link
Copy Markdown
Contributor Author

Intent: Hide every "Ask the agent" error hand-off while the dashboard cannot reach the gateway, and bring it back automatically on reconnect — the hand-off otherwise delivers the error to a composer that cannot send.
Not a goal: Changing what the hand-off does while connected, gating the root ErrorBoundary hard hand-off (connection state is as suspect as everything else there), or adding any new UI to explain the absence.

@github-actions github-actions Bot added the readiness: action required A blocking check or review needs attention label Sep 14, 2026
@github-actions

github-actions Bot commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

GPT 5.6 Review (fork) — ✅ no blocking findings

Reviewed fec3baf15c126649fa7c38c2ae355e701325b270 via the fork AI-review pipeline; updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] fec3baf

@github-actions

github-actions Bot commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Fable 5, fork) — ✅ PASS

Design-level review of fec3baf15c126649fa7c38c2ae355e701325b270 via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: PASS

Real dead-end removed at the affordance itself; the context-free seam mirrors an existing pattern (installSoftNavigate), with the drift risk pinned by test.

[DESIGN-REVIEWED] fec3baf

@github-actions

github-actions Bot commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Fable 5, fork) — 🔴 BLOCK

UX-level review of fec3baf15c126649fa7c38c2ae355e701325b270 via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

All evidence is in hand. The diff conditionally hides the existing "Ask the agent" hand-off (in AskAgentButton and ErrorNoticeMenuItem) while the gateway is unreachable — a user-visible state change. The attachment image list and recording list are both empty; the PR description's two captures (before-card.png, after-card.png) are raw.githubusercontent.com URLs pinned to fork commit 385b3e71, not github.com/user-attachments assets, so the evidence step admitted nothing. That is an evidence gap by this lane's contract, and the change itself (hide-not-disable, error text and dismiss preserved, auto-restore on reconnect) is otherwise sound in the code.

UX-Verdict: BLOCK

Cannot evaluate: missing screenshots of the disconnected error surfaces — the description's raw-URL images were not admitted as evidence for this revision.

Evidence gaps

  • The disconnected state (error banner + "Try again" with the "Ask the agent" hand-off hidden, per if (!gatewayConnected) return null) appears in no admitted image — the image list is empty; closed by attaching the after capture to the description as a github.com/user-attachments asset.
  • The before/connected state (banner with the hand-off visible) — same: the image list carries no entry; attach the before capture the same way.
  • The linked raw.githubusercontent.com/rubencu/KiroCrew/385b3e71…/before-card.png and …/after-card.png are commit-pinned raw URLs outside this PR, not user-attachments assets, so they failed to close the gaps; re-upload both by dragging them into the PR description.

Watch

  • ErrorNoticeMenuItem's hand-off vanishes from an open Radix menu the moment the socket drops, with nothing in the menu explaining why; rare (mid-menu disconnect) and self-healing on reconnect, so severity is low — no change needed unless users report it.

[UX-REVIEWED] fec3baf

@github-actions

github-actions Bot commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

Opus 4.8 Review (fork) — ✅ no blocking findings

Reviewed fec3baf15c126649fa7c38c2ae355e701325b270 via the fork AI-review pipeline; updated in place on each push.

Review details

The candidate describes a transient, self-correcting UI state: _gatewayConnected defaults to true, so during the brief window before the WebSocket onclose handler fires, the "Ask the agent" button may show next to a connectivity error. Evaluating against the bar:

  • The default-true fail-open is explicitly the documented design ("Defaults to true — reachable until the socket layer reports otherwise"), intended for surfaces that never mount the socket.
  • The onclose path (markGatewayDisconnected) fires on a real connection close, so the state self-corrects; the candidate itself rates this "low" and admits it "could not confirm how often" the button renders before onclose runs — that is a "might," which fails prong (a)/(b).
  • The outcome is a transient, self-correcting affordance — not a crash, data loss, or security boundary. Not a blocking class, and below the 80 confidence bar.

No Step 2 findings survive falsification: the useSyncExternalStore snapshot returns a stable primitive (no render loop), subscribe returns a proper unsubscribe, the two helpers keep the store flag and seam paired, and the stale-WS guard leaves genuine disconnects handled.

No findings.

[OPUS-REVIEWED] fec3baf

@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Sep 14, 2026
@github-actions

github-actions Bot commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Fable 5, fork) — 🟡 CONCERNS

Premise-level review of fec3baf15c126649fa7c38c2ae355e701325b270 via the fork AI-review pipeline — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

All the evidence is in. The fix itself is well-provenanced (manual repro in the description, tests that fail on base), the seam has counted consumers, and the pattern mirrors the existing installSoftNavigate seam. The one real gap: the store's connected flag has a third mover — the sseStatus reducer (dashboardSlice.ts:402), dispatched over HTTP at App.tsx:2752 — that the new pairing helpers and the source-scanning pairing test don't cover, and that test file is never mentioned in the description.

First-Principles-Verdict: CONCERNS

The pairing pin claims the two flags "cannot drift," but sseStatus (dashboardSlice.ts:402) also sets connected = true outside the guarded helpers.

Not justified as shipped

  • Item 7 — undeclared; its header ("raw dispatches may appear only inside the two helpers, so the split cannot happen") pins an invariant with one counted unguarded mover: the sseStatus reducer sets state.connected = true (grep state.connected in dashboardSlice.ts: writers at 402, 428, 429; the test scans only for dispatch(sseConnected|sseDisconnected())), and sseStatus is dispatched over plain HTTP at App.tsx:2752, no socket required.

What this change ships

Inventory (8 items) — 7 justified

Intent: stop offering an "Ask the agent" hand-off that lands in a composer that cannot send while the gateway is down — a FIX.

  1. "Ask the agent" links vanish from error banners while the gateway is unreachable — justified
  2. They come back on their own when the connection returns — justified
  3. Menu-item "Ask the agent" entries hide the same way — justified
  4. Error text, dismiss, and retry stay visible while disconnected — justified
  5. A new module-level connectivity flag other code may read/subscribe to — justified
  6. Connect/disconnect now route through paired helper functions in the socket hook — justified
  7. A new source-scanning test forbids raw connect/disconnect dispatches outside those helpers — undeclared; pins an incomplete invariant (misses the sseStatus mover)
  8. The button's "deliberately hook-free" contract comment rewritten as "context-free" — justified

Watch

  • The seam mirrors 2 of the 3 movers of dashboard.connected. Sibling left unfixed: sseStatus(state) { …state.connected = true } (dashboardSlice.ts:402), reachable via HTTP (App.tsx:2752) with the socket closed — store flips connected while the seam still says down, so store-driven UI and the hand-off disagree exactly in the state this PR is about.
    Clears when: the sseStatus mover is paired with (or its connected = true removed in favor of) the helpers, or the author shows no sseStatus dispatch can fire while the seam reads false.

[FIRST-PRINCIPLES-REVIEWED] fec3baf

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Sep 14, 2026
@rubencu

rubencu commented Sep 14, 2026

Copy link
Copy Markdown
Contributor Author

Triage: the Backend Tests (3.12, 1) red is inherited, not this PR's.

The failing test is container_tests/test_review_findings.py::test_the_detail_attribute_carries_the_authored_message with ModuleNotFoundError: No module named 'httpx' — a backend test this frontend-only diff never touches (git diff origin/main...HEAD is 5 files, all under website/src/). It is the repo-wide breakage tracked in #10700: the reduced cross-surface path passes container_tests files as explicit pytest targets, which escapes that suite's own collect_ignore_glob dependency guard, and the app CI env deliberately does not carry the image's runtime deps. Currently red on every frontend-only PR.

Holding — no pushes or retriggers against this red. Once the fix lands on main I will rebase (the diff is byte-identical under rebase; review stamps carry by patch-id) and push to re-run the shard.

@rubencu

rubencu commented Sep 14, 2026

Copy link
Copy Markdown
Contributor Author

Maintainer handoff: this frontend-only head is reviewer-clean, but CI is blocked by an unrelated current-main backend dependency failure.

  • Linux backend shard: aws_control/crew/runtime/container_tests/test_review_findings.py::test_the_detail_attribute_carries_the_authored_message
  • Failure: ModuleNotFoundError: No module named httpx from the unconditional import in container/front/app.py
  • Evidence: 8,873 tests passed before this sole failure. Both failing files came from main commit 6b6d07e84; this PR changes only five website/ files.
  • Windows cancellation and Coverage Gate are downstream of that backend failure.

Contributor rerun is admin-only (HTTP 403), and a rerun would remain deterministic until main supplies httpx to that test environment or makes the import lazy. Please fix the base dependency and rerun this head. No PR branch change is warranted.

@rubencu

rubencu commented Sep 14, 2026

Copy link
Copy Markdown
Contributor Author

Update: the inherited shard-1 red now has a fix open — #10709 (declines container_tests collection for directly-named files, closes #10700). Still holding this PR; once the fix merges I will rebase and push to re-run CI.

@rubencu
rubencu force-pushed the fix/hide-ask-agent-while-gateway-unreachable branch from 6ccecfb to 04e78c3 Compare September 14, 2026 06:29
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Sep 14, 2026
@rubencu
rubencu force-pushed the fix/hide-ask-agent-while-gateway-unreachable branch from 04e78c3 to 5b58fce Compare September 14, 2026 07:02
@rubencu

rubencu commented Sep 14, 2026

Copy link
Copy Markdown
Contributor Author

self-added: no
mechanism: markGatewayConnected/markGatewayDisconnected helpers in useWebSocket.ts pairing the store dispatch with the seam mirror

  • fixed span=5b020f9fea43

Implemented in 5b58fce: the dispatch+mirror pairs are now the private
markGatewayConnected/markGatewayDisconnected helpers in useWebSocket.ts —
the only sanctioned way to move the flag, so a future dispatch site cannot
silently skip the mirror. All three prior sites migrated; the seam doc in
errorReport.ts names the helpers as the sole write path.

@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Sep 14, 2026
@rubencu

rubencu commented Sep 14, 2026

Copy link
Copy Markdown
Contributor Author

self-added: yes
mechanism: source-level pin test gatewayConnectedPairing.test.ts

  • fixed span=d024732488a6

Pinned in fec3baf: website/src/test/gatewayConnectedPairing.test.ts asserts
the raw sseConnected/sseDisconnected dispatches appear ONLY inside
markGatewayConnected/markGatewayDisconnected (helper bodies verified to pair
dispatch with the seam write; whole-tree scan fails on any other dispatch
site). The invariant is now a check, not a comment.

@rubencu

rubencu commented Sep 14, 2026

Copy link
Copy Markdown
Contributor Author
  • rebutted span=2e8b30f6ef63

Not a duplicate: the two flags carry OPPOSITE required defaults, so a
singleton subscription cannot replace the seam.
dashboardSlice.connected initializes FALSE (dashboardSlice.ts:214) and must
— it gates send affordances that stay inert until the socket proves alive.
The hand-off needs the INVERSE: visible on any surface that never learns
about connectivity. useSyncExternalStore(store.subscribe, () =>
store.getState().dashboard.connected) reads false during the whole boot
window before the first WS open and on every surface without the socket
hook, hiding the button exactly where it matters most; the pinned
no-Provider boundary-fallback tests (errorToAgent.test.tsx) assert the
button renders there and would fail under the singleton read. Fail-closed
for sending vs fail-open for the hand-off is a semantic difference, not
duplication.

@rubencu

rubencu commented Sep 14, 2026

Copy link
Copy Markdown
Contributor Author

self-added: yes
mechanism: source-level pin test gatewayConnectedPairing.test.ts

  • fixed span=5110522b765e

Both clearing conditions addressed. (1) The guard is no longer advisory:
gatewayConnectedPairing.test.ts (fec3baf) fails on any raw
sseConnected/sseDisconnected dispatch outside the helpers, tree-wide.
(2) Confirming the disqualifier: the direct singleton read is ruled out not
by a throw risk but by its initial state — dashboardSlice.connected starts
false, so the store read hides the hand-off during boot and on socket-less
surfaces, failing the pinned boundary-fallback contract (see the
span=2e8b30f6ef63 record).

@rubencu

rubencu commented Sep 14, 2026

Copy link
Copy Markdown
Contributor Author
  • rebutted span=c43ba4e9fe9c

The proposed replacement changes behavior, not just plumbing:
store.getState().dashboard.connected is FALSE from store creation until the
first WS open (dashboardSlice.ts:214), so the subtraction hides "Ask the
agent" during the boot window and on every render without the socket hook —
the boundary fallbacks and bare renders whose button the pinned
errorToAgent tests assert. The seam exists to carry the opposite default
(fail-open), which the store flag cannot adopt without breaking the send
affordances it gates. Drift risk is now pinned by test rather than borne by
convention (span=5110522b765e record).

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Sep 14, 2026
@rubencu

rubencu commented Sep 14, 2026

Copy link
Copy Markdown
Contributor Author
  • rebutted Inherited sseStatus writer is outside the WebSocket lifecycle guard span=0643f3966cfb

sseStatus is an inherited writer in untouched dashboardSlice.ts, not a WebSocket lifecycle transition. This PR drives the context-free hand-off seam directly from the real WebSocket open, reconnect, and close paths, so an sseStatus dispatch cannot re-show AskAgentButton while that seam reads disconnected.
The source guard intentionally covers raw sseConnected/sseDisconnected transition calls. Normalizing the older store writer would change boot and health-probe semantics outside this PR.

@rubencu

rubencu commented Sep 14, 2026

Copy link
Copy Markdown
Contributor Author
  • rebutted Mid-menu disconnect explanation UI is disproportionate span=cb732c664396

A disconnect while the menu is already open is transient and self-heals on reconnect. Error text, dismiss, and retry remain available. Adding persistent explanation UI for this rare transition is disproportionate to this PR.

@NicholasRBowers NicholasRBowers added the needs-pr-triage PR scanner: awaiting automated triage label Sep 21, 2026
@chenmingwei23 chenmingwei23 added drive-to-green PR claimed by drive-to-green pipeline and removed needs-pr-triage PR scanner: awaiting automated triage labels Sep 21, 2026
@chenmingwei23

Copy link
Copy Markdown
Contributor

🤖 Kiro Crew [operator: chenmingwei23#de330d0c]: This PR has been inactive for 7+ days with failing CI. I've assessed the blockers and they appear resolvable -- I'll push fixes directly to this branch as a co-author.

Assessment: Frontend-only change (240/-10, 6 files). Blockers are mechanical: the failing Frontend Tests (2) and Frontend Coverage Merge shards report all specs passing (520 passed / 2082 passed) then exit 1 from the coverage-gate step, and PR Readiness is red on coverage. Fix plan: rebase onto current main, ensure the new lines in errorReport.ts / AskAgentButton.tsx / useWebSocket.ts meet the per-file coverage floor, and re-run so the fresh run set supersedes the stale 2026-09-14 one.

If you'd prefer I don't touch this PR, add the pr-no-autofix label.

@dwu96 dwu96 added needs-author-decision PR blocked on author input and removed needs-author-decision PR blocked on author input labels Sep 21, 2026
@github-actions github-actions Bot added the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Sep 25, 2026

Copy link
Copy Markdown
Contributor

PR triage (2026-10-05): DISTINCT, needs a REBASE. No breaking change or P0 found.

  • Versus main: nothing on origin/main (ef61a9aaf6) gates "Ask the agent" on gateway connectivity. isGatewayConnected/subscribeGatewayConnected don't exist there, and AskAgentButton still returns early only when !report && !message. This PR isn't superseded.

  • Versus open PRs: feat: add Captain, a built-in assistant with confirm-to-apply changes #15326 (Captain), fix(knowledge): store bare source-language canonical names with English aliases #12551 and feat(dashboard): report rejected gateway writes in one notice #10910 also touch AskAgentButton.tsx/ErrorNotice.tsx/errorReport.ts. They change the label, add a gate/leave-guard and add a hand-off target, but none of them hides the button while the gateway is offline. They overlap at the text level only, not in goal.

  • Why it needs a rebase: the head is 2,811 commits behind, and git merge-tree reports conflicts in website/src/hooks/useWebSocket.ts and website/src/test/errorToAgent.test.tsx. refactor(website): split useWebSocket into hooks/websocket owners #15082 (merged 2026-09-30) split useWebSocket into hooks/websocket/*, so the three sites this PR rewires now live elsewhere:

    • sseDisconnected: hooks/websocket/connection.ts, in handleClose
    • sseConnected: hooks/websocket/reconnectCatchUp.ts, in runFirstConnect and the reconnect catch-up

    After the rebase, move markGatewayConnected/markGatewayDisconnected next to those owners. gatewayConnectedPairing.test.ts hardcodes HOOK = hooks/useWebSocket.ts, and it scans the whole tree, so as written it will flag the raw dispatches in connection.ts/reconnectCatchUp.ts. One small thing while you're there: the helpers currently sit between import statements in useWebSocket.ts. Keeping them after the import block is safer for lint.

  • Recommendation: keep it open, rebase, port the seam writes to the split owners, and re-run CI.

iamwhatever pushed a commit that referenced this pull request Oct 14, 2026
…unreachable

While the gateway is down, "Ask the agent" hands the error to a chat
composer that cannot send, and the error on screen is usually the
connectivity failure itself. Hide the hand-off (AskAgentButton and
ErrorNoticeMenuItem) while disconnected; it returns on reconnect.

The button must mount outside the store Provider (ErrorBoundary
fallbacks), so the store's connected flag is mirrored into a
context-free seam in utils/errorReport. The socket layer moves both
through markGatewayConnected/markGatewayDisconnected in
hooks/websocket/gatewayConnectivity.ts, called from connection.ts
(handleClose) and reconnectCatchUp.ts (first connect and reconnect).
A source-level test pins that no raw sseConnected/sseDisconnected
dispatch exists outside those helpers.

Re-ported from #10680 onto the hooks/websocket split from #15082.

Fixes #20215

Co-authored-by: Ruben Cuevas <rubencu@amazon.com>
@iamwhatever

Copy link
Copy Markdown
Contributor

Thank you @rubencu for this fix and its design. Since #15082 split useWebSocket.ts into hooks/websocket/*, it no longer rebased cleanly, so it has been re-ported onto the new seam in #20223 (Fixes #20215). Your commit keeps you as author. #20223 replaces this PR, so I'm closing this one; your branch is left in place.

@mbriones98 mbriones98 removed the drive-to-green PR claimed by drive-to-green pipeline label Oct 14, 2026
@github-actions github-actions Bot removed the readiness: action required A blocking check or review needs attention label Oct 14, 2026
iamwhatever pushed a commit that referenced this pull request Oct 14, 2026
…unreachable

While the gateway is down, "Ask the agent" hands the error to a chat
composer that cannot send, and the error on screen is usually the
connectivity failure itself. Hide the hand-off (AskAgentButton and
ErrorNoticeMenuItem) while disconnected; it returns on reconnect.

The button must mount outside the store Provider (ErrorBoundary
fallbacks), so the store's connected flag is mirrored into a
context-free seam in utils/errorReport. The socket layer moves both
through markGatewayConnected/markGatewayDisconnected in
hooks/websocket/gatewayConnectivity.ts, called from connection.ts
(handleClose) and reconnectCatchUp.ts (first connect and reconnect).
A source-level test pins that no raw sseConnected/sseDisconnected
dispatch exists outside those helpers.

Re-ported from #10680 onto the hooks/websocket split from #15082.

Fixes #20215

Co-authored-by: Ruben Cuevas <rubencu@amazon.com>
iamwhatever pushed a commit that referenced this pull request Oct 14, 2026
…unreachable

While the gateway is down, "Ask the agent" hands the error to a chat
composer that cannot send, and the error on screen is usually the
connectivity failure itself. Hide the hand-off (AskAgentButton and
ErrorNoticeMenuItem) while disconnected; it returns on reconnect.

The button must mount outside the store Provider (ErrorBoundary
fallbacks), so the store's connected flag is mirrored into a
context-free seam in utils/errorReport. The socket layer moves both
through markGatewayConnected/markGatewayDisconnected in
hooks/websocket/gatewayConnectivity.ts, called from connection.ts
(handleClose) and reconnectCatchUp.ts (first connect and reconnect).
A source-level test pins that no raw sseConnected/sseDisconnected
dispatch exists outside those helpers.

Re-ported from #10680 onto the hooks/websocket split from #15082.

Fixes #20215

Co-authored-by: Ruben Cuevas <rubencu@amazon.com>
iamwhatever added a commit that referenced this pull request Oct 14, 2026
…20223)

* fix(dashboard): hide the ask-the-agent hand-off while the gateway is unreachable

While the gateway is down, "Ask the agent" hands the error to a chat
composer that cannot send, and the error on screen is usually the
connectivity failure itself. Hide the hand-off (AskAgentButton and
ErrorNoticeMenuItem) while disconnected; it returns on reconnect.

The button must mount outside the store Provider (ErrorBoundary
fallbacks), so the store's connected flag is mirrored into a
context-free seam in utils/errorReport. The socket layer moves both
through markGatewayConnected/markGatewayDisconnected in
hooks/websocket/gatewayConnectivity.ts, called from connection.ts
(handleClose) and reconnectCatchUp.ts (first connect and reconnect).
A source-level test pins that no raw sseConnected/sseDisconnected
dispatch exists outside those helpers.

Re-ported from #10680 onto the hooks/websocket split from #15082.

Fixes #20215

Co-authored-by: Ruben Cuevas <rubencu@amazon.com>

* test(dashboard): screenshot harness for the offline ask-the-agent gate

---------

Co-authored-by: Ruben Cuevas <rubencu@amazon.com>
Co-authored-by: cixuuz <26782336+cixuuz@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fork Pull request from a fork (external contributor) merge conflict Branch has merge conflicts with its base — author must resolve before merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants