Skip to content

fix(grok): health check, model selection, and stop all work against the real CLI - #9154

Merged
t3dotgg merged 9 commits into
mainfrom
t3code/harden-grok-build-support
Sep 2, 2026
Merged

t3dotgg merged 9 commits into
mainfrom
t3code/harden-grok-build-support

test(grok): quote fake CLI paths without JSON.stringify

2b9bde5
Select commit
Loading
Failed to load commit list.
MacroscopeApp / Macroscope - Effect Service Conventions completed Sep 2, 2026 in 1m 58s

Effect Service Conventions: 1 minor issue

One minor finding, posted inline.

  • apps/server/src/provider/Layers/GrokAdapter.ts (steer path, ~L1684-1690): the Effect.mapError(mapAcpToAdapterError(...)) wrapped by Effect.ignore is dead — the mapped adapter error is constructed and immediately discarded, so the mapper performs no normalization and reaches no caller.

The previously flagged unexplained @effect-diagnostics nodeBuiltinImport:off directive in apps/server/src/provider/Layers/GrokProvider.test.ts now carries an adjacent reason and is resolved.

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.

Reviewed against the Effect service conventions:

  • Imports: GrokAdapter.ts, GrokProvider.ts, AcpSessionRuntime.ts, AcpRuntimeModel.ts, GrokAcpSupport.ts, and packages/effect-acp/src/protocol.ts all use subpath namespace imports (effect/Semaphore, effect/Exit, effect/Deferred, ...). No consolidated named imports from "effect" were introduced.
  • Service definition: the new initialize member is declared inline on the existing AcpSessionRuntime Context.Service interface with documentation; no standalone shape type or new layer/make naming was introduced.
  • Dependency acquisition: discoverGrokModelsViaAcpInitialize acquires ChildProcessSpawner.ChildProcessSpawner from the environment and is scoped; no ManagedRuntime.make, runPromise, runPromiseExit, or service-instance parameters were added. The new promptLifecycle: Semaphore.Semaphore and promptEpoch/discardBeforeEpoch fields are per-session state, not injected services.
  • Errors: no new error classes. protocol.ts routes notification encode failures through the existing static factory AcpProtocolParseError.fromEncodingError, preserving cause and the structural operation/method attributes; messages remain derived from those attributes. Added log warnings carry only bounded errorTag values.
  • Suppressions: the only static-analysis directive in the diff (@effect-diagnostics nodeBuiltinImport:off) now has an adjacent explanation.
  • Change discipline: behavior changes (steer/cancel ordering, health-check flow, notification framing) are covered by focused tests in GrokAdapter.test.ts, GrokProvider.test.ts, GrokAcpSupport.test.ts, and protocol.test.ts.

Turn-completion/event-ordering concerns raised by other reviewers are outside this check's scope and were not re-litigated.


🔍 Agent activity — 7 tool calls

💭 I want to verify the suppression directive fix held and check the changed files for Effect service convention issues—consolidated imports, the Semaphore usage in GrokAdapter.ts, error definitions, and the protocol.ts changes involving Exit and Cause.squash.

1. git_tools — 7e460f4..2b9bde5

2. git_tools — ^import

💭 With that suppression fix in place, I'm now scanning for other convention issues: checking that imports are correctly namespaced, confirming the Semaphore import pattern in GrokAdapter.ts, and verifying the new error path uses a proper static factory consistent with existing conventions.

3. git_tools — ^import

4. git_tools — ^import

💭 Checking the changed files for convention violations—I note a standalone shape type import in GrokAdapter.ts that seems pre-existing so I won't flag it, and I'm now looking at how protocol.ts handles error construction from encoding failures. The rest of the diff looks clean: the provider changes use standard Effect patterns, the new exported model state function is fine, and the one existing suppression directive already has proper justification. I don't find any other new eslint-disable, ts-expect-error, or biome-ignore directives when I search through the diff. I'm now checking the semaphore and error-mapping details in the session context and cancel logic — nothing raises a real concern, just a mapError that gets immediately ignored, which is harmless but slightly redundant. It's low-value noise so I won't flag it. I also need to reconcile the instruction to output exactly "All clear" when there are no findings with the requirement to produce a JSON response — I'll follow the JSON schema and encode that outcome as a success state with no findings, since the check defaults to failure only when actual findings exist. Now I want to check the sendNotification path in protocol.ts — on encode failure it calls AcpProtocolParseError.fromEncodingError with the method, an undefined second argument, and the squashed cause. I should verify what that second parameter is meant for and whether passing undefined there is correct.

5. git_tools — fromEncodingError

💭 This looks consistent — using the static factory and preserving the cause via squash is fine since fromEncodingError accepts an unknown cause. Now I want to check the discarded mapError in GrokAdapter, so I'm looking at that region in context.

6. browse_code — apps/server/src/provider/Layers/GrokAdapter.ts

💭 I'm noticing the mapError call before the ignore is essentially dead code — it discards the mapped error after mapAcpToAdapterError does unnecessary allocation work. It's a minor redundancy, and I'm weighing whether it's worth flagging under the Effect Service Conventions guidance around unnecessary error-wrapping helpers. There's also a separate behavioral concern — the silent swallowing of the cancel failure with no logging — but that feels outside the scope of this convention check since other reviewers already covered steering behavior. I'm now scanning other diff sections for genuine convention issues, like whether the initialize method in AcpSessionRuntime is redundantly wrapping an existing effect. Everything else checks out as pre-existing patterns — the interface options, the Deferred import, GrokProvider's exports, and the direct use of process.cwd() rather than a dedicated service. So the redundant mapError still looks like the only real candidate finding, and now I'm double-checking whether any new suppression directives like eslint-disable or ts-expect-error appear elsewhere in the changed files. The diff confirms there's just that one instance, and the test file has no new directives either. Since the mapper here discards the error entirely and adds no real normalization, it conflicts with the guidance against constructing wrapper functions that don't add value at the failure boundary — so flagging it with a small inline suggestion to remove the mapError seems reasonable and low-risk, though I want to verify the cancel effect's error type won't cause issues if I drop the wrapper. Given the check defaults to failure when there are findings, I'm weighing whether this dead mapError is significant enough to report versus letting it pass as "All clear" — it's real but minor dead code that reviewers might appreciate seeing flagged, though I don't want to introduce noise for something this borderline. I'll post it as an inline suggestion replacing those lines with a single call wrapping the cancel effect in Effect.ignore, matching the correct indentation and targeting the diff's line range 1684-1690 on the head side. Let me also check whether there's a related comment thread already at line 1755 that I should account for. There's already a separate comment thread at line 1684 about buffered events, unrelated to my concern about the discarded mapped error, so my new comment is a different topic and shouldn't read as duplicative—I'll just keep it brief to avoid adding noise where the author already pushed back once. Weighing the value: dropping the unused mapAcpToAdapterError call is a small but real clarity improvement, loosely tied to the error-handling conventions, so I'd call this a minor but legitimate cleanup worth flagging.

7. modify_pr — Submitted review with 1 inline comment


Agent Credits: 110 credits

Token usage: 12 uncached input · 432,694 cache-read input · 103,364 cache-write input · 7,076 output
Agent Credits may also include non-token charges from external tools such as web research.