You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Plugin event listener for "session.created" not firing #14808
Plugins that subscribe to the event bus are not receiving the session.created event. The event is published but plugins don't respond.
Plugins
Custom plugin in ~/.config/opencode/plugins/engram.ts (Engram memory system)
OpenCode version
1.2.10
Steps to reproduce
Create a plugin that listens to session.created via the event property
Start a new OpenCode session
Plugin doesn't receive the event
Screenshot and/or share link
Evidence: Engram does not activate automatically
Problem
According to AGENTS.md, mem_session_start should execute automatically at the start of each session.
But it doesn't happen - the user had to call it manually.
Log Evidence (opencode_session_created_bug.log)
Line 15 - Plugin loads:
INFO service=plugin path=...engram.ts loading plugin
Line 55 - MCP detected:
INFO service=mcp key=engram type=local found
Line 78 - MCP created:
INFO service=mcp key=engram toolCount=14 create() successfully created client
Lines 89-90 - ERRORS (here's the problem):
ERROR service=mcp clientName=engram error=MCP error -32601: prompts not supported
ERROR service=mcp clientName=engram error=MCP error -32601: resources not supported
Line 96 - OpenCode session created (without Engram):
INFO service=session id=ses_... created
Line 329 - ONLY HERE mem_session_start is called (manual):
INFO service=permission permission=engram_mem_session_start pattern=* ... evaluated
Conclusion
Engram plugin loads
There are MCP errors (prompts/resources not supported)
OpenCode session is created
mem_session_start is NEVER executed automatically
It only executes when the user calls it manually (line 329)
Possible Cause
The -32601 errors on lines 89-90 suggest that the Engram plugin does not support
some MCP methods that OpenCode expects, wh
Operating System
ubuntu 22
Terminal
Alacritty
Reacted by rich-jojo, Zac Brechbill, EFEX, Aleksandr Kriuchkov, Wow, Diego Do Santos, Hariz Hafidz, Kaza Naga Sai Vishnu, kraevski, Jean and 4 more
Reacted by Lars Beckmann, zhu jianjiang, Karsten Gresch, Alvin Ashiatey, Ravi Shah, Vicary, Brandon Martin, mejobloggs, Fellipe Utaka, ejs and 10 more
Reacted by Mert Köseoğlu, Karsten Gresch, Ravi Shah, Brandon Martin, Ivan Mondragon, Fellipe Utaka, Abdelrahman Zaki, Pratik Thapa, pumicestone and Oscar Serna
Hey everyone! 👋 While we wait for the official fix to get merged, I built a workaround plugin opencode-enforce-context-mode so you can still use context-mode properly despite the session.created bug.
It solves the problem using two steps:
Proactive Guidance: It bypasses the broken hook by using experimental.chat.messages.transform to inject the environment constraints directly into the first user message, so the AI knows to use ctx_* tools immediately.
Aggressive Enforcement: If the AI still attempts to run a forbidden native command (like grep or curl), it gets blocked by a fatal system directive that forces immediate compliance and redirects it to the correct context-mode alternative.
Just a friendly ping. Is #17517 ready to merge and fix this? Or is there something that still needs to be fixed beyond that?
Just asking because I'd like to play with that context-mode plugin but i kinda feel it becomes a messy situation if i need another plugin just to workaround a bug.
Activity
fidelix commentedon Mar 8, 2026
FYI this is needed for https://github.com/mksglu/context-mode
zjjott commentedon Mar 11, 2026
+1
fix: await plugin event hooks and handle errors in database effects
fix: await plugin event hooks and handle errors in database effects
zahidinho commentedon Mar 23, 2026
+1
mikij commentedon Mar 28, 2026
+1 cmon, we need this ASAP
onedaxter commentedon Mar 28, 2026
+1
CODLOP commentedon Mar 28, 2026
+1
debanjanbasu commentedon Mar 29, 2026
+1
TheOrdinaryWow commentedon Apr 2, 2026
+1
Drumpy commentedon Apr 8, 2026
+1
kazablock commentedon Apr 15, 2026
+1
tarurar commentedon Apr 18, 2026
+1
jfortez commentedon Apr 20, 2026
+1
pratikthapw commentedon Apr 21, 2026
+1
lbzepoqo commentedon Apr 23, 2026
+1
pumicestone commentedon Apr 23, 2026
+1
AbdelrhmanUZaki commentedon Apr 24, 2026
Hey everyone! 👋 While we wait for the official fix to get merged, I built a workaround plugin opencode-enforce-context-mode so you can still use
context-modeproperly despite thesession.createdbug.It solves the problem using two steps:
Proactive Guidance: It bypasses the broken hook by using experimental.chat.messages.transform to inject the environment constraints directly into the first user message, so the AI knows to use ctx_* tools immediately.
Aggressive Enforcement: If the AI still attempts to run a forbidden native command (like grep or curl), it gets blocked by a fatal system directive that forces immediate compliance and redirects it to the correct context-mode alternative.
markg85 commentedon Apr 25, 2026
Just a friendly ping. Is #17517 ready to merge and fix this? Or is there something that still needs to be fixed beyond that?
Just asking because I'd like to play with that context-mode plugin but i kinda feel it becomes a messy situation if i need another plugin just to workaround a bug.
techieanant commentedon May 3, 2026
+1
rekram1-node commentedon May 4, 2026
I cannot replicate this issue, here is an example plugin, the toast does fire when new sessions are created.
If someone can send me minimal repro or show how this doesnt work for them ill reopen