Skip to content

[codex] Align provider Effect service modules#3195

Open
juliusmarminge wants to merge 20 commits into
mainfrom
codex/effect-service-server-provider
Open

[codex] Align provider Effect service modules#3195
juliusmarminge wants to merge 20 commits into
mainfrom
codex/effect-service-server-provider

Conversation

@juliusmarminge

@juliusmarminge juliusmarminge commented Jun 20, 2026

Copy link
Copy Markdown
Member

Summary

  • hoist consolidated provider service modules and their existing tests from Services/ and Layers/ to the provider/ domain root
  • define service contracts inline on Context.Service, expose real make constructors and canonical layer exports, and use Service["Service"] for contract types
  • migrate in-scope consumers to service-module namespace imports while keeping named imports for helpers, package barrels, and non-service modules
  • split provider maintenance spawn/collection failures into distinct structured schema errors instead of switching messages on an operation field
  • preserve provider contract documentation and behavioral test coverage; remove the old-path compatibility shims and mechanically rewire remaining orchestration and integration consumers to canonical provider modules
  • align the rebased provider modules with the newly hoisted persistence service API
  • harden OpenCode failures with stable messages, bounded status/count/byte/timing fields, and exact cause-chain preservation without retaining arbitrary SDK bodies or process streams

Impact

Primarily structural. OpenCode failures now retain exact causes plus bounded status/count/byte/timing metadata while avoiding arbitrary SDK response bodies and process streams in direct error fields or messages. Existing provider tests retain compact behavioral coverage; no broad refactor-only test suite was added.

Validation

  • vp check (0 errors; repository-existing warnings only)
  • vp run typecheck
  • final rebased affected suites: 19 files / 340 tests passed; 1 skipped
  • focused post-review provider suites: 2 files / 18 tests passed
  • focused OpenCode runtime, adapter, provider, and text-generation suites passed
  • git diff --check

Note

Align provider Effect modules to Context.Service pattern with standardized error types

  • Converts provider services (ProviderService, ProviderSessionDirectory, ProviderSessionReaper, ProviderAdapterRegistry, ProviderInstanceRegistry, ProviderRegistry, OpenCodeRuntime, ProviderMaintenanceRunner, ProviderEventLoggers) from shape-based exports to Context.Service classes with typed service tags and replaces legacy *Live layer exports with a single layer export per module.
  • Introduces structured, schema-validated error classes across adapters and runtime modules (e.g. ProviderAdapterProcessError.stage, OpenCodeRuntimeError, OpenCodeProbeError, ProviderMaintenanceCommandSpawnError) that carry typed metadata fields instead of raw message strings.
  • Standardizes error detail strings across all adapters and runtime error paths to generic, non-leaky messages, preventing SDK response bodies, cause messages, or credentials from appearing in surfaced error details.
  • Adds isInitialSnapshot to ProviderSnapshotSource so ProviderRegistry can distinguish the unprobed startup snapshot from live data when deciding whether to use a cached provider state.
  • Behavioral Change: ProviderService.sendTurn now rejects whitespace-only input with no attachments via a typed ProviderValidationError without calling the adapter; previously such input was passed through.

Macroscope summarized 60a235b.


Note

Medium Risk
Touches core provider session routing, orchestration reactors, and all built-in drivers; behavior changes mainly affect error strings/metadata and layer composition, but mistakes could break session startup or provider status UX.

Overview
Migrates provider wiring from scattered Layers/ / Services/ modules to consolidated provider/*.ts services (ProviderService, ProviderRegistry, ProviderAdapterRegistry, ProviderSessionDirectory, ProviderEventLoggers, etc.) that expose make + layer on Context.Service tags. Orchestration, integration harnesses, drivers, and tests now import these as namespaces (e.g. ProviderService.layer, ProviderAdapterRegistry.ProviderAdapterRegistry) instead of *Live / makeProviderServiceLive shims.

Tightens failure surfaces across adapters and OpenCode: ProviderAdapterProcessError gains a required stage; request/process/driver errors use fixed detail / message strings rather than embedding underlying cause text. OpenCode paths add structured OpenCodeProbeError, generic SDK failure mapping, and sanitized server URL diagnostics (origin/host only, no credentials/path/query). Claude/Codex/Cursor/Grok/OpenCode adapter and probe tests are updated for the new shapes and import paths.

Minor test harness cleanup in TestProviderAdapter.integration.ts inlines ProviderAdapterSessionNotFoundError construction where a helper was removed.

Reviewed by Cursor Bugbot for commit 60a235b. Bugbot is set up for automated code reviews on this repo. Configure here.

@coderabbitai

coderabbitai Bot commented Jun 20, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 686519ad-475a-4645-bafd-b44f099690ee

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/effect-service-server-provider

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:XXL 1,000+ changed lines (additions + deletions). labels Jun 20, 2026
@github-actions

github-actions Bot commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

🚀 Expo continuous deployment is ready!

  • Project → t3-code
  • Platforms → android, ios
  • Scheme → t3code-preview
  🤖 Android 🍎 iOS
Fingerprint fe5a51f2e189da69dfc4c2cd458e6cfb5fdff2ea ae3bd597809dfd7771d0898f735d172973d4c1c8
Build Details Build Permalink
DetailsDistribution: INTERNAL
Build profile: preview:dev
Runtime version: fe5a51f2e189da69dfc4c2cd458e6cfb5fdff2ea
App version: 0.1.0
Git commit: 4110b7ef4c76a5d3c990eb7ab6dfce6c771c624c
Build Permalink
DetailsDistribution: INTERNAL
Build profile: preview:dev
Runtime version: ae3bd597809dfd7771d0898f735d172973d4c1c8
App version: 0.1.0
Git commit: 4110b7ef4c76a5d3c990eb7ab6dfce6c771c624c
Update Details Update Permalink
DetailsBranch: pr-3195
Runtime version: fe5a51f2e189da69dfc4c2cd458e6cfb5fdff2ea
Git commit: 0d88b34df2e603f7739627228dc54e23bfb910fa
Update Permalink
DetailsBranch: pr-3195
Runtime version: ae3bd597809dfd7771d0898f735d172973d4c1c8
Git commit: 0d88b34df2e603f7739627228dc54e23bfb910fa
Update QR

@juliusmarminge juliusmarminge marked this pull request as ready for review June 20, 2026 02:06
@macroscopeapp

macroscopeapp Bot commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Needs human review

Diff is too large for automated approval analysis. A human reviewer should evaluate this PR.

You can customize Macroscope's approvability policy. Learn more.

@juliusmarminge juliusmarminge force-pushed the codex/effect-service-server-provider branch 24 times, most recently from 98fc694 to 716eab6 Compare June 20, 2026 07:21
@juliusmarminge juliusmarminge force-pushed the codex/effect-service-server-provider branch 9 times, most recently from 10f4bbb to 2579a32 Compare June 21, 2026 03:18
juliusmarminge and others added 20 commits June 20, 2026 20:21
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
@juliusmarminge juliusmarminge force-pushed the codex/effect-service-server-provider branch from 2579a32 to 60a235b Compare June 21, 2026 03:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XXL 1,000+ changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant