Repository navigation
fix: set OpenCode activity markers from session.execution events - #4850
Merged
Merged
Conversation
OpenCode 2.3 stopped emitting session.status and session.idle, so the
OpenCode 2 watcher never set a marker. Its replacements,
session.execution.{started,succeeded,failed,interrupted}, carry only a
session ID, so the plugin looks the session up to find its worktree and
skips subagent sessions, whose finishing would otherwise flip a working
parent to waiting.
Refs #4849
1 task
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 free
to 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.
OpenCode 2.3 stopped emitting
session.statusandsession.idle, the two events the plugin's OpenCode 2 watcher sets markers from, sowt listnever shows 🤖 or 💬 there. The watcher now also handlessession.execution.started(🤖) andsucceeded/failed/interrupted(💬). Those events carry only asessionID, so the plugin looks the session up withcontext.session.getand marks only when the session'slocation.directoryis this instance's worktree and the session has noparentID. Without theparentIDcheck, a subagent finishing would flip a still-working parent to 💬. The oldsession.status/session.idlecases stay for earlier OpenCode 2 hosts, and the OpenCode 1serverpath is unchanged.The event names and shapes come from OpenCode v2.3.2's source:
packages/schema/src/session-event.tsdefines the four execution events with onlysessionID, its e2e helper mapsbusy/idleontoexecution.started/succeeded, andSession.InfocarrieslocationandparentID. I drovesetup()under Node with a fake context and a fakewtthat logs its calls. Before this change the event sequence produced only the teardownclear. After it, the parent session sets 🤖 then 💬, and execution events from a subagent, from a session in another worktree, and for a deleted session set nothing. The existing OpenCode integration tests pass. Not verified: the plugin running inside a live OpenCode 2.3 host. The reporter tested a near-identical patch live on 2.3.2.What this leaves from #4849: finding 3, the duplicate plugin instances per directory racing on
git config. That isn't addressed. Both instances write the same marker, the losing write's error is already swallowed, and whether a module-level refcount would even be shared across OpenCode's two loaders isn't something I could check here.Refs #4849 — automated triage