Skip to content

refactor(session): effectify SessionCompaction service#19459

Merged
kitlangton merged 6 commits intodevfrom
worktree-effectify-provider
Mar 28, 2026
Merged

refactor(session): effectify SessionCompaction service#19459
kitlangton merged 6 commits intodevfrom
worktree-effectify-provider

Conversation

@kitlangton
Copy link
Copy Markdown
Contributor

Summary

  • Migrate SessionCompaction to Effect service pattern (Service, Interface, layer, defaultLayer)
  • Bus.publish for Compacted event now goes through Effect Bus.Service
  • Config access goes through Effect Config.Service
  • process() body kept as Effect.promise (complex async with Agent/Provider/Plugin calls)
  • isOverflow and prune fully effectified with config.get() via Effect

Test plan

  • bun run typecheck passes
  • bun run test — 1596 pass, 0 fail
  • CI

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.
@kitlangton kitlangton force-pushed the worktree-effectify-provider branch from 92b79ba to 9ecf822 Compare March 27, 2026 21:54
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.
@kitlangton kitlangton force-pushed the worktree-effectify-provider branch from d4ef6a4 to 6fbaed2 Compare March 28, 2026 00:53
@kitlangton kitlangton marked this pull request as ready for review March 28, 2026 01:01
@kitlangton kitlangton enabled auto-merge (squash) March 28, 2026 01:01
@kitlangton kitlangton merged commit 2145d97 into dev Mar 28, 2026
8 checks passed
@kitlangton kitlangton deleted the worktree-effectify-provider branch March 28, 2026 01:09
Copilot AI pushed a commit to ian-morgan99/opencode that referenced this pull request Mar 28, 2026
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant