Uh oh!
There was an error while loading. Please reload this page.
fix: re-emit session_start after plugin init to fix missed handshake race - #25
Open
morozsm wants to merge 1 commit into
Open
fix: re-emit session_start after plugin init to fix missed handshake race#25morozsm wants to merge 1 commit into
morozsm wants to merge 1 commit into
Conversation
…race) Warp dismisses its "Install Warp Plugin" instructions only after receiving the session_start handshake, which is emitted exclusively on session.created. Because plugin init is async, session.created can fire before the plugin's event handlers are registered, so the handshake is never sent and Warp keeps showing the setup instructions even though the plugin is loaded and working (warpdotdev#17, warpdotdev#18). After init, re-emit session_start for the most recent top-level session via client.session.list(), deferred by 2s (past event-bus attach; calling client.session.list synchronously during init can hang). A dedup flag skips the re-emit when the session.created handler already sent the handshake, so no double notifications occur. Fixeswarpdotdev#17 Refs warpdotdev#18, warpdotdev#11 Co-Authored-By: Oz <oz-agent@warp.dev>
morozsm
commented
Aug 17, 2026
Author
Thanks for checking this. Confirming this is still reproducible on latest stable (Warp 0.2026.08.05 + OpenCode 1.18.18), and PR #25 fixes it locally end-to-end (setup chip clears; notifications work). Happy to adjust anything needed for merge. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
session.createdis the only event that emits thesession_starthandshake, and it's what tells Warp the plugin is installed (dismisses the "Install Warp Plugin for OpenCode" instructions chip). However, plugin init is async: on the opencode versions we tested,session.createdfires before the plugin's event handlers are registered, so the handshake is never sent and Warp keeps showing the setup instructions even though the plugin loads fine (Warp plugin initializedin the logs) and is listed inopencode.json.Reproduced on macOS 26 (arm64), Warp v0.2026.08.05 stable, OpenCode 1.18.18, plugin 0.1.7 — same symptoms as #17, and the same root cause as the timing bug described in #18 (which also author-confirmed this fix approach on WSL). Likely explains #11 as well.
Fix
After successful init, re-emit
session_startfor the most recent top-level session viaclient.session.list():client.session.listsynchronously during plugin init can hang.sessionStartSent) set by thesession.createdhandler suppresses the re-emit when the event was caught normally, so there's never a double notification.parentIDare skipped when picking the handshake session, consistent with the subagent suppression in the rest of the plugin.Test plan
tests/deferred-session-start.test.ts: deferred emit fires whensession.createdwas never handled; dedup suppresses it when it was; subagent sessions are skipped when choosing the handshake session.bun test— 28 pass / 0 fail;bun run typecheckclean;bun run buildclean.prompt_submit/stop/permission_requestnotifications work.Fixes#17. Refs #18, #11.
Co-Authored-By: Oz oz-agent@warp.dev