-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Description
Description
Several robustness gaps in the plugin system and session prompt paths cause crashes, silent errors, or unexpected behavior when building plugins:
-
Agent/command resolution crashes with TypeError on invalid names —
Agent.get()andCommand.get()returnundefinedfor unknown names, but callers at 5 sites insession/prompt.tsdereference without null checks. This produces an untypedTypeError: Cannot read properties of undefinedinstead of a helpful typed error. -
prompt_asyncroute silently drops errors — The/:sessionID/prompt_asyncroute callsSessionPrompt.prompt()without.catch(), so failures in detached prompts are silently lost with no logging and noSession.Event.Errorpublished. -
Plugin config hook errors crash entire bootstrap — A single plugin's
confighook throwing prevents all subsequent hooks from running. There is no error isolation between hooks inPlugin.init(). -
command.execute.beforehook receives merged parts — The hook fires after template parts are already merged withinput.parts, making it difficult for plugins to cleanly replace or transform template content without fragile index-based manipulation. -
Plugins added by config hooks not loaded in same startup pass — When a plugin's
confighook adds entries toconfig.plugin, the newly referenced plugins are not loaded becausePlugin.state()has already resolved and is cached viaInstance.state().
Plugins
N/A — affects core plugin infrastructure, not a specific plugin.
OpenCode version
v1.2.27 (current dev branch)
Steps to reproduce
- Call
SessionPrompt.prompt({ agent: "nonexistent" })→ crashes withTypeError: Cannot read properties of undefined (reading 'model')instead of a typed error - Trigger a model/agent mismatch error via the
prompt_asyncroute → caller sees no error; nothing logged, noSession.Event.Errorpublished - Install a plugin whose
confighook throws → all subsequent plugin config hooks are skipped entirely - Register a
command.execute.beforehook and inspectoutput.parts→ contains both template parts and caller-providedinput.partsalready merged - In a plugin's
confighook, push a new plugin path toconfig.plugin→ the added plugin is not loaded during that startup pass
Screenshot and/or share link
No UI changes — these are internal plugin/session API issues.
Operating System
All platforms (macOS, Linux, Windows)
Terminal
All terminals — not terminal-specific