Skip to content

[FEAT] Show current file path in ingest progress + 'taking long' warning for slow files #183

Description

@four-bytes-robby

Problem

When brain_ingest processes a large or slow file, the progress bar stalls (e.g., at 10.8%) with no indication of WHICH file is being processed. This makes it impossible to diagnose whether a binary file slipped through detection or a legitimate text file is just slow to chunk/embed.

Solution

1. Extend ProgressCallback to include current file path

In src/ingest/index.ts, change the progress callback:

export interface ProgressUpdate {
  current: number;
  total: number;
  currentFile?: string;    // file currently being processed
  currentFileSize?: number; // size in bytes
}

export interface IngestOptions {
  // ...
  progressCallback?: (update: ProgressUpdate) => void;
}

2. Call progress callback at file start

In processFile(), right before reading the file, fire a progress update with currentFile set:

options?.progressCallback?.({ current: i + 1, total: walkedFiles.length, currentFile: filePath, currentFileSize: fileStats.size });

3. Add "slow file" warning

If a file takes >10 seconds to process, log a warning via log():

if (elapsed > 10_000) {
    log("warn", "ingest`, `Slow file (${(elapsed / 1000).toFixed(1)}s): ${filePath}`);
}

4. Log when file is skipped (too large / binary)

Log at info level when skipping large or binary files so the user can see what's being excluded:

log("info", "ingest`, `Skipped (too large, ${(fileStats.size / 1024 / 1024).toFixed(1)}MB): ${filePath}`);
log("info", "ingest`, `Skipped (binary content): ${filePath}`);

Files

  • src/ingest/index.ts — extend ProgressCallback + add file-path reporting

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions