Skip to content

Fix OpenCode event session routing#2673

Open
samjandris wants to merge 1 commit into
pingdotgg:mainfrom
samjandris:fix/opencode-event-stream
Open

Fix OpenCode event session routing#2673
samjandris wants to merge 1 commit into
pingdotgg:mainfrom
samjandris:fix/opencode-event-stream

Conversation

@samjandris
Copy link
Copy Markdown

@samjandris samjandris commented May 13, 2026

Summary

  • switch OpenCode runtime events from the now-empty /event stream to /global/event
  • unwrap global event payloads for the active session directory before using the existing provider event projection
  • add regression coverage that the adapter uses the global event stream and handles wrapped OpenCode message events

Fixes #2633

Replaces #2634, which was closed while still pointing at the old fork branch name.

Test plan

  • bun fmt
  • bun lint
  • bun typecheck
  • bun run --cwd apps/server test src/provider/Layers/OpenCodeAdapter.test.ts

Note

Cursor Bugbot is generating a summary for commit f4137b5. Configure here.

Note

Fix OpenCode event session routing by filtering global events by directory

  • Switches the event subscription in OpenCodeAdapter.ts from client.event.subscribe to client.global.event, which emits events for all directories.
  • Adds directory-based filtering so only events whose directory matches the session's working directory are forwarded to the event handler.
  • Updates the OpenCodeSubscribedEvent type alias to extract the payload field from global events, resolving to never for events without a payload.
  • Test doubles in OpenCodeAdapter.test.ts are updated to simulate long-lived, abortable global event streams and assert directory-scoped filtering behavior.
  • Behavioral Change: event.subscribe is no longer used; the adapter now receives all directory events globally and filters client-side.

Macroscope summarized f4137b5.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels May 13, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 13, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: ef9ea749-2967-4018-b194-d7a5ac557c3c

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@macroscopeapp
Copy link
Copy Markdown
Contributor

macroscopeapp Bot commented May 13, 2026

Approvability

Verdict: Needs human review

This PR changes the event subscription model from session-scoped (event.subscribe) to global events (global.event) with directory-based filtering. While well-tested, this is a significant runtime behavior change that affects how all OpenCode sessions receive events and warrants human verification.

You can customize Macroscope's approvability policy. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: OpenCode not syncing/working

1 participant