Skip to content

refactor: add Effect-returning versions of MessageV2 functions#20374

Merged
kitlangton merged 3 commits intodevfrom
worktree-effectify-message-v2
Apr 1, 2026
Merged

refactor: add Effect-returning versions of MessageV2 functions#20374
kitlangton merged 3 commits intodevfrom
worktree-effectify-message-v2

Conversation

@kitlangton
Copy link
Copy Markdown
Contributor

Summary

  • Extract sync cores (partsSync, getSync, pageSync) from MessageV2 DB functions that were unnecessarily async (all Database.use calls are synchronous)
  • Add 6 new Effect.fn exports: partsEffect, getEffect, pageEffect, streamEffect, filterCompactedEffect, toModelMessagesEffect
  • Replace all 16 Effect.promise(() => MessageV2.*) call sites with direct yield* calls across processor, prompt, compaction, session index, and tests

Test plan

  • bun run test -- test/session/processor-effect — 10/10 pass
  • bun run test -- test/session/prompt-effect — 25/25 pass
  • bun run test -- test/session/ — 180/180 pass (4 skipped)
  • Typecheck passes across all 13 packages

Extract sync cores (partsSync, getSync, pageSync) from MessageV2 DB
functions and add Effect.fn wrappers: partsEffect, getEffect, pageEffect,
streamEffect, filterCompactedEffect, toModelMessagesEffect.

Replace all Effect.promise(() => MessageV2.*) call sites in processor,
prompt, compaction, session index, and tests with direct yield* calls.
@kitlangton kitlangton force-pushed the worktree-effectify-message-v2 branch from 428e2cd to af3f77f Compare April 1, 2026 01:33
@kitlangton kitlangton added the beta label Apr 1, 2026
opencode-agent bot added a commit that referenced this pull request Apr 1, 2026
opencode-agent bot added a commit that referenced this pull request Apr 1, 2026
opencode-agent bot added a commit that referenced this pull request Apr 1, 2026
opencode-agent bot added a commit that referenced this pull request Apr 1, 2026
opencode-agent bot added a commit that referenced this pull request Apr 1, 2026
opencode-agent bot added a commit that referenced this pull request Apr 1, 2026
opencode-agent bot added a commit that referenced this pull request Apr 1, 2026
opencode-agent bot added a commit that referenced this pull request Apr 1, 2026
opencode-agent bot added a commit that referenced this pull request Apr 1, 2026
@kitlangton kitlangton force-pushed the worktree-effectify-message-v2 branch 2 times, most recently from 6c2567a to e63e049 Compare April 1, 2026 14:38
opencode-agent bot added a commit that referenced this pull request Apr 1, 2026
… pagination

- Remove partsEffect/getEffect/pageEffect; call sync functions directly
- Convert streamMessages to lazy Stream.paginate (chunk-efficient)
- Add filterCompactedMessages using Stream.takeUntil on the stream
- Make toModelMessagesEffect the primary impl, derive promise version
@kitlangton kitlangton force-pushed the worktree-effectify-message-v2 branch from e63e049 to 05d2aa5 Compare April 1, 2026 15:49
opencode-agent bot added a commit that referenced this pull request Apr 1, 2026
…overage

43 tests covering sync DB functions, cursor pagination, session isolation,
compaction boundaries, and cross-function consistency.
opencode-agent bot added a commit that referenced this pull request Apr 1, 2026
opencode-agent bot added a commit that referenced this pull request Apr 1, 2026
opencode-agent bot added a commit that referenced this pull request Apr 1, 2026
opencode-agent bot added a commit that referenced this pull request Apr 1, 2026
opencode-agent bot added a commit that referenced this pull request Apr 1, 2026
@kitlangton kitlangton merged commit 26fb6b8 into dev Apr 1, 2026
8 checks passed
@kitlangton kitlangton deleted the worktree-effectify-message-v2 branch April 1, 2026 23:48
jeromelau pushed a commit to jeromelau/opencode that referenced this pull request Apr 2, 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