Repository navigation
Effect Service Conventions: 1 issue found
No Effect service convention violations were found in the changed production code. One test-organization issue was reported inline.
apps/server/src/mcp/WorktreeMcpService.test.ts(lines 2658-2881):t3_worktree_listtests were placed inside the newt3_thread_checkoutdescribe, and three of them are byte-identical duplicates of tests still present in thet3_worktree_listdescribe (includes archived thread bindings retained on a physical checkout,attributes a nested recorded cwd to its physical worktree root,does not attribute a nested independent repository to the project worktree). Likely a merge artifact; delete the duplicates and move the remainingrunListcases back to the list suite.
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.
Convention checks performed on changed scope:
- Imports: all touched files use Effect subpath namespace imports (
effect/Effect,effect/Exit,effect/Ref, ...); no consolidatedfrom "effect"imports were introduced. Local service modules are imported as namespaces (GitWorkflowService,ProjectService,VcsStatusBroadcaster); contracts remain named imports, which is allowed. - Service definition:
WorktreeMcpServicekeeps the canonical order (imports, tag with inline interface,make,layer); the newcheckoutmember is declared inline on theContext.Serviceinterface and implemented asWorktreeMcpService["Service"]["checkout"].GitWorkflowService.resolveCommitfollows the same existing passthrough pattern. - Dependency acquisition:
makecontinues to acquire every dependency viayield* Foo.Foo, and the exportedlayertype lists them. NoManagedRuntime.make,runPromise,runPromiseExit, service-instance parameters, or newLayer.succeedruntime smuggling in production code;Layer.succeedusage is confined to the test harness as a legitimate test seam.performHandoff's new optionalinitialProjectionargument is a plain value, not injected service state. - Errors: new failure codes and the
partialpayload extend the existingWorktreeMcpFailurecontract error (Schema.TaggedErrorClasswith a structuredcodediscriminator plus the new structuredWorktreeMcpPartialFailure); no new one-line error factories, nocatchIf-on-tag recovery, and the new Orchestrator CAS rejections match the surroundingOrchestratorDispatchErrorconstruction style. - File layout: no compatibility shims or leftover service/layer split files; consumers (handlers, toolkit registration, presentation map, docs) were updated mechanically.
π Agent activity β 20 tool calls
π I need to check the changed files for Effect service convention violations, starting with WorktreeMcpService.ts, GitWorkflowService.ts, and related contracts, so I'm looking at the imports and structure in WorktreeMcpService.ts first.
1. browse_code β apps/server/src/mcp/WorktreeMcpService.ts
2. browse_code β packages/contracts/src/worktreeMcp.ts
π The message-derived-from-attributes pattern here is pre-existing, not something the PR introduces β the error class already had code and message before this change, and the failure helper was only modified to add the partial param. I'll check the rest of the service now for layer definitions and dependency conventions.
3. browse_code β apps/server/src/mcp/WorktreeMcpService.ts
π I notice the ThreadManagementService is imported as a named import rather than a namespace, which technically violates the service boundary convention, but since that line is pre-existing and unchanged in this PR, it's likely not something to flag. Now I want to check the end of the file for the layer declaration.
4. browse_code β apps/server/src/mcp/WorktreeMcpService.ts
π I'm looking at the GitWorkflowService.ts change to add resolveCommit to the service interface, verifying that git.resolveCommit exists and matches existing conventions.
5. browse_code β apps/server/src/git/GitWorkflowService.ts
π That looks consistent with the existing patterns. Now checking handlers.ts and tools.ts, which seem fine, then looking at the orchestrator.ts change for validation logicβI want to see how they use the cause field in OrchestratorDispatchError to match the existing convention in that file.
6. git_tools β OrchestratorDispatchError({
π I'm going through the diff against the listed conventions one by oneβchecking imports, service definitions, dependency acquisition, and now looking at how errors are handled in the worktree-related code. For error discrimination,
WorktreeMcpFailureuses acodefield as a discriminator, which technically matches the rule about splitting distinct failures into separate error classes, but since this is a pre-existing MCP contract error being extended rather than newly introduced, flagging it would demand an unreasonable redesign, so I'm inclined to let it pass. I'm also checking whether the newdetailfield inqueueContinuationjust copiescause.messageverbatim, and whetherreportFailedis now dead code since its previous call site was replacedβI need to grep for other usages to confirm.
7. git_tools β reportFailed
8. git_tools β detail
π The
detailfield in continuation status looks like an existing contract, consistent with prior behavior. I'm double-checking the error mapping inloadThreadand scanning the changed production code, starting with GitWorkflowService.ts, for anything newly introduced that violates the pattern. Nothing stands out across WorktreeMcpService, handlers, tools, Orchestrator, contracts, or the shared presentation file β they all look like reasonable pre-existing patterns. In WorktreeMcpService I'm checking whetherqueueContinuation's cause-squashing logic, which puts sanitized error text into both the log payload and returned status, matches howreportFailedalready handled this, so I want to look at that helper's implementation more closely.
9. browse_code β apps/server/src/mcp/WorktreeMcpService.ts
π The squashed cause text matches the existing pattern elsewhere in the file, so that's fine. The Set-based concurrency guard is also consistent with prior conventions, not a new module-level global, and I'm now considering whether the catchTags versus catch usage aligns with the established rules. Let me also check how handlers.ts imports and scopes the WorktreeMcpService to make sure that's consistent too.
10. browse_code β apps/server/src/mcp/toolkits/worktree/handlers.ts
π The import style is pre-existing and consistent across the repo, so I'll skip flagging it. Checking the test file next, I confirm the conventions around service instances and the test harness setup look fine, including the Path mock. The checkout implementation follows the "Foo['Service']" typing convention correctly, and the error yielding via
failure(...)is consistent with existing patterns. I'm also verifying there's no new use ofLayer.succeed, and considering whether the error class in the contracts file should be split into separate classes per the discriminator convention. Since this discriminator already existed with 8 codes before the PR and is now being extended to 13 rather than introduced fresh, I'm leaning toward treating it as pre-existing design rather than a new violation, even though the guidelines suggest splitting semantically distinct failures. The unstructuredmessage: Schema.Stringfield does stand out though, since the convention calls for deriving messages from structured attributes rather than storing free text. I'm also scanning the rest of the diff for anything else worth flagging - checking that shared type exports and contract imports look consistent, and confirming no neweffectimports were added anywhere in the changed files.
11. git_tools β from "effect"
π I'm confirming these test files aren't part of the changed set and checking the checkout handler doesn't misuse runtime patterns like ManagedRuntime or runPromise. I notice a possible issue worth flagging in queueContinuation's return handling. Then I want to verify whether the failed-status detail logging mirrors the pre-existing reportFailed helper β but my grep and file view seem inconsistent about what line 476 actually contains, so I need to re-grep with more context to see reportFailed's real implementation.
12. git_tools β const reportFailed
π Grep is showing the pre-PR content at those lines, which is odd since it's supposed to default to the commit under review β but the view tool showed the updated version at that same tree hash, so it seems grep's default revision is actually pointing at the base branch instead. I want to re-run the grep for the "effect" import at the head revision to confirm, and I'm noting that queueContinuation mirrors reportFailed exactly.
13. git_tools β from "effect";
14. git_tools β import * as
π Using Layer.succeed as a test seam looks fine here, and I don't see any clear convention violations. I do notice the test file seems to duplicate some list tests within the t3_thread_checkout describe block, with copy-pasted cases around nested binding reads and archived thread bindings. This looks like a test-organization issue rather than an Effect-service-convention violation, so it's likely outside the scope of what I should flag. Still, I want to verify whether the duplication actually exists in the final file by checking if "includes archived thread bindings retained on a physical checkout" appears twice.
15. git_tools β includes archived thread bindings retained on a physical checkout
16. git_tools β describe(| it.effect("bounds nested binding
π I confirm the worktree_list tests got duplicated into the thread_checkout describe block, including an exact repeat of the archived-bindings test. That's a real issue within changed scope, though I need to check whether flagging misplaced/duplicate tests actually falls under this check's mandate around Effect Service Conventions and change discipline. I'm weighing whether this duplication counts as a "large test added without justification" violation under the change-discipline rule, versus whether I should just treat it as an inline comment rather than a failing finding. The instructions say to default to failure only when there are concrete violations, so I want to verify the actual duplicated line ranges before deciding whether this rises to that level.
17. browse_code β apps/server/src/mcp/WorktreeMcpService.test.ts
π I've confirmed that tests at those line numbers already exist in the list describe block, and duplicates were also added inside the checkout describe block β so roughly six list tests, about 250 lines, got copied into the wrong suite, likely an accidental artifact from rebasing or merging a branch stack. That's a real finding worth flagging, though I need to check whether it's actually in scope for this review. Checking the "Change discipline" guidance β it warns against adding large tests solely to prove a mechanical refactor, but duplication isn't quite that same issue, so it's borderline. Still, since it's a concrete problem within the changed scope and reporting concrete violations is permitted, I think a single inline comment noting the duplication is worthwhile, though I'm unsure whether this should count as a clear convention violation that fails the check or just a neutral-state finding, since the review role is specifically about Effect service conventions and duplicated tests don't map cleanly onto any of the listed conventions. Looking at the diff more carefully, three list-related tests were removed from their original describe block and then reappeared, duplicated, inside the checkout describe alongside the archived/nested ones β this looks like an accidental merge artifact rather than intentional duplication, since the bodies are identical and both would run redundantly. I'll flag this with one inline comment on the duplicated block, framing it as an accidental artifact worth cleaning up. Now I'm weighing how to set the overall status: since this isn't a hard convention violation but a genuine defect, failing outright feels like overstating it, so I lean toward neutral rather than failure, even though the default posture favors failing when there are findings β though I'm still second-guessing whether flagging this at all risks being noise for what's ultimately a duplicated-test cleanup rather than a real convention issue. Actually the duplication is precise and verifiable β same test name, same body, misplaced under the wrong describe block β so it's worth flagging. Now I need to pin down the exact right-side line numbers in the diff for the inline comment, tracing where the duplicated list-test block starts within the checkout describe section so I can anchor the comment correctly.
18. browse_code β apps/server/src/mcp/WorktreeMcpService.test.ts
19. browse_code β apps/server/src/mcp/WorktreeMcpService.test.ts
π I've confirmed that lines 2658β2881 in the checkout describe are runList tests, with three exact duplicates of tests already in the worktree_list describe and three others misplaced. I'll leave one inline comment at line 2658 recommending they move back to worktree_list and the duplicates get deleted, but I should double-check whether this finding actually falls within scope for this check. It's a loose fit for "change discipline" but still a real correctness issue introduced in changed scope, so I'll go with a neutral verdict and report it rather than staying silent β an accurate, actionable comment is worth more than saying "all clear." Since the fix spans multiple hunks (deleting duplicates and relocating tests), I won't include a diff, just a clear description of the issue and fix, posted as an inline comment on WorktreeMcpService.test.ts at line 2658. Now I need to sort out the line/start_line fields for the inline comment. I'll just use line 2658 with start_line matching it, side RIGHT throughout, to keep things simple and avoid multi-line range errors across the duplicated block.
20. modify_pr β Effect service conventions review of the new WorktreeMcpService.checkout path: service tag, inline interface, make/layer, subpath namespace imports, dependency acquisition (yield* Foo.Foo), and error construction all follow the conventions. One test-organization issue noted inline.
Agent Credits: 229 credits
Token usage: 32 uncached input Β· 1,875,025 cache-read input Β· 148,700 cache-write input Β· 12,399 output
Agent Credits may also include non-token charges from external tools such as web research.