Skip to content

fix(host-service): let an ignore-rule change bypass the refresh interval - #9480

Open
Bruno-rose wants to merge 2 commits into
ParadevAI:mainfrom
Bruno-rose:fix/host-service-gitignore-refresh
Open

Bruno-rose wants to merge 2 commits into
ParadevAI:mainfrom
Bruno-rose:fix/host-service-gitignore-refresh

Conversation

@Bruno-rose

@Bruno-rose Bruno-rose commented Nov 7, 2026 •

Copy link
Copy Markdown

What & why

Fixes #9461.

A .gitignore edit within 5 s of the last ignored-dirs refresh hit the min-interval return. rulesChanged stayed set with nothing to retry it, so the native watcher kept skipping a folder the user had un-ignored. The min-interval check now does not apply when rulesChanged is set.

How I tested it

Failing regression test in git-watcher.test.ts with a real temp git repo. The bug was first found by checking every order of events in a small model, then reproduced against the real code.

  • packages/host-service: bun run test gives 2758 pass, 0 fail.

Checklist

  • PR title follows conventional commits (type(scope): subject)
  • bun run lint and bun run typecheck pass (CI fails on lint warnings too)
  • "Allow edits from maintainers" is checked on fork PRs
  • I have signed the CLA (the bot asks on your first PR)

Summary by cubic

Fixes #9461: a .gitignore or info/exclude edit within 5s of the last ignored-dirs refresh was dropped by the min-interval guard, leaving rulesChanged set with nothing to retry it and the native watcher still pruning a folder the user had un-ignored.

The min-interval check now skips when rulesChanged is set, so rule edits always trigger a refresh.

  • Adds a regression test that reproduces the race with consecutive rule edits against a real temp git repo.

Written for commit 3e13a08. Summary will update on new commits.

View guided diff

…efresh interval

A .gitignore or info/exclude edit within 5s of the last ignored-dir refresh
hit the min-interval early return. rulesChanged stayed set with nothing to
retry it, so the native watcher kept pruning a dir the edit had un-ignored
until some later emit happened to land outside the interval.
@coderabbitai

coderabbitai Bot commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 19 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 72a39671-be00-4725-96e7-545614d31fe8
Commits

Reviewing files that changed from the base of the PR and between 19db630 and 3e13a08.

Files selected for processing: 2

  • packages/host-service/src/events/git-watcher.test.ts
  • packages/host-service/src/events/git-watcher.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 2 files

Architecture diagram
sequenceDiagram
    participant W as GitWatcher
    participant S as IgnoredDirsState
    participant FS as File System
    participant FW as Filesystem Watcher

    Note over W,FS: Git Watcher Refresh Flow

    W->>FS: .gitignore / info/exclude change detected
    FS-->>W: File change event
    W->>S: Mark rulesChanged = true
    W->>W: Call refreshIgnoredDirs()
    W->>S: Check refreshing flag
    alt Not currently refreshing
        W->>S: Check ignore-rule staleness
        alt rulesChanged is set
            W->>W: Bypass min-interval check (NEW behavior)
            W->>FS: Refresh ignored dirs
            FS-->>W: Updated ignore rules
            W->>W: Re-evaluate native watch prune
            W->>S: Reset rulesChanged = false
            W->>S: Update lastRefreshAt timestamp
        else rulesChanged is not set
            alt Min interval elapsed
                W->>FS: Refresh ignored dirs
                FS-->>W: Updated ignore rules
                W->>S: Update lastRefreshAt timestamp
            else Min interval not elapsed
                W->>W: Skip refresh (min-interval guard)
            end
        end
    else Currently refreshing
        W->>W: Skip refresh (already in progress)
        Note over W,S: rulesChanged remains set for retry
    end

    Note over W,FW: Native watcher behavior
    W->>FW: Update watch configuration
    FW->>FS: Track only non-ignored directories
    FS-->>FW: Directory structure events
Loading

View guided diff | Re-trigger cubic

This branch has not been deployed

No deployments
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.

Git status misses changes in a folder un-ignored within 5 s of the last refresh

1 participant