Skip to content

refactor(opencode): keep SDK-only command catalog (option B)

MacroscopeApp / Macroscope - Effect Service Conventions failed Jul 31, 2026 in 1m 54s

Effect Service Conventions: 1 issue found

  • apps/server/src/provider/acp/GrokAcpSupport.ts:11,15 — compatibility re-export shim for the relocated mapAcpAvailableCommandsToProviderCatalog helper. The function was moved to apps/server/src/provider/providerCommandCatalog.ts in this PR, but GrokAcpSupport.ts imports it solely to re-export it, and GrokProvider.ts still imports it through that shim instead of the canonical module. The duplicated mapper tests in GrokAcpSupport.test.ts (already covered by providerCommandCatalog.test.ts) should move with it.

An inline review comment with a suggested fix has been posted.

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.

Files reviewed (in scope):

  • apps/server/src/provider/providerCommandCatalog.ts (new) — pure mapping helpers, named type imports from @t3tools/contracts and effect-acp/schema are appropriate; no service/layer content, so no Context.Service/make/layer expectations apply.
  • apps/server/src/provider/opencodeRuntime.ts — new loadProviderCommandCatalog member added to the existing OpenCodeRuntimeShape and implemented inside the existing make; stays inside the Effect environment (Effect.scoped, connectToOpenCodeServer), no ManagedRuntime/runPromise, no module-global state. The pre-existing standalone OpenCodeRuntimeShape interface and detail-bearing OpenCodeRuntimeError were not introduced here, so they were not flagged as unrelated cleanup.
  • apps/server/src/provider/Layers/OpenCodeProvider.ts — acquires the runtime via yield* OpenCodeRuntime (requirement visible in the Effect.fn.Return signature); no service-instance parameters. Note (not flagged): loadProviderCommandCatalog is typed with error never, so the trailing Effect.orElseSucceed(() => EMPTY_PROVIDER_COMMAND_CATALOG) at the call site is redundant.
  • apps/server/src/provider/Layers/GrokProvider.ts — new GrokAcpDiscoveryResult is a local data shape, not a service shape; namespace/type imports follow conventions apart from the shim import flagged above.
  • apps/server/src/provider/acp/AcpSessionRuntime.ts — available_commands_update capture uses Ref inside the existing make; imports are subpath namespaces; no new errors or runtime boundaries.
  • Test files (GrokProvider.test.ts, OpenCodeProvider.test.ts, GrokAcpSupport.test.ts, providerCommandCatalog.test.ts) — service instances passed explicitly via test doubles are legitimate test seams; new tests cover real backend behavior change (slash commands/skills now populated), which is expected rather than gratuitous.

Out of scope: scripts/debug/issue-4109-grok-skills-loop.sh (not matched by the check's include patterns).


🔍 Agent activity — 1 tool call

💭 I'm checking the modified files to understand the conventions being used—particularly whether providerCommandCatalog.ts contains pure helpers versus service logic, and how the OpenCodeRuntimeShape fits into the existing structure in opencodeRuntime.ts. I need to review the imports across these files to see what's being brought in. I'm weighing whether adding a method to this pre-existing OpenCodeRuntimeShape violates the naming convention, since the rule says not to retain standalone shape interfaces. But this is legacy code, and the instructions tell me to treat them as authoritative rather than demand unrelated cleanup, so the PR change itself shouldn't be flagged as a violation. Now I need to verify the rest of the opencodeRuntime setup — the service tag, layer definition, and whether loadProviderCommandCatalog is properly implemented. I'm also noticing that GrokProvider imports mapAcpAvailableCommandsToProviderCatalog from GrokAcpSupport.ts, which appears to be a re-export shim. The convention says to delete old service files and not leave compatibility shims, so this looks like a mild violation that I should investigate further in GrokAcpSupport.ts and its tests. I'm checking whether mapAcpAvailableCommandsToProviderCatalog was originally defined in GrokAcpSupport or if it's newly extracted to providerCommandCatalog.ts in this PR. The test files suggest it's being tested in both places, which could indicate redundant re-exports and duplicate test coverage. I need to look at the git history to understand if this shim was intentionally introduced or if it's unnecessary indirection. I should also examine AcpSessionRuntime.ts for its imports and check what GrokProvider.test.ts is adding. I'm noticing a re-export shim in GrokAcpSupport that was added in this PR—it lets GrokProvider import the mapper from GrokAcpSupport instead of the canonical source, which is worth investigating. I should also check the duplicate test in GrokAcpSupport.test.ts and verify whether this violates the convention against leaving compatibility re-export shims for modules with limited usage. Let me look at what GrokProvider is actually importing. I'm tracing the history of mapAcpAvailableCommandsToProviderCatalog — it was originally in GrokAcpSupport.ts, then moved to providerCommandCatalog.ts with a re-export shim for backward compatibility. The issue is that GrokProvider should import directly from the new location instead of relying on this compatibility layer. There's also duplicate test coverage: GrokAcpSupport.test.ts and providerCommandCatalog.test.ts both test the same mapper function, which violates the principle of not adding tests just to prove a mechanical refactor worked. The duplicated tests in GrokAcpSupport.test.ts should be consolidated. I'm checking other conventions around dependency acquisition — loadProviderCommandCatalog in OpenCodeRuntimeShape looks fine as a service method, and the test double using the shape type is a valid test seam. The error handling with orElseSucceed that falls back to an empty catalog isn't a violation, though I should verify whether this fallback behavior is intentional or if errors should propagate differently. One thing I notice: loadProviderCommandCatalog returns an Effect with never as the error type, so the caller's orElseSucceed is actually dead code since there's no error to catch. That's minor style debt rather than a convention violation, so I'll skip it and focus on the scoped checks. Let me trace how openCodeRuntime is acquired in OpenCodeProvider around line 400-470. I need to trace back through the code to see where openCodeRuntime is defined or passed in. Checking the OpenCodeRuntime implementation — the yield delegation looks correct, the service tag and layer setup are fine, and loadProviderCommandCatalog is using Effect properly. GrokProvider discovery checks out too. The error conventions are consistent with the existing OpenCodeRuntimeError structure, and no new error classes were introduced in this PR. The only thing I'm noticing is the re-export of sh. Now I need to trace where mapAcpAvailableCommandsToProviderCatalog from GrokAcpSupport is being imported — checking if it's only used in GrokProvider and its test, or if there are other consumers. I've found a concrete issue: GrokAcpSupport.ts is re-exporting the mapper as a compatibility shim without actually using it internally, which violates the rule against leaving compat re-exports in place. I need to add inline comments flagging this on line 15 of GrokAcpSupport.ts and also check the import on line 36 of GrokProvider.ts to ensure consumers are directed to the canonical module instead. The fix involves removing both the import on line 11 and the export on line 15 from GrokAcpSupport.ts, then updating GrokProvider.ts to import directly from the canonical source. I should also note that the test file has duplicate test coverage for the mapper that mirrors what's already tested elsewhere, so that's worth flagging as part of the same cleanup. For the final assessment, this is a clear convention violation — leaving a re-export shim for a helper function moved within the same PR goes against the principle of not maintaining compatibility shims. I'll mark this as a failure with a precise finding.

1. modify_pr — One convention issue found: a compatibility re-export shim was introduced for the relocated mapAcpAvailableCommandsToProviderCatalog helper. Everything else (namespace imports from effect/*, yield* OpenCodeRuntime for dependency acquisition, no new Layer.succeed/ManagedRuntime/runPromise seams, no new error classes) matches the conventions.


Agent Credits: 75 credits