Show a friendly error when the ImageJ plugin is not connected#202
Draft
yzx9 wants to merge 1 commit into
Draft
Conversation
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
98839af to
4be85b2
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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