Skip to content

Configurable file watching and manual rescan for reference material directories #619

Closed

Description

@haiphucnguyen

Background

When a reference material directory is added to a project, Askimo automatically watches it for file changes. On Linux this relies on the kernel's inotify interface, which requires one watch per file and directory. The default system limit (fs.inotify.max_user_watches) is relatively low and can easily be exhausted by large reference material trees.

The issue may happens to other OS as well, so the solution does not check only Linux OS

Problems

  • Silent failure - When the inotify watch limit is exceeded, Askimo throws an exception internally and stops registering watches. The user receives no feedback and incorrectly assumes that change detection is active.
projectCoordinators.forEach { coordinator ->
    try {
        coordinator.startWatching(scope)
    } catch (e: Exception) {
        log.error("Failed to start watching for project $projectId", e)
        // ← user never knows watching failed
    }
}

The user sees a successful "Indexed" status but change detection is silently broken.

  • No user control over watching - Watching is always enabled for reference material directories. Users with large directories, resource-constrained systems, or no need for automatic change detection have no way to opt out.

  • If watching is disabled or has silently failed, the only way to pick up file changes is to remove and re-add the reference material, or scanning the entire project again - a poor experience.

Proposal

  • Per-source watch toggle - Add a watchForChanges flag to KnowledgeSourceConfig so the preference is persisted per knowledge source. The UI should expose this when adding or editing a reference material directory.
  • Manual "Rescan" action - Add a rescan button in the UI that emits a ProjectReIndexEvent (or a more targeted per-source event) to trigger ProjectIndexer's existing re-index flow on demand.
  • Surface watch failures - When startWatching() throws, emit an AppErrorEvent (already used elsewhere in ProjectIndexer) with a user-friendly message, e.g.: "File watching could not be started for this directory. You can rescan manually or increase fs.inotify.max_user_watches."

Refer the original request from #617

Activity

  1. added
    enhancement
    help wanted
    on Aug 8, 2026
  2. DenisFrolkov commented on Aug 21, 2026

    @DenisFrolkov
    Contributor

    Hi @haiphucnguyen, is this still open? I'd like to give it a try

  3. haiphucnguyen commented on Aug 21, 2026

    @haiphucnguyen
    CollaboratorAuthor

    Hi @DenisFrolkov , it still be open. Assigned it to you, looking forward to your PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementhelp wanted

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions