Skip to content

refactor(effect): yield services instead of promise facades#19325

Merged
kitlangton merged 2 commits intodevfrom
effect/yield-services
Mar 27, 2026
Merged

refactor(effect): yield services instead of promise facades#19325
kitlangton merged 2 commits intodevfrom
effect/yield-services

Conversation

@kitlangton
Copy link
Copy Markdown
Contributor

Summary

  • Effectified services now yield other effectified services directly via their Effect interface instead of going through async promise facades (Effect.promise(() => Service.method())). This keeps the full call chain within the Effect runtime.
  • Config is the biggest beneficiary — 7 services were calling Config.get() through a promise wrapper
  • CrossSpawnSpawner now has a defaultLayer that provides NodeFileSystem + NodePath, so consumers don't need to wire those manually
  • Worktree switched from raw FileSystem.FileSystem to AppFileSystem.Service
  • Updated effect-migration.md checklist (added 3 missing services, fixed Pty status, updated scope lists)

Services updated

Agent, Command, Config, FileWatcher, Format, LSP, MCP, Pty, Snapshot, Worktree

Cross-service promise calls converted

Caller Was calling Via
Command Config, MCP, Skill Effect.promise()
Format, FileWatcher, LSP, Snapshot Config Effect.promise()
MCP (4 call sites) Config Effect.promise()
Agent Config, Skill Effect.promise() / closure
Config Auth, Account Effect.promise()
Worktree Project Effect.promise()

Test plan

  • bun run typecheck passes (0 errors)
  • Run existing test suite
  • Verify services initialize correctly at runtime

Effectified services now yield other effectified services directly via
their Effect interface instead of going through async promise facades
(Effect.promise(() => Service.method())). This keeps the full call chain
within the Effect runtime, enabling proper dependency tracking and
avoiding unnecessary runtime boundary crossings.

Services updated: Agent, Command, Config, FileWatcher, Format, LSP, MCP,
Pty, Snapshot, Worktree.

Also:
- CrossSpawnSpawner: add defaultLayer (provides NodeFileSystem + NodePath)
- Worktree: use AppFileSystem instead of raw FileSystem.FileSystem
- Project: rename fsys → fs for consistency
- Update effect-migration.md checklist and scope lists
@kitlangton kitlangton force-pushed the effect/yield-services branch from 7bf7d51 to cbd472f Compare March 26, 2026 18:58
@kitlangton kitlangton marked this pull request as ready for review March 26, 2026 18:59
@kitlangton kitlangton merged commit 9c6f1ed into dev Mar 27, 2026
11 of 12 checks passed
@kitlangton kitlangton deleted the effect/yield-services branch March 27, 2026 01:46
Copilot AI pushed a commit to ian-morgan99/opencode that referenced this pull request Mar 28, 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