Skip to content

fix(server): make OpenCode Stop button actually stop the session

MacroscopeApp / Macroscope - Effect Service Conventions failed Aug 30, 2026 in 1m 53s

Effect Service Conventions: 2 issues found

  • apps/server/src/provider/Layers/OpenCodeAdapter.ts:1570 — uses Effect.catchAll to handle the whole error channel; the convention here is Effect.catch (inline suggestion posted).
  • apps/server/src/provider/Layers/OpenCodeAdapter.ts:1563-1597 — backend behavior change (abort failures now swallowed; active-turn state cleared and session flipped to ready) with no focused tests; OpenCodeAdapter.test.ts is untouched.

Details

Note

Your check run agent prompt is: .macroscope/check-run-agents/effect-service-conventions.md
More information about how Check Run Agents work can be found in our Help Center.

Scope reviewed: the single changed file apps/server/src/provider/Layers/OpenCodeAdapter.ts (interruptTurn) plus the existing OpenCode adapter test harness and comparable adapters.

Checks performed:

  • Imports/namespaces, service definition order, make/layer exports: unchanged by this PR, no violations.
  • Dependency acquisition: no service-instance parameters, no Layer.succeed, ManagedRuntime.make, or runPromise/runPromiseExit introduced.
  • Errors/predicates: no new error classes; existing ProviderAdapterRequestError usage unchanged. The removed Effect.mapError(toRequestError) on the abort path is a deliberate best-effort handling, and the warning log only carries cause plus the session id, matching existing log payloads in the provider layers.
  • Error handling operators: Effect.catchAll occurs only in the new code and in one legacy site (AntigravityAdapter.ts:972); every other provider layer uses Effect.catch.
  • Change discipline: comments preserved and extended; behavior change is not mechanical, so focused tests are expected. apps/server/src/provider/Layers/OpenCodeAdapter.test.ts already stubs session.abort and records abortCalls, so the new best-effort/state-clearing behavior can be covered without new infrastructure.

🔍 Agent activity — 12 tool calls

1. browse_code — apps/server/src/provider/Layers/OpenCodeAdapter.ts

2. git_tools — 0009aac..62384f9

💭 I'm weighing whether swallowing the error with logWarning fits the convention, since catchAll is meant for intentionally handling the entire error channel rather than silently discarding it—this feels like it might be misusing that pattern instead of using catchTags for specific known failures. I'm also noting that logging the raw cause in annotations could edge into copying error details somewhere unsafe, and that this looks like a genuine behavior change (interrupt/abort errors no longer surfacing) which likely needs a focused test. I want to check whether existing tests cover the OpenCode adapter's interruptTurn path.

3. git_tools — interruptTurn

4. git_tools — logWarning

💭 This PR touches an Effect service adapter with meaningful behavior changes—swallowing abort failures and clearing state—so I want to check whether OpenCodeAdapter already has focused tests covering this.

5. browse_code — apps/server/src/provider/Layers/OpenCode*

6. git_tools — Effect.catchAll(

💭 Since there's no test file update, this behavior change lacks focused test coverage, which should be flagged. I'm also checking whether the catchAll pattern here is swallowing a known tagged error from runOpenCodeSdk instead of using catchTags as the guidelines suggest, versus other paths that properly use mapError with toRequestError. Though catchAll could be justified here since the whole error channel is intentionally handled, I want to check if this codebase uses a newer Effect.catch API instead of catchAll — worth grepping for usage patterns to confirm which is the convention here.

7. git_tools — Effect.catch(

8. git_tools — Effect.catchAll(

💭 I'm noticing the repo consistently uses Effect.catch, while this new code uses Effect.catchAll — that might be an older API name that got renamed in newer Effect versions. I should check the package.json to confirm which Effect version is actually in use.

9. git_tools — "effect":

10. git_tools — catchAll

💭 I notice there's another usage in AntigravityAdapter, so catchAll does exist elsewhere legally, though the convention favors Effect.catch when the whole channel is intentionally handled, which is the case here. This feels like a minor style deviation rather than a clear violation, leaning toward option B. Checking the logWarning call, it logs the raw cause, which matches the repo-wide pattern of preserving the underlying error as cause, so that's fine. I'm also considering whether swallowing the error on interruptTurn's declared error channel counts as a convention issue, but that doesn't seem to apply here. Since this changes behavior, I should check whether OpenCodeAdapter.test.ts already has interrupt or abort tests covering this path.

11. git_tools — abort|interrupt

💭 I notice there's a test harness with an abort mock but no test covering the new interrupt behavior—clearing the active turn, session readiness, and best-effort handling of abort failures. Since instructions call for focused tests on backend behavior changes, and this is a change to an Effect service, that's worth flagging. I'm also checking whether interruptTurn's declared error type still accounts for the request error now that catchAll strips it out. I'm also noticing a possible edge case: the check for activeTurnId doesn't verify that the passed turnId matches, so a stale turnId from a finished turn could incorrectly clear state for a newer active turn—though that's a behavioral concern outside the scope of this convention-focused review. I'm also weighing whether to flag the use of catchAll instead of the repo's preferred Effect.catch idiom, but since that's a style preference rather than a hard rule, I'm inclined not to fail on it. Given the more substantive issue—no test was added despite a real behavioral change to Stop reliability—I'll post a review with one inline comment on OpenCodeAdapter.ts about catchAll versus Effect.catch, and note in the review body that this behavior change needs a focused test in OpenCodeAdapter.test.ts. Since the behavior actually changed and there's no focused test covering it, that meets the bar for a real convention violation rather than a style nitpick, so I'll mark this as a failure and post the findings.

12. modify_pr — Two findings in apps/server/src/provider/Layers/OpenCodeAdapter.ts: 1. Effect.catchAll is used where the codebase's convention for intentionally handling the whole error channel is Effect.catch (see ProviderService.ts:254, ClaudeAdapter.ts:4723, CursorAdapter.ts:1166). Inline comment below. 2. This is a backend behavior change (session.abort failures are now swallowed, and interruptTurn now clears activeTurnId/activeAgent/activeVariant and flips the provider session back to ready), but OpenCodeAdapter.test.ts is unchanged. Please add focused tests there — the existing harness already records abortCalls and can be made to reject — covering (a) abort failure still clears active-turn state and leaves the session ready, and (b) a successful interrupt emits turn.aborted and returns the session to ready so a following turn can be sent.


Agent Credits: 55 credits

Token usage: 16 uncached input · 226,663 cache-read input · 40,908 cache-write input · 6,177 output
Agent Credits may also include non-token charges from external tools such as web research.