Skip to content

Fix project picker timeouts in large repos#1620

Merged
boudra merged 1 commit into
getpaseo:mainfrom
jms830:fix/large-repo-timeouts
Jun 26, 2026
Merged

Fix project picker timeouts in large repos#1620
boudra merged 1 commit into
getpaseo:mainfrom
jms830:fix/large-repo-timeouts

Conversation

@jms830

@jms830 jms830 commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Linked issue

Closes #1693

Type of change

  • Bug fix

What does this PR do

Opening a project or fetching folder-picker suggestions silently times out on large home directories. The client used a 10s request timeout for both openProject and getDirectorySuggestions, but the daemon's directory scan routinely takes longer on a big ~, so the client gave up before the daemon responded — the picker looked broken even though the daemon was still working.

This raises the client timeouts to match real scan times and debounces the suggestion query so a filesystem scan isn't fired on every keystroke:

  • daemon-client.ts: openProject 10s -> 60s (it does the most filesystem work); getDirectorySuggestions 10s -> 30s. Inline comments explain each.
  • project-picker-modal.tsx: 250ms debounce on the directory-suggestions query key.

No protocol or schema changes; client-only timeout/UX tuning.

How did you verify it

Reproduced live against a daemon running on a Linux host with a large home directory, client connected over the LAN.

Before: the folder picker returned nothing / "open" hung. Daemon ws_slow_request logs showed directory_suggestions_request completing on the daemon side but past the 10s client deadline:

durationMs: 6532
durationMs: 8443
durationMs: 10670
durationMs: 11211
durationMs: 17313

After: with the raised timeouts the same scans complete and populate the picker; the 250ms debounce stops a scan firing on every keystroke while typing a path.

Checks: npm run typecheck (app + client) passes, npm run lint 0/0, npm run format clean.

Checklist

  • One focused change. Unrelated cleanups split out.
  • npm run typecheck passes
  • npm run lint passes
  • npm run format ran (Biome)
  • UI changes include screenshots or video for every affected platform — N/A: no visual change, this is a timeout/debounce tuning fix (behavior, not appearance)
  • Tests added or updated where it made sense — covered by existing picker behavior; change is timeout/debounce constants

@greptile-apps

greptile-apps Bot commented Jun 19, 2026

Copy link
Copy Markdown

Greptile Summary

This PR fixes silent timeouts in the folder-picker on large home directories by raising the client-side request timeouts for openProject (10 s → 60 s) and getDirectorySuggestions (10 s → 30 s), and adds a 250 ms debounce so a filesystem scan is not triggered on every keystroke.

  • daemon-client.ts: Both timeout increases are narrowly scoped, clearly commented, and consistent with the daemon scan durations the author measured (durationMs up to ~17 s).
  • project-picker-modal.tsx: debouncedQuery is introduced as a second state value; the useEffect debounce is the correct tool for timer synchronization, the query key and queryFn are updated consistently, and the modal-open effect resets debouncedQuery immediately to avoid a 250 ms stale query on first open.

Confidence Score: 5/5

Safe to merge — two isolated constant changes and a straightforward debounce with no protocol or schema impact.

Both files touch only timeout constants and a debounce pattern. The modal-open reset of debouncedQuery prevents a stale query on first open, the debounce effect correctly clears the timer on cleanup, and the React Query key change is consistent with the new state. No logic paths were restructured.

No files require special attention.

Important Files Changed

Filename Overview
packages/client/src/daemon-client.ts Raises openProject timeout from 10 s to 60 s and getDirectorySuggestions timeout from 10 s to 30 s; both changes are well-commented and correctly sized to the documented daemon scan durations.
packages/app/src/components/project-picker-modal.tsx Adds a debouncedQuery state and a 250 ms useEffect debounce that throttles the React Query key, preventing a filesystem scan on every keystroke; the modal-open effect correctly resets debouncedQuery immediately so the first open is not delayed.

Sequence Diagram

%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
    participant User
    participant Modal as ProjectPickerModal
    participant RQ as React Query
    participant Client as DaemonClient
    participant Daemon

    User->>Modal: types character
    Modal->>Modal: setQuery(text) — immediate
    Note over Modal: 250 ms debounce timer starts (clears previous)
    Modal->>Modal: options filtered against live query (instant)

    User->>Modal: stops typing
    Note over Modal: 250 ms elapses
    Modal->>Modal: setDebouncedQuery(query)
    Modal->>RQ: queryKey changes → fetch triggered
    RQ->>Client: getDirectorySuggestions(debouncedQuery)
    Note over Client: timeout = 30 000 ms (was 10 000 ms)
    Client->>Daemon: directory_suggestions_request
    Daemon-->>Client: directory_suggestions_response
    Client-->>RQ: entries[]
    RQ-->>Modal: directorySuggestionsQuery.data
    Modal-->>User: picker list updated

    User->>Modal: selects a path
    Modal->>Client: openProject(path)
    Note over Client: timeout = 60 000 ms (was 10 000 ms)
    Client->>Daemon: open_project_request
    Daemon-->>Client: open_project_response
    Client-->>Modal: result
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
    participant User
    participant Modal as ProjectPickerModal
    participant RQ as React Query
    participant Client as DaemonClient
    participant Daemon

    User->>Modal: types character
    Modal->>Modal: setQuery(text) — immediate
    Note over Modal: 250 ms debounce timer starts (clears previous)
    Modal->>Modal: options filtered against live query (instant)

    User->>Modal: stops typing
    Note over Modal: 250 ms elapses
    Modal->>Modal: setDebouncedQuery(query)
    Modal->>RQ: queryKey changes → fetch triggered
    RQ->>Client: getDirectorySuggestions(debouncedQuery)
    Note over Client: timeout = 30 000 ms (was 10 000 ms)
    Client->>Daemon: directory_suggestions_request
    Daemon-->>Client: directory_suggestions_response
    Client-->>RQ: entries[]
    RQ-->>Modal: directorySuggestionsQuery.data
    Modal-->>User: picker list updated

    User->>Modal: selects a path
    Modal->>Client: openProject(path)
    Note over Client: timeout = 60 000 ms (was 10 000 ms)
    Client->>Daemon: open_project_request
    Daemon-->>Client: open_project_response
    Client-->>Modal: result
Loading

Reviews (2): Last reviewed commit: "fix(client): raise project-open & direct..." | Re-trigger Greptile

timeout: 10000,
// Large local repos (e.g. a big monorepo/brain checkout) need >10s for the
// daemon to resolve the path, detect git, and materialize the workspace.
timeout: 60000,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 PR description has the timeout values swapped

The PR description states "openProject timeout from 10s to 30s" and "getDirectorySuggestions timeout from 10s to 60s", but the implementation does the opposite: openProject is raised to 60 000 ms and getDirectorySuggestions to 30 000 ms. The inline code comments and the logic both support the as-implemented values (opening a project does more work), so the code appears correct, but the PR description is misleading for anyone reviewing the change or reading git history.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Obsolete after the PR body/title refresh and re-review: both the PR body and implementation now say openProject is 60s and getDirectorySuggestions is 30s.

…arge repos

openProject 10s->60s and getDirectorySuggestions 10s->30s + debounce the
project-picker query 250ms. On large local repos the daemon's path-resolve and
home-tree scan take several seconds; firing per-keystroke against a 10s timeout
raced the suggestion list to empty (e.g. ~/gi found a hit but ~/gith blanked)
and surfaced a spurious 'Timeout waiting for message (10000ms)' on add.
@boudra boudra force-pushed the fix/large-repo-timeouts branch from 45347b1 to cb2ff7d Compare June 26, 2026 12:43
@boudra

boudra commented Jun 26, 2026

Copy link
Copy Markdown
Collaborator

Checked the Greptile note after rebasing: the PR body and the code both say openProject is 60s and getDirectorySuggestions is 30s, so there isn't a timeout-order mismatch to fix. Also checked the debounce question: this repo does not have an installed debounce hook library like usehooks/usehookz/react-use/ahooks, and there is no shared app useDebouncedValue hook to reuse.

@boudra boudra changed the title fix(client): raise project-open and directory-suggestion timeouts for large repos Fix project picker timeouts in large repos Jun 26, 2026
@boudra boudra merged commit 85322c5 into getpaseo:main Jun 26, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Project open / folder-picker suggestions time out on large home directories

2 participants