Skip to content

fix: set OpenCode activity markers from session.execution events - #4850

Merged
max-sixty merged 1 commit into
mainfrom
fix/issue-4849
Nov 19, 2026
Merged

max-sixty merged 1 commit into
mainfrom
fix/issue-4849

Conversation

@worktrunk-bot

Copy link
Copy Markdown
Collaborator

OpenCode 2.3 stopped emitting session.status and session.idle, the two events the plugin's OpenCode 2 watcher sets markers from, so wt list never shows 🤖 or 💬 there. The watcher now also handles session.execution.started (🤖) and succeeded / failed / interrupted (💬). Those events carry only a sessionID, so the plugin looks the session up with context.session.get and marks only when the session's location.directory is this instance's worktree and the session has no parentID. Without the parentID check, a subagent finishing would flip a still-working parent to 💬. The old session.status / session.idle cases stay for earlier OpenCode 2 hosts, and the OpenCode 1 server path is unchanged.

The event names and shapes come from OpenCode v2.3.2's source: packages/schema/src/session-event.ts defines the four execution events with only sessionID, its e2e helper maps busy/idle onto execution.started/succeeded, and Session.Info carries location and parentID. I drove setup() under Node with a fake context and a fake wt that logs its calls. Before this change the event sequence produced only the teardown clear. 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

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automated-fix Automated CI fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants