Skip to content

refactor(truncation): effectify TruncateService, delete Scheduler#17957

Merged
kitlangton merged 6 commits intodevfrom
refactor/effectify-truncate
Mar 18, 2026
Merged

refactor(truncation): effectify TruncateService, delete Scheduler#17957
kitlangton merged 6 commits intodevfrom
refactor/effectify-truncate

Conversation

@kitlangton
Copy link
Copy Markdown
Contributor

Summary

  • Effectify TruncateService as a global Effect service on the ManagedRuntime
  • Delete Scheduler module — no remaining consumers
  • Split into truncate-service.ts (Effect) + truncation.ts (facade) to avoid circular import with runtime.ts

Details

  • TruncateService uses Effect FileSystem for cleanup (readDirectory + remove)
  • Hourly cleanup via Effect.forkScoped + Schedule.spaced (replaces Scheduler.register with scope: "global")
  • Shared TRUNCATION_DIR constant extracted to truncation-dir.ts (used by both service and facade)
  • Truncate.cleanup() facade delegates to service via runtime
  • Truncate.output() unchanged — pure utility function, no Effect needed
  • Cleanup starts automatically when ManagedRuntime is created (no more Truncate.init() in bootstrap)

Stack

Depends on #17878 (effectify Snapshot)

Test plan

  • All 13 truncation tests pass (output truncation, cleanup retention, task tool hints)
  • No remaining Scheduler imports in src/ or test/
  • Typecheck clean
  • Unit tests pass on Linux and Windows

@kitlangton kitlangton force-pushed the refactor/effectify-snapshot branch from 58ad84d to ab89f84 Compare March 17, 2026 14:08
@kitlangton kitlangton force-pushed the refactor/effectify-truncate branch 2 times, most recently from 8dc4dbf to d2d8aaa Compare March 17, 2026 14:15
Base automatically changed from refactor/effectify-snapshot to dev March 18, 2026 01:04
- TruncateService as global Effect service on ManagedRuntime with
  FileSystem for cleanup (readDirectory + remove)
- Hourly cleanup via Effect.forkScoped + Schedule.spaced
- Split into truncate-service.ts (Effect) + truncation.ts (facade)
  to avoid circular import with runtime.ts
- Shared TRUNCATION_DIR constant in truncation-dir.ts
- Delete Scheduler module (no remaining consumers)
- Remove Truncate.init() from bootstrap (cleanup starts automatically
  when runtime is created)
@kitlangton kitlangton force-pushed the refactor/effectify-truncate branch from 8e4af17 to 304adb8 Compare March 18, 2026 01:16
@kitlangton kitlangton marked this pull request as ready for review March 18, 2026 01:18
opencode-agent bot added a commit that referenced this pull request Mar 18, 2026
@kitlangton kitlangton merged commit 5dfe86d into dev Mar 18, 2026
8 checks passed
@kitlangton kitlangton deleted the refactor/effectify-truncate branch March 18, 2026 01:59
export const runtime = ManagedRuntime.make(
Layer.mergeAll(AccountService.defaultLayer, Instances.layer).pipe(Layer.provideMerge(AuthService.defaultLayer)),
Layer.mergeAll(
AccountService.defaultLayer, //
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's this!?

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.

2 participants