GeezerVison is showing github.com — Fix OpenCode events on versions greater than 1.14.40 by samjandris · Pull Request #2673 · pingdotgg/t3code
Conversation
samjandris
commented
May 13, 2026
•
edited by macroscopeapp
Bot
Loading
Uh oh!
There was an error while loading. Please reload this page.
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 for commit 335fe3f. Bugbot is set up for automated code reviews on this repo. Configure here.
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.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
coderabbitai
Bot
commented
May 13, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
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:
✨ 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.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
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.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
samjandris
changed the title
Fix OpenCode events > 1.40
Fix OpenCode events on versions greater than 1.40
May 20, 2026
samjandris
changed the title
Fix OpenCode events on versions greater than 1.40
Fix OpenCode events on versions greater than 1.14.40
May 20, 2026
duncan4123
pushed a commit
to duncan4123/t3code
that referenced
this pull request
Jun 1, 2026
Cherry-pick upstream PR pingdotgg#2673 from pingdotgg/t3code.
OpenCode CLI >= 1.14.40 changed the event format: SSE events are now
wrapped in a { directory, payload } envelope via the /global/event
endpoint. The legacy event.subscribe() stream is empty on newer
versions, causing ALL events to be silently dropped.
Changes:
- Switch event subscription from client.event.subscribe() to
client.global.event(), which emits global-scoped wrapped events
- Filter events by directory to match the session working directory,
preventing cross-session event contamination
- Unwrap payload from the envelope before passing to
handleSubscribedEvent()
- Update OpenCodeSubscribedEvent type to extract payload from
global event stream
Test changes:
- Add global.event mock to OpenCodeRuntimeTestDouble with abortable
async iterator and keep-alive support
- Add toGlobalEvent() helper to wrap raw events in { directory, payload }
- New test: "streams current OpenCode global event payloads for the
session directory" — verifies directory filtering, global event
stream usage, and that content.delta events reach the adapter
duncan4123
pushed a commit
to duncan4123/t3code
that referenced
this pull request
Jun 1, 2026
The cherry-pick of PR pingdotgg#2673 introduced a duplicate global property
in the OpenCodeRuntimeTestDouble object literal. The main branch
(t3-29f.9) already has a more complete global.event mock with
globalEventError support. Keep that one, remove the simpler
duplicate.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Labels
size:S
10-29 changed lines (additions + deletions).
vouch:unvouched
Author is not yet trusted in the VOUCHED list.
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
[Bug]: OpenCode not syncing/working
Uh oh!
There was an error while loading. Please reload this page.
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.
|