Skip to content

Bug: background ingestion shares the interactive RAG indexing budget and can starve it #2987

Closed

Description

@Israeltheminer

Problem

MAX_CONCURRENT_RAG_INDEXING_PER_ORG = 3 (convex/file_metadata/rag_dispatch.ts) is a single budget shared by everything that indexes: a person uploading a document in the UI, and any background source — connector syncs, crawls, email attachment ingestion.

countRagInFlight counts running plus unparked queued rows regardless of origin. A background source producing rows faster than they drain therefore holds the cap permanently, and every interactive upload parks behind it.

This is not hypothetical — it is exactly what happened in #2985: an integration minting one queued row every 5 minutes saturated the cap, and no user upload indexed on that deployment for 7 days.

Why the cap itself is right

The cap exists for a good reason, documented in place:

an unbounded batch of large uploads saturated the pool and pushed single jobs past Convex's 30-min action ceiling — the root of the "larger files didn't work consistently" report

Nothing here argues for removing it. The problem is that it is undifferentiated.

Suggested direction

  • Separate budgets, or a reserved interactive slot, so a person uploading a file never waits behind a sync backlog.
  • Prefer interactive work at promotion time — promoteQueuedRagJobs is already fair oldest-first per org; source-aware priority would fit there.
  • fileMetadata.source already distinguishes user from connector origins, so the signal needed is present.

Related

Activity

  1. Israeltheminer commented on Aug 31, 2026

    @Israeltheminer
    ContributorAuthor

    The mechanism this issue describes no longer exists on main, and what replaced it is a different shape worth re-scoping to.

    #3107 removed the per-org RAG cap. On 0.5 there is one rag.index_file pg-boss queue with a global worker concurrency of 5 (backend/jobs/runner.ts). There is no countRagInFlight, no promoteQueuedRagJobs, and no per-org budget for background work to starve.

    rag_parked survives as a column in 0010_file_metadata.sql and nothing outside that migration reads or writes it. #2986 closed on #3078, whose two named pools (ragInteractivePool, ragBackgroundPool) did not survive the port either — the closure happens to hold, because nothing parks any more.

    The 0.5 version of this concern is tenant fairness rather than starvation: one organization's bulk import can occupy all five slots and delay every other organization's interactive upload. .agents/repo.md makes cross-org sharing a boundary, so that is worth deciding on deliberately rather than inheriting.

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

    bugpriority: mediumservice: platform

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions