Skip to content

MCP backfill_fold cannot resume after interrupt; no progress field #1461

Description

@Widthdom

Summary

backfill_fold does not support resume-after-interrupt. If the process is killed mid-flight (SIGKILL, OOM, MCP transport drop), the next invocation restarts the backfill from the first row. There is no checkpoint, no --resume flag, and the response carries no progress metadata a client could use to drive its own retry logic.

Evidence

  • src/CodeIndex/Mcp/McpToolHandlers.cs:1813BackfillFoldedColumns(...) is called as a single unbroken loop.
  • Reproducer:
    1. Start backfill_fold against a 1M-row table.
    2. Kill the process after 5 seconds.
    3. Observe that the next backfill_fold invocation restarts from row 1, throwing away the work that already completed.

Impact

  • Long-running backfills on large monorepos cannot tolerate any interruption; users either succeed end-to-end or fully restart.
  • Response payload has no rows_done / rows_total, so a client cannot estimate when it might finish.

Proposed direction

  • Persist a checkpoint row id (or a last_processed_at column) after every N rows so the next invocation can resume from there.
  • Add a progress field to the streaming/MCP response: { rows_done, rows_total, fraction }.
  • Optional: a --resume / --restart CLI flag to make resume vs full restart explicit.

Repro env

  • Branch: main @ 2ee912d (release v1.21.0)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions