Skip to content

Show a friendly error when the ImageJ plugin is not connected#202

Draft
yzx9 wants to merge 1 commit into
mainfrom
fix-plugin-not-connected
Draft

Show a friendly error when the ImageJ plugin is not connected#202
yzx9 wants to merge 1 commit into
mainfrom
fix-plugin-not-connected

Conversation

@yzx9

@yzx9 yzx9 commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator

The Agent system assumes that a plugin client is connected to the server. When the plugin is not connected correctly, the frontend currently provides no visible error message, while the only signal is a client not connected error in the logs.

This PR surfaces that connection error on the frontend so users can understand what went wrong.

A longer-term improvement would be to provide user-friendly guidance when no plugin is connected, such as installation and startup instructions (#196).

closes #164

@yzx9 yzx9 changed the base branch from dev to main July 3, 2026 02:28
When no ImageJ plugin is connected to the bridge, plugin calls used to fail
with an opaque "Plugin request failed: Client not found" and the chat stream
ended silently, leaving the user with a generic error and no idea what to do.

A dedicated PluginNotConnectedError now carries a curated, actionable message
(start Fiji with the CopilotJ plugin, wait for it to connect, then resend) and
is surfaced through the existing new:error channel as a red error post. The
leader stops retrying the failing tool instead of burning all its retries, and
prompt optimization degrades gracefully since ImageJ window info is optional
context.

Surrounding hardening so failures are never silent or leaky:
- Plugin request failures (no client, timeouts, plugin-side errors) are
  normalized into a PluginRequestError hierarchy. Raw plugin/bridge error text
  is logged server-side only and kept out of exception messages, so it cannot
  flow into the model's retry observation or the UI.
- _Thread._run_agent surfaces every agent crash to the user: the curated
  message for the not-connected case, a generic sanitized message otherwise.
- The frontend new:error handler finalizes any in-progress agent post so a
  mid-stream crash cannot leave a hanging spinner.

Tests cover the error mapping (bridge and HTTP paths, timeouts), the leader
tool-exec short-circuit, executor propagation, crash surfacing/sanitization,
and graceful prompt optimization.

Assisted-by: Claude-Code:GLM-5.2
@yzx9 yzx9 force-pushed the fix-plugin-not-connected branch from 98839af to 4be85b2 Compare July 3, 2026 03:14
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.

RuntimeError: Plugin request failed: Client not found

1 participant