Skip to content

[Bug]: Background watcher fails on large projects: 30s health check timeout too short #218

@vbourdeix

Description

@vbourdeix

Bug Description

Description

When running grepai watch --background on a large project (~1717 files, Angular/TypeScript), the background watcher always fails with:

Error: timeout waiting for process to become ready after 30s

The initial scan + embedding phase takes significantly longer than 30s, so the health check kills the process before indexing completes.

Environment

  • grepai v0.35.0
  • macOS (Apple Silicon)
  • Ollama with nomic-embed-text (responding in ~300ms per embedding)
  • Project: ~1717 source files (TypeScript/Angular)

When running in foreground, the indexing does progress (files get scanned and embedded) but never completes before the background health check kills it.

Steps to Reproduce

  1. grepai init in a project with ~1500+ files
  2. grepai watch --background
  3. Process starts scanning/embedding but gets killed after 30s health check timeout

Workaround attempts

  • Running in foreground (grepai watch --no-ui) works but the process gets killed when the terminal closes
  • Reduced parallelism to 1 in config — doesn't help because the 30s timeout is on the health check, not on Ollama
  • With default parallelism (0/unlimited), Ollama gets saturated and most embeddings fail with context canceled

Expected Behavior

The --background mode should either:

  • Have a configurable health check timeout (e.g. --timeout 300)
  • Or consider the process "ready" as soon as it starts watching, not after the initial scan completes
  • Or perform the initial scan asynchronously after reporting readiness

Actual Behavior

The --background mode health check kills the watcher process after 30s if the initial scan hasn't completed. On a ~1717 file project with Ollama (nomic-embed-text, ~300ms per embedding), the scan needs
several minutes. The process is terminated before any file gets persisted to the index, resulting in Files indexed: 0 every time. Running in foreground shows the indexing does progress normally, confirming
the issue is specifically with the background health check timeout.

grepai Version

v0.35.0

Operating System

macOS

Embedding Provider

Ollama

Relevant Logs

[grepai-watch] Starting grepai watch in /path/to/project
  [grepai-watch] Provider: ollama (nomic-embed-text)
  [grepai-watch] Backend: gob
  [grepai-watch] Performing initial scan...
  [grepai-watch] [STOPPED] /path/to/project - shutdown timeout

Configuration

Checklist

  • I have searched existing issues to avoid duplicates
  • I am using the latest version of grepai

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions