Skip to content

feat: surface mid-stream gadget errors to the user - #94

Open
atharrva01 wants to merge 4 commits into
inspektor-gadget:mainfrom
atharrva01:feat/mid-stream-error-display
Open

feat: surface mid-stream gadget errors to the user#94
atharrva01 wants to merge 4 commits into
inspektor-gadget:mainfrom
atharrva01:feat/mid-stream-error-display

Conversation

@atharrva01

Copy link
Copy Markdown
Contributor

Description:
If the gadget connection drops mid-stream (pod deleted, network issue, etc.), the UI used to just freeze while still showing “Running.”

I added a dismissible inline alert on the Gadget Details page so users immediately know the stream has failed instead of guessing.

Changes:

  • Listen for WebSocket close events to catch dropped connections
  • Pass a setStreamError callback through the renderer
  • Show a MUI alert on error (auto-clears on next Start)

Before/After:

  • Before: table frozen, still “Running,” no error
image
  • After: clear “stream error” alert shown
image

@atharrva01

Copy link
Copy Markdown
Contributor Author

hi @illume @ashu8912 , I added inline error handling so gadget stream failures are surfaced to users instead of silently freezing the UI.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Surfaces mid-stream gadget/port-forward failures to users by detecting dropped WebSocket connections and displaying a dismissible inline error alert on the Gadget Details page.

Changes:

  • Listen for underlying WebSocket close events in the port-forward hook to detect transport-level disconnects.
  • Thread a setStreamError callback through renderer/callback layers to propagate stream failures up to the UI.
  • Render a MUI Alert on Gadget Details when a stream error occurs and clear it on subsequent starts.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/gadgets/igSocket.tsx Adds a raw WebSocket close listener to detect transport disconnects and update connection state.
src/common/GenericGadgetRenderer/index.tsx Passes stream error callback into gadget callbacks and raises UI stream errors on run/setup errors and disconnects.
src/gadgets/gadgetDetails.tsx Introduces streamError state and displays a dismissible MUI error alert; clears on Start/Run.
src/gadgets/utility.tsx Extends createGadgetCallbacks to report gadget errors via an optional stream error callback.
src/gadgets/resourcegadgets.tsx Minor import ordering adjustment.
src/common/GadgetContext/index.tsx Minor import ordering adjustment.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/gadgets/igSocket.tsx
Comment thread src/gadgets/igSocket.tsx Outdated
Comment thread src/common/GenericGadgetRenderer/index.tsx Outdated
@ashu8912

Copy link
Copy Markdown
Collaborator

@atharrva01 some copilot comments, can you take a look please

@atharrva01

atharrva01 commented Apr 13, 2026

Copy link
Copy Markdown
Contributor Author

@ashu8912 , the comments are resolved... PTAL

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/gadgets/utility.tsx
Comment thread src/common/GenericGadgetRenderer/index.tsx
Comment thread src/gadgets/igSocket.tsx
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.

3 participants