fix(sync): publish events on injected project bus#27825
Merged
Conversation
Contributor
There was a problem hiding this comment.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
This was referenced May 18, 2026
johnnymo87
added a commit
to johnnymo87/opencode
that referenced
this pull request
May 26, 2026
…dler The TCP listener at startListener was built via Layer.makeMemoMapUnsafe(), creating a fresh memoMap per listener. The in-process Default webHandler at toWebHandler used the shared @opencode-ai/core/effect/memo-map. Because both pipelines depend on InstanceStore.Service via InstanceLayer.layer, the distinct memoMaps caused two InstanceStore.Service instances to materialize for the same directory, splitting Question.Service pending- request maps and causing the Question tool to hang on submit. Switch the listener to the shared memoMap. Both pipelines now materialize exactly one InstanceStore.Service per directory. Verified manually on a diagnostic build (cloudbox); pre-fix log shows two 'creating instance' events for the same directory. After the fix, re-deploying the post-fix build should show one 'creating instance' event per directory. Related: PR anomalyco#27825 (sync events on injected bus) addressed a downstream symptom of this partition for the SessionEvent bus, but did not fix the underlying split that affects every InstanceState-using service. No automated regression test ships with this commit: the process-global shared memoMap is pre-populated by app-runtime.ts at module load (via ManagedRuntime.make(AppLayer, { memoMap })) before any test runs, which makes counting-bootstrap tests tautological (both pre-fix and post-fix pipelines reuse the pre-cached InstanceStore.Service). Verification is manual via the diagnostic build's 'creating instance' log events.
johnnymo87
added a commit
to johnnymo87/opencode
that referenced
this pull request
May 28, 2026
…dler The TCP listener at startListener was built via Layer.makeMemoMapUnsafe(), creating a fresh memoMap per listener. The in-process Default webHandler at toWebHandler used the shared @opencode-ai/core/effect/memo-map. Because both pipelines depend on InstanceStore.Service via InstanceLayer.layer, the distinct memoMaps caused two InstanceStore.Service instances to materialize for the same directory, splitting Question.Service pending- request maps and causing the Question tool to hang on submit. Switch the listener to the shared memoMap. Both pipelines now materialize exactly one InstanceStore.Service per directory. Verified manually on a diagnostic build (cloudbox); pre-fix log shows two 'creating instance' events for the same directory. After the fix, re-deploying the post-fix build should show one 'creating instance' event per directory. Related: PR anomalyco#27825 (sync events on injected bus) addressed a downstream symptom of this partition for the SessionEvent bus, but did not fix the underlying split that affects every InstanceState-using service. No automated regression test ships with this commit: the process-global shared memoMap is pre-populated by app-runtime.ts at module load (via ManagedRuntime.make(AppLayer, { memoMap })) before any test runs, which makes counting-bootstrap tests tautological (both pre-fix and post-fix pipelines reuse the pre-cached InstanceStore.Service). Verification is manual via the diagnostic build's 'creating instance' log events.
johnnymo87
added a commit
to johnnymo87/opencode
that referenced
this pull request
May 28, 2026
…dler The TCP listener at startListener was built via Layer.makeMemoMapUnsafe(), creating a fresh memoMap per listener. The in-process Default webHandler at toWebHandler used the shared @opencode-ai/core/effect/memo-map. Because both pipelines depend on InstanceStore.Service via InstanceLayer.layer, the distinct memoMaps caused two InstanceStore.Service instances to materialize for the same directory, splitting Question.Service pending- request maps and causing the Question tool to hang on submit. Switch the listener to the shared memoMap. Both pipelines now materialize exactly one InstanceStore.Service per directory. Verified manually on a diagnostic build (cloudbox); pre-fix log shows two 'creating instance' events for the same directory. After the fix, re-deploying the post-fix build should show one 'creating instance' event per directory. Related: PR anomalyco#27825 (sync events on injected bus) addressed a downstream symptom of this partition for the SessionEvent bus, but did not fix the underlying split that affects every InstanceState-using service. No automated regression test ships with this commit: the process-global shared memoMap is pre-populated by app-runtime.ts at module load (via ManagedRuntime.make(AppLayer, { memoMap })) before any test runs, which makes counting-bootstrap tests tautological (both pre-fix and post-fix pipelines reuse the pre-cached InstanceStore.Service). Verification is manual via the diagnostic build's 'creating instance' log events.
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.
Summary
/eventsubscribers see sync-backed events likemessage.part.updated.Verification
bun test test/sync/index.test.ts --timeout 30000bun typecheck