Skip to content

fix: Stop setup discovery wedge and IPC fan-out at launch#2257

Merged
charlesvien merged 2 commits into
mainfrom
05-20-stop_setup_discovery_from_wedging_on_boot
May 20, 2026
Merged

fix: Stop setup discovery wedge and IPC fan-out at launch#2257
charlesvien merged 2 commits into
mainfrom
05-20-stop_setup_discovery_from_wedging_on_boot

Conversation

@charlesvien
Copy link
Copy Markdown
Member

@charlesvien charlesvien commented May 20, 2026

Problem

App boot freezes when a persisted "running" discovery state auto-restarts a tree-sitter parse storm and per-task workspace creates fan out across IPC.

Changes

  1. Persist running/error discovery as "error" so boots no longer auto-restart it
  2. Gate setup discovery to "idle" in both the useSetupDiscovery hook and SetupRunService.startSetup
  3. Cap repo parse to 500 files and skip files over 256KB, yielding to the event loop after each file
  4. Add a 60s timeout and AbortSignal support to LlmGatewayService requests
  5. Batch cloud workspace reconcile into one tRPC mutation backed by a single createCloudMany insert
  6. Skip getTaskPrStatus query for cloud tasks without a cloudPrUrl

How did you test this?

Manually with Rafa as test subject

  Evidence from Rafa's log (boot 1, ~12s to freeze):
  - 12:06:31.891 query enrichment.detectPosthogInstallState started — never completed (sync tree-sitter parse storm against the PostHog monorepo)
  - 12:06:34.293 mutation agent.start against /Users/rafael/Documents/posthog/posthog — never completed
  - 12:06:42.103 last log line, then 20s of silence, then user force-quit
  - Boot 2 fired the identical sequence; same discoveryStatus: idle rehydration, same hang

Publish to changelog?

no

Copy link
Copy Markdown
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@charlesvien charlesvien changed the title Stop setup discovery from wedging on boot fix: Stop setup discovery from wedging on boot May 20, 2026
@charlesvien charlesvien marked this pull request as ready for review May 20, 2026 15:30
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 20, 2026

Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 1
apps/code/src/main/services/enrichment/service.ts:347-351
The `totalCandidates` field logs `posthogFiles.length`, which is the count of ALL files in the repo (before language filtering), not the number of parseable candidates. When the cap fires, `toParse.length` is exactly `MAX_FILES_TO_PARSE`, so the useful missing piece is how many total language-supported files existed before the cap truncated the list. Consider renaming the field to clarify its meaning.

```suggestion
        log.info("Capping repo parse to keep main process responsive", {
          repoPath,
          totalRepoFiles: posthogFiles.length,
          parseLimit: MAX_FILES_TO_PARSE,
        });
```

Reviews (1): Last reviewed commit: "Stop setup discovery from wedging on boo..." | Re-trigger Greptile

Comment thread apps/code/src/main/services/enrichment/service.ts
@charlesvien charlesvien changed the title fix: Stop setup discovery from wedging on boot fix: Stop setup discovery wedge and IPC fan-out at launch May 20, 2026
@charlesvien charlesvien added the Create Release This will trigger a new release label May 20, 2026
@charlesvien charlesvien merged commit 890696c into main May 20, 2026
16 checks passed
@charlesvien charlesvien deleted the 05-20-stop_setup_discovery_from_wedging_on_boot branch May 20, 2026 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Create Release This will trigger a new release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants