Repository navigation
Effect Service Conventions: 1 issue found
apps/server/src/provider/Drivers/GrokDriver.ts: the newprojectRootis read from theprocess.cwd()module global instead of theServerConfigservice already declared inGrokDriverEnv(other drivers useconst { cwd } = yield* ServerConfig). This hides an environment-provided input that now drives workflow slash-command discovery and the provider status probe.
Previously flagged items are resolved on this head: GrokWorkflowCommands.ts now uses FileSystem/Path from the Effect environment with the requirement surfaced in buildInitialGrokProviderSnapshot/checkGrokProviderStatus; the discovery environment is threaded from checkGrokProviderStatus; isGrokAcpAuthFailure classifies on the tagged AcpRequestError rather than stringified cause text; the tool-update gate reads Clock.currentTimeMillis; the pass-through permission-option wrapper is gone; and rewind failures use a bounded detail with the raw provider error preserved as cause.
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: changed .ts/.tsx under apps/** and packages/** (Grok adapter/provider/driver, new GrokAcpSessionExtras.ts, GrokAcpWorkflow.ts, GrokAcpToolUpdates.ts, GrokWorkflowCommands.ts, XAiAcpExtension.ts, usage transcript readers, web/mobile usage provider tables).
Checks performed:
- Import style: all touched Effect modules use subpath namespace imports (
effect/Effect,effect/Schema,effect/FileSystem,effect/Path,effect/Clock); no consolidatedfrom "effect"imports introduced. - Service definition/layers: no new
Context.Servicetags,make, orlayerexports; no newLayer.succeedimplementations backed by imperative APIs; noManagedRuntime.makeorrunPromiseoutside tests. - Dependency acquisition:
readGrokWorkflowSlashCommandscorrectly requiresFileSystem/Path, and bothbuildInitialGrokProviderSnapshotandcheckGrokProviderStatuspropagate those requirements. The only environment-bypass introduced is theprocess.cwd()call inGrokDriver.create. - Errors: new failures reuse the existing
ProviderAdapterValidationError/ProviderAdapterRequestErrorclasses with structural fields;detailvalues are bounded and the raw_x.ai/rewind/executeerror is preserved ascauserather than pasted into the message. No newcatchTag/predicate-basedcatchIfrecovery of known tags. - New pure mapping modules (
GrokAcpWorkflow.ts,GrokAcpSessionExtras.ts,GrokAcpToolUpdates.ts) contain no service or runtime concerns and are covered by focused unit tests.
🔍 Agent activity — 13 tool calls
💭 I'm reviewing the current codebase against my prior findings to see what's been addressed: the filesystem blocking issue in GrokWorkflowCommands.ts now uses Effect services, environment threading in GrokProvider looks resolved, error handling has been converted to tagged errors, and Date.now() calls now go through Clock. I'm checking whether the permission option pass-through issue was also cleaned up. Rewind failure handling now includes bounded detail and cause tracking, so most prior issues appear fixed. I'm now scanning for Effect convention violations in the new code, checking that imports are consolidated and looking at places like process.cwd() and process.env usage in GrokDriver and GrokProvider that could be hidden module-level dependencies, though these might be acceptable boundary cases. I want to verify by actually opening the current head files directly.
1. browse_code — apps/server/src/provider/acp/GrokWorkflowCommands.ts
2. browse_code — apps/server/src/provider/Layers/GrokProvider.ts
💭 Prior findings look addressed, so now I'm scanning the new code for other convention violations—checking GrokAcpSupport.ts's auth failure handling and error classes, plus GrokAdapter's use of Date.now and imports. I'm also grepping changed files for consolidated effect imports, ManagedRuntime, runPromise, and Layer.succeed usage.
3. git_tools — from "effect"|ManagedRuntime|runPromise|Date.now( — rejected: repo.url: required parameter is missing or empty;repo: required parameter is missing or empty
4. browse_code — apps/server/src/provider/acp/GrokAcpSupport.ts
💭 I'm going to grep across the changed server provider files, looking for consolidated effect imports and usages of Date.now.
5. git_tools — from "effect";|ManagedRuntime|runPromise|Date.now(|process.env|process.cwd
💭 These match existing patterns elsewhere in the codebase, so they aren't new violations. I'm now reviewing the newly added GrokAdapter code for Effect service conventions, checking things like the semaphore setup and the mutable closure variable for session notification readiness, both of which look fine, and then moving on to check the error handling around mapping ACP errors to adapter errors. I'm checking the extras and workflow files for the Grok session, both of which are pure and use Schema appropriately. Now I want to grep the changed files for catchTag or catchIf usage, and I notice a minor code-quality nit in the extension file where there are two similar helper functions defined for checking records, though that's not a real convention violation. I'll continue checking the adapter file's error construction and layer setup, then grep the diff for any newly added catchTag/catchIf patterns.
6. git_tools — catchTag|catchIf|Layer.succeed|Schema.Defect
💭 Nothing else stands out as violating conventions here. I want to check the rollback error construction and the type cast in emitGrokTaskSpecs, but those seem like minor nits rather than real issues. Now I'll move on to look at GrokDriver. ts, particularly checking if checkGrokProviderStatus's new FileSystem and Path requirements are properly satisfied by the driver environment type.
7. browse_code — apps/server/src/provider/Drivers/GrokDriver.ts
💭 I'm noticing this driver uses process.cwd() directly for the project root, while other drivers like CodexProvider and CursorProvider do the same thing. But I want to check whether ServerConfig actually exposes a projectRoot or workspaceRoot property, since relying on process.cwd() instead of an injected Effect service would be a hidden dependency worth flagging.
8. git_tools — readonly (workspaceRoot|projectRoot|cwd|rootPath|repoRoot)
💭 GrokDriver uses process.cwd() directly instead of pulling cwd from the ServerConfig service it already has available, which counts as hiding a dependency in a module global. I want to check whether ClaudeDriver or CodexDriver handle cwd the same way, to see if this is a consistent pattern or an isolated issue.
9. git_tools — ServerConfig
💭 I'm confirming that GrokDriver introduces a direct process.cwd() call instead of pulling cwd from ServerConfig like ClaudeDriver does, which is a clear violation of the convention against hiding dependencies in module globals—worth flagging inline. I also note GrokProvider's environment fallback to process.env is consistent with the file's existing default parameter pattern, so that one seems fine. Next I want to check UsageService.ts, which uses process.env.GROK_HOME and homedir() directly, to see if that matches conventions already established elsewhere in that file.
10. browse_code — apps/server/src/usage/UsageService.ts
💭 I notice grok resolves its home path directly through the environment variable and homedir, unlike the Effect-based resolvers used for Claude and Codex. I want to check whether NodeOS is used anywhere else in this file.
11. git_tools — NodeOS|homedir|process.env
💭 The env/homedir usage seems borderline since it's pervasive across the codebase, so I won't flag it there. Instead I'll focus on GrokDriver, where the ServerConfig service is already declared in the driver's env type and other drivers read
cwdfrom it — that's the strongest finding to pursue further. Now let me check whether there's anything else newly egregious in GrokAdapter.ts, and quickly review the rollback and notification sections.
12. browse_code — apps/server/src/provider/Layers/GrokAdapter.ts
💭 I'm deciding to flag GrokDriver.ts line 116 where it calls process.cwd() directly instead of using the declared ServerConfig.cwd, since ClaudeDriver already sets a precedent for not hiding dependencies like this in module-level calls. I need to confirm the diff includes this line so I can attach the comment correctly. Since there's a finding here, the state should be failure. I'll draft the inline comment for GrokDriver.ts around the process.cwd() call, noting it should instead pull cwd from ServerConfig like ClaudeDriver does, keeping the root testable and layer-controlled. I'll suggest replacing it with a destructured
cwdfromyield* ServerConfig, confirming ServerConfig is already imported and used inside the same Effect.gen block, and that its semantics match since it's set from process.cwd() at startup anyway. Now I just need to make sure this line lands on the correct side of the diff hunk.
13. modify_pr — One finding: the Grok driver reads the project root from the process.cwd() module global instead of the ServerConfig service that is already declared in GrokDriverEnv.
Agent Credits: 201 credits