refactor(session): effectify SessionCompaction service#19459
Merged
kitlangton merged 6 commits intodevfrom Mar 28, 2026
Merged
Conversation
13399ab to
92b79ba
Compare
Migrate SessionCompaction to Effect service pattern with Bus.Service and Config.Service as layer dependencies. Bus.publish for Compacted event now goes through the Effect service instead of raw call.
92b79ba to
9ecf822
Compare
Pure structural refactor — no Effect yet. Extracts the switch statement into a standalone handleEvent function and the cleanup section into a cleanup function. ProcessorContext object shares mutable state via getters/setters. Zero behavior change (verified by two review agents).
Replace the while(true) + for-await + try/catch pattern with: - Stream.fromAsyncIterable + Stream.runForEachWhile for event consumption - Recursive Effect for retry logic (preserves SessionRetry.delay backoff) - Effect.ensuring for cleanup guarantees - Effect.catch for error classification process() still returns Promise externally (via Effect.runPromise) so callers don't change. Event handling and cleanup logic unchanged.
d4ef6a4 to
6fbaed2
Compare
Copilot AI
pushed a commit
to ian-morgan99/opencode
that referenced
this pull request
Mar 28, 2026
Co-authored-by: ian-morgan99 <[email protected]>
e-n-0
pushed a commit
to e-n-0/opencode
that referenced
this pull request
Mar 29, 2026
loocor
pushed a commit
to loocor/opencode
that referenced
this pull request
Mar 30, 2026
afanty2021
pushed a commit
to afanty2021/opencode
that referenced
this pull request
Mar 30, 2026
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
Compactedevent now goes through Effect Bus.Serviceprocess()body kept as Effect.promise (complex async with Agent/Provider/Plugin calls)isOverflowandprunefully effectified with config.get() via EffectTest plan
bun run typecheckpassesbun run test— 1596 pass, 0 fail