Skip to content

fix(orchestration): preserve GitHub delivery retries

MacroscopeApp / Macroscope - Effect Service Conventions failed Aug 3, 2026 in 2m 14s

Effect Service Conventions: 1 issue found

  • apps/server/src/github/GitHubWaitpointStore.ts: the register:reload invariant failure constructs new Error("Inserted waitpoint could not be reloaded.") solely to populate the required cause field. Conventions prohibit manufacturing an Error merely to populate cause; make cause optional on GitHubWaitpointStoreError (or model this invariant as its own error class) and fail with structural attributes only.

One inline comment was 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.

Scope reviewed: commit 13537f5 (fix(orchestration): preserve GitHub delivery retries), the only change since the previously reviewed 25ff158. Files touched: apps/server/src/github/GitHubWaitpointService.ts, GitHubWaitpointStore.ts, and their two test files.

Verified as conforming:

  • Both GitHubWaitpointServiceShape and GitHubWaitpointStoreShape were removed and the interfaces are now declared inline in Context.Service, with the inferred shape referenced as GitHubWaitpointService["Service"]["get"] — this resolves two prior findings.
  • storeError now passes an existing GitHubWaitpointStoreError through instead of re-wrapping it, keeping the precise operation (e.g. register:reload) rather than burying it in cause — this resolves the third prior finding.
  • Effect modules are imported as subpath namespaces; local service modules (GitHubWaitpointStore, GitHubPullRequestProbe, ThreadManagementService) are namespace-imported and accessed through their module shape.
  • Dependencies are acquired from the environment via yield* inside Layer.effect; no ManagedRuntime.make, runPromise, or service-instance parameters were introduced in production code. The Layer.succeed occurrences added in the tests are legitimate test seams.
  • Error messages remain derived from structural attributes (operation), not from cause.

The only new deviation is the synthesized Error used as cause for the reload invariant in GitHubWaitpointStore.ts (lines 292-295).


🔍 Agent activity — 1 tool call

💭 I'm examining the PR diff to understand what changes were made. The diff is massive at 248k lines, which suggests the branch has diverged significantly from the merge base. Since the previous review focused on specific files in the GitHub waitpoint service, I need to identify what's changed between those commits and get a focused view of the relevant modifications. Let me query the GitHub API directly to pull the PR file list instead of trying to parse the enormous diff. I need to focus on the actual feature files in this massive PR rather than all 820 changed files. The merge base is 6154b46 and it looks like this branch is built on top of PR #2829's V2, so I should trace back through the commits to find the relevant feature changes. I need to figure out what commits are between the feature commit and the current head, which are likely rebases or merges of the base branch. Looking at the convention for schema predicates — this private constant isGitHubWaitpointStoreError should probably be exported directly rather than kept private, since the convention expects direct schema predicates to be exported. But it's being used internally within storeError, so I need to think through whether this violates the pattern or if there's a legitimate reason to keep it private here. The author already implemented the passthrough fix based on a prior review comment, so I shouldn't re-flag that. Now I need to check the operation: string and cause: unknown fields in the error definition, then review the full files for convention compliance around exports like make and Layer.effect usage. I'm checking the error handling conventions in this file. The GitHubWaitpointStoreError follows the acceptable pattern with a multi-value operation discriminator and a Schema.Defect() cause, but I need to verify that the defect's tag and fields properly identify the failure structurally rather than relying on the message alone. Looking at the convention requirements, the error should capture stable domain context like the waitpoint ID at the call site, but it's only capturing the operation. This is a retained issue from an earlier commit that wasn't flagged before — I need to decide whether to report it now since it's within the changed scope. For the new changes: the private isGitHubWaitpointStoreError predicate isn't a violation since it's not a redundant wrapper with the same signature as storeError. But the cause field is manufacturing an Error just to populate it, which directly violates the convention against that pattern. The author should either make cause optional in the schema or create a separate error class for the reload invariant, since this error can legitimately occur without an underlying failure. This is a flaggable violation I need to raise. The operation field is now correctly preserving "register:reload" through the passthrough, which is good. Now I need to check the rest of GitHubWaitpointService.ts to verify it follows the conventions around error handling, service injection, and async patterns. I'm noticing a potential issue where errorMessage() is copying raw error text directly into the lastError persisted field, which violates the convention of keeping direct error attributes bounded and safe from arbitrary defect text. I should investigate whether this diagnostic column needs stricter handling. Looking at the actual changes in this commit, the pre-existing concerns about process.cwd() and error message copying aren't new violations. The real flag here is the manufactured Error object created just to populate the cause field — that's explicitly against convention. The test files use legitimate test seams with Layer.succeed and Crypto.make, which are fine. I've confirmed only four files changed in this commit, so the manufactured Error is the one finding worth reporting. The convention explicitly forbids manufacturing an Error just to fill the cause field, so this is a legitimate violation worth flagging. Since the check defaults to failure when findings exist, I'll post an inline comment on line 294 pointing out that cause shouldn't be omitted here — the error needs either an actual underlying cause or the field should be made optional in the schema. I'm keeping the comment focused on this specific issue rather than expanding into pre-existing problems like missing waitpoint ID context.

1. modify_pr — One convention finding in the follow-up fix commit: the register:reload invariant failure now manufactures an Error purely to satisfy the required cause field. Everything else in this commit (inlined Context.Service interfaces, GitHubWaitpointService["Service"]["get"], and store-error passthrough) matches the conventions.


Agent Credits: 93 credits