Skip to content

fix(terminal): hide SSH error toast under the reconnect banner - #10246

Merged
nwparker merged 2 commits into
mainfrom
nwparker/suppress-ssh-error-toast-under-reconnect
Jul 24, 2026
Merged

nwparker merged 2 commits into
mainfrom
nwparker/suppress-ssh-error-toast-under-reconnect

Conversation

@nwparker

Copy link
Copy Markdown
Contributor

Summary

  • Follow-up to fix(terminal): keep SSH reconnect banner above the xterm canvas #10242: the reconnect banner now stacks above the terminal, but the red TerminalErrorToast (z-index: 50) was still painting over it with the raw ssh:connect failure
  • Hide the terminal error toast while the SSH reconnect banner is visible
  • Clear SSH-owned toast text while the banner is up so a successful reconnect cannot flash the stale failure

Why

Screenshot from the merged fix: left split shows the red "SSH connection failed: Error invoking remote method 'ssh:connect'..." toast on top of the "SSH connection required" banner. Same bottom strip, two competing recovery UIs.

Tests

  • pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/components/terminal-pane/TerminalErrorToast.test.ts (5/5)

The z-50 TerminalErrorToast was stacking over the non-blocking SSH reconnect
banner with the raw ssh:connect failure. Suppress the toast while the banner
owns recovery and clear matching toast text so it cannot flash after reconnect.
@coderabbitai

coderabbitai Bot commented Jul 24, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Adds exported helpers to classify and strip SSH reconnect-owned terminal error lines, with tests for matching, removal, and preservation of unrelated messages. TerminalPane sanitizes terminal errors and suppresses the terminal error toast while the SSH reconnect overlay is active.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description covers summary and tests, but it omits required template sections like Screenshots, AI Review Report, Security Audit, and Notes. Add the missing template sections, including screenshots/no visual change, the testing checklist, AI review report, security audit, and notes.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: suppressing the SSH error toast while the reconnect banner is shown.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: a3fa6eea-e340-4ed7-b1d6-0d5bcec41bfb

📥 Commits

Reviewing files that changed from the base of the PR and between f26ea6a and 77dc31f.

📒 Files selected for processing (3)
  • src/renderer/src/components/terminal-pane/TerminalErrorToast.test.ts
  • src/renderer/src/components/terminal-pane/TerminalErrorToast.tsx
  • src/renderer/src/components/terminal-pane/TerminalPane.tsx

onPtyError newline-joins multiple PTY errors into one string, so the prior
startsWith() classification misfired on aggregated errors: an unrelated error
before the SSH failure left the stale ssh:connect text to flash after reconnect,
and an SSH-first error discarded any unrelated error. Classify per line and drop
only reconnect-owned lines, keeping the rest. Closes CodeRabbit's aggregation edge.

Co-authored-by: Orca <[email protected]>
@nwparker
nwparker merged commit eec9014 into main Jul 24, 2026
3 checks passed

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: a0537349-4bbe-4c41-8a51-75e9364c1938

📥 Commits

Reviewing files that changed from the base of the PR and between 77dc31f and 955a921.

📒 Files selected for processing (3)
  • src/renderer/src/components/terminal-pane/TerminalErrorToast.test.ts
  • src/renderer/src/components/terminal-pane/TerminalErrorToast.tsx
  • src/renderer/src/components/terminal-pane/TerminalPane.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/renderer/src/components/terminal-pane/TerminalErrorToast.tsx

Comment on lines +2785 to +2793
useEffect(() => {
if (!showSshReconnectOverlay || terminalError == null) {
return
}
const kept = stripSshReconnectOwnedErrorLines(terminalError)
if (kept !== terminalError) {
setTerminalError(kept)
}
}, [showSshReconnectOverlay, terminalError])

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Sanitize while reconnect recovery is active, not only while the overlay is rendered.

showSshReconnectOverlay requires the pane to be active and visible. An inactive/hidden pane can still receive onPtyErrorRef updates, so if SSH reconnect completes before the pane is activated, this effect never strips the stored SSH failure; Lines 2906-2912 can then show a stale toast.

Use a separate sshReconnectInProgress condition based only on the target/status for sanitization, while retaining showSshReconnectOverlay for rendering, and add a regression test for this inactive-pane sequence.

Suggested adjustment
+  const sshReconnectInProgress = Boolean(
+    sshReconnectTargetId &&
+      sshReconnectStatus &&
+      sshReconnectStatus !== 'connected'
+  )
+
   useEffect(() => {
-    if (!showSshReconnectOverlay || terminalError == null) {
+    if (!sshReconnectInProgress || terminalError == null) {
       return
     }
     const kept = stripSshReconnectOwnedErrorLines(terminalError)
     if (kept !== terminalError) {
       setTerminalError(kept)
     }
-  }, [showSshReconnectOverlay, terminalError])
+  }, [sshReconnectInProgress, terminalError])
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
useEffect(() => {
if (!showSshReconnectOverlay || terminalError == null) {
return
}
const kept = stripSshReconnectOwnedErrorLines(terminalError)
if (kept !== terminalError) {
setTerminalError(kept)
}
}, [showSshReconnectOverlay, terminalError])
const sshReconnectInProgress = Boolean(
sshReconnectTargetId &&
sshReconnectStatus &&
sshReconnectStatus !== 'connected'
)
useEffect(() => {
if (!sshReconnectInProgress || terminalError == null) {
return
}
const kept = stripSshReconnectOwnedErrorLines(terminalError)
if (kept !== terminalError) {
setTerminalError(kept)
}
}, [sshReconnectInProgress, terminalError])

enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
…yai#10246)

* fix(terminal): hide SSH error toast under the reconnect banner

The z-50 TerminalErrorToast was stacking over the non-blocking SSH reconnect
banner with the raw ssh:connect failure. Suppress the toast while the banner
owns recovery and clear matching toast text so it cannot flash after reconnect.

* fix(terminal): strip only SSH-owned lines from aggregated terminal error

onPtyError newline-joins multiple PTY errors into one string, so the prior
startsWith() classification misfired on aggregated errors: an unrelated error
before the SSH failure left the stale ssh:connect text to flash after reconnect,
and an SSH-first error discarded any unrelated error. Classify per line and drop
only reconnect-owned lines, keeping the rest. Closes CodeRabbit's aggregation edge.

Co-authored-by: Orca <[email protected]>

---------

Co-authored-by: Orca <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant