Skip to content

Fix worktree removal timing out on large install trees#3902

Open
jakeleventhal wants to merge 5 commits into
pingdotgg:mainfrom
jakeleventhal:t3code/fix-worktree-remove-timeout
Open

Fix worktree removal timing out on large install trees#3902
jakeleventhal wants to merge 5 commits into
pingdotgg:mainfrom
jakeleventhal:t3code/fix-worktree-remove-timeout

Merge branch 'main' into t3code/fix-worktree-remove-timeout

35a62d9
Select commit
Loading
Failed to load commit list.
MacroscopeApp / Macroscope - Effect Service Conventions succeeded Jul 15, 2026 in 1m 33s

Effect Service Conventions: No issues found

All clear

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 the changed files in scope (apps/server/src/vcs/GitVcsDriverCore.ts and apps/server/src/vcs/GitVcsDriverCore.test.ts) against the Effect service conventions.

Findings: none.

Notes on the changes:

  • Imports use namespace subpath form (import * as Schedule from "effect/Schedule", effect/Deferred, effect/Fiber, effect/testing/TestClock), consistent with existing conventions. GitCommandError remains a named import from @t3tools/contracts, which is the correct treatment for a whole-package import.
  • The new parsePorcelainWorktreePaths is a pure helper; no service definition, tag, make, or layer changes were introduced.
  • Error construction reuses the existing gitCommandContext, which exposes only sanitized fields (operation, command, cwd, argumentCount) and never raw args/output. The added GitCommandError sites use static detail strings and preserve the underlying failure as cause where one exists (retry path) while omitting cause for the timeout case, matching the established pattern in this module.
  • The retry while predicate inspects structural platform error reason tags, which is an acceptable structural check.
  • The test seam using GitVcsDriver.make with Effect.provideService(FileSystem.FileSystem, flakyFileSystem) and the Layer.provide -> Layer.provideMerge change are legitimate test wiring, not fake dependency injection. The added tests are focused coverage for the new retry/pre-delete behavior, which is appropriate since backend behavior changed.

🔍 Agent activity — reasoning, no tool calls

💭 I'm examining the diff to check for convention violations in the Effect service patterns. The changes are in GitVcsDriverCore.ts under apps/server/src/vcs/, and I'm verifying the imports follow the correct namespace conventions — like the Schedule import from the Effect library. Looking at the error handling, the code creates a GitCommandError with a static detail string and the command context, which aligns with the conventions since it's not just copying the cause message. I'm also checking the retry logic that inspects the error's _tag field to determine if it's an "Unknown" platform error — that structural predicate check is appropriate for the retry condition. I need to adjust how the repo parameter is being formatted. I'm checking how gitCommandContext and GitCommandError work together, particularly whether command arguments are being copied into error messages. The detail field here is a static string rather than copying from the cause, which is fine. I should verify whether commandContext includes args and how GitCommandError handles them, though this appears to be an existing pattern rather than something new. Looking at the imports and checking how the while predicate works with Effect.retry — the argument passed to while is the error itself, and since fileSystem.remove returns an Effect<void, PlatformError>, I'm working with a PlatformError that has a _tag property. Now I'm reviewing the Effect Service Conventions to see if there are any violations in this diff. The imports look fine, there's no new service being defined, and parsePorcelainWorktreePaths is just a pure helper being exported. The GitCommandError construction with a static detail string and the cause looks correct — the convention says not to copy cause.message into detail, and that's not what's happening here. The real question is whether spreading commandContext into the error violates the convention about not leaking raw command arguments or output. But this pattern already exists throughout the file, so it's not something new introduced by this PR. Since the instruction says not to demand unrelated repository-wide cleanup, I should check what gitCommandContext actually contains to understand if this is truly a violation or just existing practice. I'm checking the definition of gitCommandContext to verify it properly sanitizes the arguments. The gitCommandContext is properly sanitized to only expose safe fields like operation and command without leaking raw arguments, and the error construction handles the optional cause parameter correctly. I'm checking whether the retry predicate and error handling follow Effect service conventions, particularly around the use of catchIf with structural predicates. The Layer.provideMerge change in tests is justified since the test now needs ServerConfig in scope, and injecting a flaky filesystem through GitVcsDriver.make is an acceptable test seam per the conventions. The focused tests on the new retry and filesystem pre-delete behavior are appropriate for a PR with actual behavior changes, not just mechanical refactoring. Now I'm checking whether the retry predicate cause.reason._tag aligns with how Effect's PlatformError.SystemError actually structures its reason field, and examining how the test constructs the transient failure error to verify the predicate will work correctly. There's a tension between the system prompt requiring JSON schema output and the customer instructions saying to output exactly "All clear" when there are no findings. Since I must produce JSON, I'll set the state to success with the title and summary reflecting that everything is clear.


Agent Credits: 47 credits