Skip to content

feat(indexing): replace the no-op re-index with a confirmed retry of failed ingestions#72

Merged
jaymeklein merged 1 commit into
mainfrom
feat/indexing-retry-failed
Jul 20, 2026
Merged

feat(indexing): replace the no-op re-index with a confirmed retry of failed ingestions#72
jaymeklein merged 1 commit into
mainfrom
feat/indexing-retry-failed

Conversation

@jaymeklein

Copy link
Copy Markdown
Owner

What

Replaces the Indexing page's per-collection Re-index / Index all button — which did nothing — with a Retry failed action that re-ingests the collection's failed documents, behind a confirmation.

Why

Tracing the old button, index_collection is a no-op: BM25 lives in the auto-maintained chunks.text_tsv generated column, so there is nothing to rebuild (see api/services/indexing.py). A gap in coverage is never a missing index — it is an unfinished ingestion, split into in-flight (finishing on their own) and failed (stuck). Only the failed ones are actionable, and fixing them means re-ingesting (which re-embeds), so the button now does that.

How

  • The button only appears when col.failed > 0; clicking opens a ConfirmDialog that states the cost (re-embeds from the stored file, spends provider quota; in-flight docs are left alone). Confirm calls the existing bulk retry.
  • The bulk retry could previously only scope by collection name substring — unsafe for a per-collection action ("leis" also matches "leis-antigas"). Added an exact-id filter: JobListQuery.collection_id + a CollectionIdSpec (one new spec + one line in build_specs, the module's documented extension point). Integration test pins the two-overlapping-names case so a sibling is never swept in.
  • useRetryFailedJobs now also invalidates the index overview, so retried docs visibly move failed → ingesting.
  • The page header no longer claims a manual re-index exists.

Cleanup

Removes the now-orphaned useIndexCollection hook and api.indexCollection client method (no remaining callers; YAGNI). The backend /index endpoint stays — it is a deliberately-retained, tested public API.

Gate

ruff + mypy + unit/integration green (adds the scoping test); UI typecheck clean; docs/openapi.yaml regenerated (adds collection_id to both jobs endpoints).

Follow-up (not in this PR)

The Documents page still has a per-document "Index" button that fires the same no-op; flagged separately to decide whether that state is even reachable and, if so, point it at re-ingestion.

…failed ingestions

The per-collection re-index button called a no-op task: BM25 is the
auto-maintained chunks.text_tsv generated column, so there is nothing to
rebuild. A coverage gap is an unfinished ingestion, so the useful action is
re-ingesting the failed documents (which re-embeds them) behind a confirmation.

The button now shows only when a collection has failed documents and, on
confirm, runs the existing bulk retry scoped to that collection. Scoping needs
an exact id, not the queue filter's name substring (which would sweep a sibling
whose name merely contains the same text), so add JobListQuery.collection_id
and a CollectionIdSpec, with a test that pins the overlapping-name case. Also
invalidate the index overview after a retry, correct the page header, and
remove the now-orphaned useIndexCollection hook and client method.
@jaymeklein
jaymeklein merged commit f3957cc into main Jul 20, 2026
8 checks passed
@jaymeklein
jaymeklein deleted the feat/indexing-retry-failed branch July 20, 2026 12:06
jaymeklein pushed a commit that referenced this pull request Jul 21, 2026
Integrate the live MCP rate-limit (#70), sticky pagination (#71), and
indexing retry-failed (#72) work that landed on main.

Resolved two conflicts in the MCP layer: build_mcp_middleware keeps #70's
live rate_limit_rpm callable alongside this branch's per-user
resolve_principal, dropping the now-obsolete master_key param (auth is
DB-backed via authenticate_api_key, which already handles the master key).
The middleware tests construct TokenBucketRateLimiter with a callable to
match #70's new signature.
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.

1 participant