Repository navigation
feat(web): open the monitoring column on connection failure, with a Console tab and failed-card border (#1621) - #1622
Conversation
On a connection failure the user was left without an obvious way to see why. Open the monitoring column automatically on the transition into the `error` status (mirroring the connect-success behavior from #1616) so the diagnostics surface right when they're needed. - Broaden the auto-open effect to fire on the transition into `error` as well as `connected`, tracked via a general previous-status ref so it fires once per transition and never on a mount that starts errored. - A failed connect never negotiated capabilities, so the failure column offers History (the local client-side message log) and — for non-stdio transports — Network (HTTP requests), the entries that explain the failure. Logs is omitted (it needs the server `logging` capability). - `effectivePinned` now allows the column while `error`, not only while `connected`; it still closes on a clean disconnect or narrowing. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01BrihGWcrM9JGRyu41nzZYw
…#1621) A failed stdio launch had no useful diagnostic surface: the message log (History) is cleared on the error transition and there are no HTTP requests (Network), so the auto-opened monitoring column was empty. The process's stderr — which explains the failure (e.g. "No module named mcp_server_time") — was captured in StderrLogState but never displayed. - New ConsoleScreen renders the captured stderr stream (search / sort / clear / export; embeddable in the monitoring column), wired through App via the existing useStderrLog hook + StderrLogState. - Console is a pinnable monitor tab like Logs/History/Network, gated to stdio servers (HTTP has no child process). It lives in the header menu when the column isn't pinned, and moves into the column when it is. - The failure column now picks its tabs by which diagnostic actually captured content (stderr → Console, fetch requests → Network), not by the active server's transport: a connect failure fires the client `disconnect` event, which clears `activeServer`, so transport can't be read back there. The memo re-runs as stderr/fetch entries stream in, so the diagnostic tab appears as soon as the failing process prints. Verified live against a failing `python -m mcp_server_time` stdio server: the column auto-opens to Console showing the real ModuleNotFoundError. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01BrihGWcrM9JGRyu41nzZYw
The InspectorView story args predate the new required Console props, so the "Connection Error" play story crashed rendering (`stderrLogs` undefined → `.length` throw) — caught by the Storybook step of `npm run ci`, which I should have run before the previous push. - Add `stderrLogs` / `consoleUi` / `onConsoleUiChange` / `onClearConsole` / `onExportConsole` to the story args, with a `demoStderr` fixture. - Make the Connection Error story a stdio-failure narrative: it now opens the column to Console showing the captured startup error, with `network: []` so Network isn't offered. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01BrihGWcrM9JGRyu41nzZYw
#1621) Flags the server whose last connection attempt failed with a red card border, cleared when another server is connected or a new connection is attempted — a persistent, at-a-glance companion to the failure toast and the auto-opened monitoring column. - App tracks `failedServerId`: set in onToggleConnection's non-auth handshake catch, cleared at the start of any new connect attempt. It is deliberately kept out of resetSessionScopedUiState, since the failure's own `disconnect` event would otherwise clear it the same tick (that same event clears `activeServer`, which is why the flag is tracked separately). - New `errored` Card theme variant (red border via a new `--inspector-error-border` token), mirroring the `highlighted` green border. Precedence: disabled (dimmed) > errored > highlighted. - Plumbed `erroredServerId` through InspectorView → ServerListScreen → ServerCard (`errored` prop). Full `npm run ci` passes (validate + coverage + smoke + storybook). Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01BrihGWcrM9JGRyu41nzZYw
…ure (#1621) Opening the monitoring column on a failed connection reflows the server grid to fewer/narrower columns, which can push the failed card below the fold. Scroll it into view so the red-bordered card is visible without hunting for it. - ServerCard scrolls itself into view on the disconnected→errored transition (mirrors the freshly-added highlight scroll), deferred ~320ms so the column open + grid reflow settle first — otherwise scrollIntoView targets the card's pre-reflow position. Guarded by a ref so it fires once per failure and won't fight a user who scrolls away. Verified live: the failed `time` card scrolls fully into view after the column opens. Full `npm run ci` passes. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01BrihGWcrM9JGRyu41nzZYw
|
@claude review |
|
Claude finished @cliffhall's task in 3m 50s —— View job Review: open monitoring on connection failure (#1622)
Nice, well-scoped PR. The code is unusually well-commented, the content-based failure-tab selection is a clever way around the cleared 1.
|
… dedupe timing (#1621) Review feedback on #1622: - #1 (medium): `connectionStatus === "error"` also covers a mid-session crash of a previously-connected server, not just a failed connect attempt. Scope the auto-open + failure tab set to connect attempts only: the auto-open effect's error arm now requires the previous status to not be `connected` (connecting/disconnected → error), and `failed` (render) requires `erroredServerId`, which the parent sets only for connect- attempt failures. A mid-session crash now closes the column like any teardown instead of reopening a user-closed column / dropping the live Logs tab. This also aligns the column behavior with the red border. - #3 (minor): extract the column slide duration into a shared `monitorColumnAnimation.ts` (MONITOR_COLUMN_ANIM_MS + FAILED_CARD_SCROLL_DELAY_MS) so InspectorView's Transition and ServerCard's scroll delay can't drift. - #4 (nit): composite key for ConsoleScreen entry rows instead of the array index. Added a mid-session-crash test (connected → error with no erroredServerId closes the column). Verified live: a connect failure still opens the column to Console. Full `npm run ci` passes. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01BrihGWcrM9JGRyu41nzZYw
|
Thanks for the thorough review! Addressed in 87630f2: 1.
This also fixes an inconsistency you implicitly surfaced: the red border ( 2. No-output stdio failure opens to an empty column (minor) — Left as-is per your "no action" note. In practice the backend's grace window (server.ts holds the session ~30s so the events stream can drain queued stderr + the transport error) means stderr almost always arrives, and the memo re-runs to swap in Console when it does. A truly silent failure showing an empty History is the rare anticlimactic case, but gating "open on failure" on content would trade that for "sometimes the sidebar doesn't open at all," which I think is worse for the issue's intent. 3. 4. Verified live against the failing |
|
@claude review |
|
Claude finished @cliffhall's task in 2m 38s —— View job Re-review: open monitoring on connection failure (#1621)Re-reviewed the changes since my first pass. The three actionable items from last round are all addressed cleanly.
Fixes verified ✅
Also confirmed the Two small new observations (non-blocking)A. A persisted monitorAvailable.includes(monitorTab) && isMonitorTab(monitorTab)
? monitorTab
: (monitorAvailable.find(isMonitorTab) ?? LOGS_TAB);On a stdio failure with captured stderr, B. The auto-open Neither blocks merge. Nice work on the revision — the dual-gate approach to the crash-vs-attempt distinction is clean and the shared-constant extraction is exactly right. |
Re-review follow-up (#1622): - Observation A: a returning user whose last-pinned monitor tab was History would land on the (empty) History tab on a stdio failure instead of the Console diagnostic. Root cause: History is *always* empty on a connect failure (the message log clears on the error transition), yet it was pushed unconditionally, so it could precede/hide the real diagnostic. Fix: content-gate History like Console/Network — only offer it when it has entries. On a fresh failure the diagnostic (Console/Network) is the only tab, so it always leads, without touching tab-switching or adding state. This also resolves the earlier "opens onto an empty column" note: when nothing has been captured yet, monitorAvailable is empty and the column stays closed, opening reactively once stderr/fetch content lands. Tests: stdio/HTTP failure now assert the diagnostic leads and History is absent; added "leads with Console even when stored tab was History", "keeps the column closed until a diagnostic has content", and "offers History when it has captured content". Verified live (time server → Console-only column). Full `npm run ci` passes. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01BrihGWcrM9JGRyu41nzZYw
|
Thanks for the re-review! Addressed A in a759777; B explained below. A. Persisted Bonus: this also resolves your original observation #2 (the "anticlimactic empty column"). With all three tabs content-gated, New/updated tests: stdio & HTTP failure now assert the diagnostic leads with History absent; B.
|
|
@claude review |
|
Claude finished @cliffhall's task in 1m 30s —— View job Final review: content-gated failure column (#1621)Re-read the full diff against
Feedback A — verified ✅Content-gating History in the const tabs: string[] = [];
if (stderrLogs.length > 0) tabs.push(CONSOLE_TAB);
if (network.length > 0) tabs.push(NETWORK_TAB);
if (history.length > 0) tabs.push(HISTORY_TAB);
New tests cover both arms (diagnostic-leads-with-History-absent, Feedback B — accept the explanation ✅Agreed the un-gated Also confirmed in the final state
Nothing blocking, and no new issues. The dual-gate crash-vs-attempt distinction and the content-gating both read as deliberate and well-tested. LGTM. 👍 |
Closes #1621
Summary
Related to #1616 (open the monitoring column on connect). On a successful connect we pin the monitoring column open; on a failed connection the user was left without an obvious way to see why. This opens the monitoring column automatically when a connection attempt fails and gives it something useful to show — a new Console tab that surfaces a failing stdio server's stderr — plus a red border on the failed server's card.
Behavior
errorstatus, tracked via a previous-status ref so it fires once per transition and never on a mount that starts already errored.StderrLogStatebut never displayed anywhere.ConsoleScreennow renders it (search / sort / clear / export, embeddable in the column), wired throughAppvia the existinguseStderrLoghook. Console is a pinnable monitor tab like Logs/History/Network, gated to stdio servers (HTTP has no child process). It appears in the header tab menu when the column isn't pinned, and moves into the column when it is.disconnectevent, which clearsactiveServer— so transport can't be read back reliably there. The memo re-runs as entries stream in.ServerCard(newerroredCard theme variant +--inspector-error-bordertoken, mirroring the freshly-added greenhighlightedborder).ApptracksfailedServerId: set in the non-auth handshake catch, cleared at the start of any new connect attempt, and deliberately kept out ofresetSessionScopedUiState(the failure's owndisconnectevent would otherwise clear it the same tick). Precedence: dimmed > errored > highlighted.effectivePinnedallows the column whileerror, not onlyconnected; it still closes on a clean disconnect or narrowing without clearing the user'smonitorPinnedpreference.Screencap
open-monitoring-sidebar-on-failed-connect.mov
Testing
App,InspectorView,ServerListScreen,ServerCard, and a new fully-coveredConsoleScreen(+ Storybook): auto-open on the error transition; Console (with captured stderr) is the default tab for a stdio failure even whenactiveServeris cleared; Network (not Console) for an HTTP failure with a captured request; Console offered as a pinnable/header-menu tab for a connected stdio server;failedServerIdset on a failed connect and cleared on a new attempt; red-border variant precedence.npm run cipasses — validate + coverage (every file clears the ≥90 per-file gate) + smoke + Storybook.python -m mcp_server_timestdio server: connecting auto-opens the column to the Console tab showing the realNo module named mcp_server_timestderr, and the card shows the red border.🤖 Generated with Claude Code