Skip to content

fix(event_manager): prevent duplicate listeners on restart#278

Merged
sudo-tee merged 1 commit intosudo-tee:mainfrom
jensenojs:pr/event-manager-dedupe
Feb 17, 2026
Merged

fix(event_manager): prevent duplicate listeners on restart#278
sudo-tee merged 1 commit intosudo-tee:mainfrom
jensenojs:pr/event-manager-dedupe

Conversation

@jensenojs
Copy link
Contributor

EventManager:start() was registering anonymous state.opencode_server listeners that couldn't be unsubscribed. On restart (e.g., during UI toggle), multiple listeners would accumulate, causing duplicate event handling.

Store listener reference to enable proper unsubscribe/resubscribe cycle.

@sudo-tee
Copy link
Owner

Thanks for the PR

I am away today. I will review this and test tomorrow

@sudo-tee
Copy link
Owner

@jensenojs

Thanks for the fix.

Although the bug is here, in practice the even_manager is only started one due to this check

image

But if we were to use the stop function in the future we could end up in this situation.

@sudo-tee sudo-tee merged commit 70e3c6f into sudo-tee:main Feb 17, 2026
5 checks passed
@jensenojs jensenojs deleted the pr/event-manager-dedupe branch February 17, 2026 15:13
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.

2 participants