Skip to content

feat(plugins): show each plugin's session state and report RPC startup - #400

Merged
fcoury merged 2 commits into
mainfrom
fix/plugin-status-visibility
Oct 15, 2026
Merged

fcoury merged 2 commits into
mainfrom
fix/plugin-status-visibility

Conversation

@fcoury

@fcoury fcoury commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #397.

Why

#396 made a quarantine visible when it happens: an error notice, closed dialogs, and commands that explain why they're unavailable. Two gaps from #392 remained:

  • There was nowhere to check plugin state later. Once the notice was gone, nothing in the editor said which plugins were running and which had been stopped. red plugin list can't tell you either: it runs as its own process and only reads the config.
  • A JSON-RPC plugin that's slow to start looked dead. Running the command of a plugin that never answers initialize showed nothing for 5 seconds. Running it again said RPC plugin silent is busy, which is wrong: the plugin hadn't started yet.

While reproducing this I found a third problem. When an RPC plugin's executable couldn't be started, the quarantine reason was only failed to start RPC plugin, with no cause in the notice or in red.log.

What changed

  • :plugin-status (also in the command palette as "Plugin status") opens a picker that lists every configured plugin as quarantined, active with a rejected reload, starting, active, loads on first use, or disabled. Problems are listed first. Plugins turned off with disabled_plugins (or agent under disable_ai) are listed last as disabled. The config now keeps their paths, because they used to be dropped before the registry saw them. Each row shows the plugin's source, or for a problem the stage and first line of the reason. The preview shows the full diagnostic and what to do about it, wrapped to fit the narrowest side-by-side preview pane. The quarantine notice now points to :plugin-status.
  • Startup feedback for lazy RPC plugins. The command that starts the plugin shows plugin silent is starting; Silent runs once it is ready. A second command during the handshake says plugin silent is still starting and already has a command waiting, instead of busy. If an event started the plugin, it says the plugin is handling that event. When the 5-second deadline passes, the existing quarantine notice appears.
  • Spawn failures keep their cause, for example failed to start RPC plugin red-missing-plugin-binary: No such file or directory (os error 2). Quarantine reasons show only the outermost error message, so the cause is now part of that message instead of being dropped.
  • I didn't add quarantine state to red plugin list. It would need state saved from a previous session, with the stale-state problems that brings, so the in-editor view replaces it.
  • Docs: docs/PLUGIN_API.md describes :plugin-status. docs/RPC_PLUGIN_PROTOCOL.md now documents the 5-second initialize deadline and what a user sees while a lazy plugin starts.
  • Test fix: three assertions in tests/rpc_connection/editor.rs checked that plugin- was absent from the whole screen. The status line shows the Git branch, so they failed on any branch with plugin- in its name, including this one. They now check only the document area.

How to Test

  1. Make a JSON-RPC plugin that never answers. In an empty directory silent/, create silent.sh:

    #!/bin/sh
    while read line; do :; done

    and red-plugin.toml:

    [plugin]
    id = "silent"
    name = "Silent"
    version = "0.1.0"
    red_api = "^0.19.0"
    
    [rpc]
    command = "sh"
    args = ["silent.sh"]
    
    [activation]
    commands = ["Silent"]
  2. Add silent = "/absolute/path/to/silent/red-plugin.toml" to [plugins] in your config.toml, and start Red.

  3. Run :Silent. The bottom line shows plugin silent is starting; Silent runs once it is ready. Before this change it stayed blank.

  4. Within 5 seconds, run :Silent again. It warns plugin silent is still starting and already has a command waiting…. Before this change it said RPC plugin silent is busy.

  5. After 5 seconds the notice silent: stopped for this session: RPC request initialize timed out after 5000 ms appears.

  6. Run :plugin-status. silent is listed first as quarantined, with activation: RPC request initialize timed out after 5000 ms, and the preview shows the full reason. The bundled plugins are listed as active.

  7. Regression check, a bad executable: change command = "sh" to command = "red-missing-plugin-binary", restart Red and run :Silent. The notice and the :plugin-status preview say No such file or directory. Before, they said only failed to start RPC plugin.

Tests:

  • lazy_initialization_keeps_input_responsive in tests/rpc_connection now checks the starting message, the still-starting warning, and that :plugin-status shows starting while initialize is blocked.
  • status_rows_describe_each_plugin_in_configuration_order covers active, loads-on-first-use, quarantined and disabled plugins.
  • starting_rpc_conflict_names_what_the_plugin_is_waiting_on covers both still-starting warnings.
  • quarantined_plugin_shows_its_stage_and_full_reason, healthy_plugins_show_their_source and wrapped_preview_lines_keep_their_indentation cover the picker rows and preview.

Add :plugin-status, a picker listing every configured plugin as active,
starting, loading on first use, disabled, or quarantined, with the stage
and full reason for each quarantine. A command that starts a lazy RPC
plugin now says the plugin is starting, and a second command during the
handshake says it is still starting instead of busy. RPC spawn failures
keep the OS error in the quarantine reason.

Fixes #397
@fcoury

fcoury commented Oct 15, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-15T19:04:57.288492Z 488003b Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 488003ba83

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/plugin/registry.rs Resolved
Comment thread src/plugin/registry.rs Resolved
…rtup

Disabled plugins were removed from the config before registration, so
:plugin-status never listed them. Keep their paths and list them as
disabled. A command sent while an event is starting an RPC plugin now
says so instead of claiming a command is already waiting.
@fcoury
fcoury merged commit e342145 into main Oct 15, 2026
21 checks passed
@fcoury
fcoury deleted the fix/plugin-status-visibility branch October 15, 2026 19:26
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.

Show quarantined plugins and their reasons outside the notice

1 participant