fix: log plugin load failures to stderr - #41818
Conversation
Plugin load errors are only published as a Session.Event.Error, which the desktop renderer does not consume. Desktop users saw plugin entries in the list without any indication that loading failed (e.g. plugins importing "bun:sqlite" on the Node host). Write the error to stderr so it lands in the server log. Addresses anomalyco#41817
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
|
This PR doesn't fully meet our contributing guidelines and PR template. What needs to be fixed:
Please edit this PR description to address the above within 2 hours, or it will be automatically closed. If you believe this was flagged incorrectly, please let a maintainer know. |
|
The following comment was made by an LLM, it may be inaccurate: Potentially Related PR Found:
However, PR #37411 is about publishing the event (which PR #41818 already does), not about logging to stderr for visibility in desktop logs. The current PR (41818) is a different approach focused on stderr logging. Conclusion: No true duplicate PRs found. PR #37411 is related but addresses a different aspect (TUI event publishing vs. desktop stderr logging). |
|
Hmm will fix the PR tomorrow |
|
This pull request has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window. Feel free to open a new pull request that follows our guidelines. |
|
2 hour ... |
Issue for this PR
Closes #41817
Type of change
What does this PR do?
Plugin load errors are only published as a
Session.Event.ErrorinpublishPluginError(packages/opencode/src/plugin/index.ts). The desktop renderer does not consume that event, so a plugin that fails to load in the desktop app is invisible: the entry appears in the plugin list, nothing is logged, and no tools register. Example: plugins importingbun:sqliteon the Node plugin host (see #41817).Change:
publishPluginErroralso writes the message to stderr, which the desktop sidecar pipes into the server log, so failures are diagnosable.The
bun:sqliteshim itself is tracked separately in #41817.How did you verify your code works?
Could not run the desktop build locally (no Node/pnpm toolchain in the environment). The change is a one-line addition to the existing error path, using the Node
process.stderrAPI; the existing event publish is untouched.Screenshots / recordings
N/A (no UI change).
Checklist