Skip to content
Source
Sign inSign up
pingdotgg/t3code

Fix OpenCode events on versions greater than 1.14.40 #2673

Closedsamjandris(GitHub profile, opens in a new tab)wants to merge 4 commits intomain fromrefs/pull/2673/headopened View on GitHub

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

Medium Risk Changes the sole runtime event subscription path for OpenCode sessions; incorrect directory filtering or payload handling would break streaming or drop events for other workspaces on a shared server.

Overview Fixes OpenCode assistant streaming on runtimes where the legacy /event stream is empty (e.g. versions after 1.14.40) by subscribing to client.global.event instead of event.subscribe.

The event pump now ignores global envelopes whose directory does not match the session cwd and forwards only event.payload into the existing handleSubscribedEvent path. OpenCodeSubscribedEvent is retargeted to that payload type.

Tests mock global.event (with optional keep-alive), make event.subscribe fail if used, and add coverage that directory-scoped global message.* events produce content.delta for the active turn.

Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 335fe3f6358af1eb5ad52adf15d322b279a26415. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).

Note

Fix OpenCode event streaming to use global.event for versions greater than 1.14.40

  • Switches the event pump in OpenCodeAdapter.ts from client.event.subscribe to client.global.event, passing the session AbortSignal.
  • Adds directory-based filtering so only events matching the session's working directory are processed; handlers now receive event.payload instead of the raw wrapper.
  • Updates the OpenCodeSubscribedEvent type to extract the payload from events with a payload field, matching the new API shape.
  • Adds a test in OpenCodeAdapter.test.ts that verifies global.event is called once and that message.updated/message.part.updated events produce the correct content.delta output.
Macroscope summarized 335fe3f.
    1. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched

    2. coderabbitai[bot](GitHub profile, opens in a new tab)commented

      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: 4aa399ec-0e96-45b8-8465-288f55791446

      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.
    3. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      Approvability

      Verdict: Approved

      This is a targeted bug fix migrating from the event.subscribe API to global.event API for compatibility with newer OpenCode versions (>1.14.40). The change adds directory-based filtering to handle the new event wrapper format, with corresponding test coverage added.

      You can customize Macroscope's approvability policy. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).

Sign in to join this conversation.