Skip to content

fix(ai): rag-ingest pods lose the head and removed-repo records #7479

Done

Description

@dan-petty

Problem Description

The rag-ingest pass keeps two more records under DEVOPS_CLI_DATA_DIR, which WorkflowTemplate rag-ingest mounts on an emptyDir: the head of each repository (repos/<owner>/<name>/state.json, resolve_repo_paths in src/devops_cli/ai/rag/ingest.py) and, through the same files, the list of the repositories that the pass ingested. Each new pod starts with neither record.

  • ingest_repository skips a repository only when state.json holds the current head. In a new pod the file is missing, so each run clones each configured repository again and scans each file, also when no head moved.
  • cleanup_removed_repos finds a removed repository through repos/*/*/state.json. In a new pod no such file exists, so a repository that a person removes from service.repos keeps its points in Qdrant.

The fix of #7467 lets a new pod skip the embed of unchanged files, but not the clone and the scan, and not the cleanup.

Evidence

  • k8s/devops/workflowtemplate-rag-ingest.yaml: volume home is an emptyDir, and DEVOPS_CLI_DATA_DIR=/home/devops/.data.
  • src/devops_cli/ai/rag/ingest.py: recorded_head = state.get("head"), and cleanup_removed_repos globs repos/*/*/state.json under the data folder.

Expected Behavior

A pass with a new data folder skips a repository whose head did not move, and removes the points of a repository that service.repos no longer lists. The records outlive the pod with no new stateful volume, for example in the payload of the points or in a point of the store.

Acceptance Criteria

  • A test: a second pass with a new data folder at the same head makes no clone and embeds no chunk.
  • A test: a pass with a new data folder deletes the points of an owner/name project that the store holds and service.repos does not list, and keeps the points of each other project.

Source

Source: #7478

Alternatives check of 2026-11-27: in-use.
The repository already uses this tool.
Tool: qdrant/qdrant (https://github.com/qdrant/qdrant), Apache-2.0, last activity 2026-11-27, maintained.
Reason: Searches found Qdrant, the vector store the ingest pass already writes to: its per-point payloads outlive the pod and can be read by filter or deleted by project, so it covers the head record, the skip and the removed-repo cleanup.

Covers:

  • Payload on each point keeps head, branch and visibility across pods
  • Scroll with payload returns the stored head and the project names
  • Set payload and delete by a project_name filter need no new collection
  • No new dependency, volume or stateful service

Lacks:

  • No transaction ties the head write to the point writes
  • A project with no points keeps no state at all
  • Needs a keyword index on project_name for the filter and scroll

Proposed design

Problem statement

WorkflowTemplate rag-ingest mounts an emptyDir as the data folder of the pod. Each new pod loses repos/<owner>/<name>/state.json, which holds the head of each repository and the list of the repositories that the pass ingested. The pass then clones and scans every configured repository at each run. It also keeps the points of a repository that a person removed from service.repos. The change keeps the head in the payload of the project's points in Qdrant, so the record outlives the pod.

Acceptance criteria

Requirement: Head record in the store

The pass SHALL write the head, the branch and the visibility of a repository to the payload of the points of that repository in the vector store.

Scenario: A pass records the head in the store

  • WHEN The test runs ingest_repository for owner/name at head abc123 with a fake Qdrant client and a new empty data folder.
  • THEN The fake Qdrant client records a set_payload call for project_name owner/name with head abc123, and no repos/owner/name/state.json exists under the data folder.

Requirement: Head write after the index

The pass SHALL write the head of a repository only after the index of that repository succeeds.

Scenario: A failed index writes no head

  • WHEN The test runs ingest_repository for owner/name and the indexer raises an error from index_workspace.
  • THEN The fake Qdrant client records no set_payload call that holds a head field.

Requirement: Skip at an unchanged head

The pass SHALL make no clone and SHALL embed no chunk for a repository whose stored head equals the remote head and whose points are intact, also when the data folder is new.

Scenario: A second pass in a new data folder skips the repository

  • WHEN The test runs a pass with a new empty data folder, the fake Qdrant client holds head abc123 and intact points for owner/name, and git ls-remote returns abc123.
  • THEN The git stub records no clone, the indexer records no index_workspace call, and the result has skipped True.

Requirement: Re-index at a lost point set

The pass MUST clone and index a repository when the store holds the current head and the points of the repository are not intact.

Scenario: A pass with no intact points indexes the repository

  • WHEN The test runs a pass with head abc123 in the fake Qdrant client and the points of owner/name not intact.
  • THEN The git stub records one clone and the indexer records one index_workspace call with force True.

Requirement: A repository with no point is indexed

The pass SHALL clone and index a repository that the store holds no point for.

Scenario: A new repository has no stored head

  • WHEN The test runs a pass and the fake Qdrant client holds no point for owner/name.
  • THEN The git stub records one clone and the indexer records one index_workspace call.

Requirement: Cleanup of a removed repository

The pass SHALL delete the points of each project that the store holds and service.repos does not list, and SHALL keep the points of each project that service.repos lists.

Scenario: A pass with a new data folder removes an unlisted project

  • WHEN The test runs run_ingest_pass with a new empty data folder, service.repos ["owner/kept"], and a fake Qdrant client that holds a point of owner/kept and a point of owner/gone.
  • THEN The fake Qdrant client records delete_points_by_project for owner/gone in the code collection and in the docs collection, and no delete for owner/kept.

Requirement: Cleanup respects the repository filter

The pass MUST compare the stored projects with the full service.repos list, not with the repositories that --repo selects.

Scenario: A filtered pass keeps a configured repository

  • WHEN The test runs run_ingest_pass with service.repos ["owner/a", "owner/b"], repo_filter ["owner/a"], and a fake Qdrant client that holds a point of each project.
  • THEN The fake Qdrant client records no delete_points_by_project for owner/b.

Requirement: Visibility change rewrites the points

The pass SHALL rewrite the visibility payload of a repository whose stored visibility differs from the answer of GitHub.

Scenario: A changed visibility updates the points

  • WHEN The test runs ingest_repository for owner/name, the fake Qdrant client holds visibility private for the project, and the GitHub stub answers public.
  • THEN The fake Qdrant client records a set_payload call with {"visibility": "public"} and the filter {"project_name": "owner/name"}.

Existing Tool Considered

The alternatives check in the issue body records verdict in-use for qdrant/qdrant (https://github.com/qdrant/qdrant, Apache-2.0, maintained). The issue body holds what the tool covers and what it lacks. The change uses the tool for the head record, the skip and the cleanup.

It handles each lack of the block. No transaction ties the head write to the point writes, so the pass writes the head after the index succeeds; a crash costs one re-index of one repository at the next run. A project with no points keeps no state, so the pass reads no head for it and indexes it. The scroll and the delete use the project_name field that delete_points_by_project already filters on, so the change adds no second field and no second index. The change adds three methods to WorkspaceIndexer and no dependency, no collection and no volume.

Key questions

  • Which records does the pass keep in the data folder, and why does a new pod lose them?: ingest_repository reads the field head from repos/<owner>/<name>/state.json. It skips a repository only when that head equals the remote head and the points are intact. cleanup_removed_repos globs repos/*/*/state.json to find a removed repository. Volume home of WorkflowTemplate rag-ingest is an emptyDir. A new pod starts with neither record. [sources: src/devops_cli/ai/rag/ingest.py, k8s/devops/workflowtemplate-rag-ingest.yaml]
  • Where does the pass keep the head so that it outlives the pod?: In the payload of each point of the project in Qdrant: the fields head, branch and visibility on every point with that project_name. The pass writes them to both collections with set_payload and reads them with scroll_points, the calls that the module already uses. The pass writes no state.json. (best practice) [sources: src/devops_cli/ai/rag/ingest.py, src/devops_cli/ai/rag/qdrant.py]
    • Chosen: Payload of the points of the project. The store is already the durable record of the project, and the project_name filter call already exists.
    • Rejected: One state point per project. It adds a point that no search returns and an id scheme for that point.
    • Rejected: A new collection for the state. It adds a collection to create, keep and delete, and the points already hold project_name.
    • Rejected: A PersistentVolumeClaim for the data folder. The issue asks for no new stateful volume, and the WorkflowTemplate runs with an emptyDir.
  • Which projects does the cleanup compare with service.repos?: Each project_name that the code collection or the docs collection holds, as one set. The cleanup compares the set with the full service.repos list, not with the repositories that --repo selects. A project with a point is exactly the project that a removal must clean. (best practice) [sources: src/devops_cli/ai/rag/ingest.py, src/devops_cli/ai/rag/qdrant.py]
    • Chosen: The project_name values of both collections, as one set. A project can hold points in one collection only, so the union of the two misses no project.
    • Rejected: The project_name values of the code collection only. A project with points only in the docs collection keeps its points after a removal.
    • Rejected: The repos/*/*/state.json glob. A new pod holds no such file, and that loss is the defect of this issue.
    • Rejected: A manifest point in the store. A second list can disagree with the points.
  • Which Qdrant call reads the stored head and the project names?: scroll_points with the filter {"project_name": repo} returns the payload of one point of the project, which holds head, branch and visibility. scroll_payloads with keys ["project_name"] walks a collection and gives each project name. A collection that does not exist reads as empty, so the pass works on a new store. The pass reads the head from the code collection. [sources: src/devops_cli/ai/rag/qdrant.py, src/devops_cli/ai/rag/ingest.py]
  • Through which seam do the pass and its tests reach the store?: WorkspaceIndexer. The change adds read_project_state, write_project_state and list_project_names to it, next to points_intact, and the pass calls them on the indexer that it already builds. The test builds a real WorkspaceIndexer over the fake Qdrant client in tests/support/fakes/qdrant.py. (best practice) [sources: src/devops_cli/ai/rag/ingest.py, src/devops_cli/ai/rag/indexer.py:922, tests/support/fakes/qdrant.py]
    • Chosen: The WorkspaceIndexer seam. The pass already builds an indexer, points_intact already reads the store there, and the test support already holds a fake Qdrant client.
    • Rejected: The Qdrant client directly in ingest.py. The pass would hold the payload schema in two places.
    • Rejected: A fake HTTP server. It is slow, and the fake client already stands at the same edge.
  • Does the change need a change to the WorkflowTemplate or a new volume?: No. Volume home stays an emptyDir. The pass writes and reads the state through the Qdrant URL and the API key that the template already sets. The change adds no volume, no PersistentVolumeClaim and no environment variable. [sources: k8s/devops/workflowtemplate-rag-ingest.yaml, src/devops_cli/ai/rag/ingest.py]
  • What does the pass do with the state.json file?: The pass stops reading it for the skip and the cleanup, and stops writing it. The store payload is the only record of the head, the branch and the visibility. The pass keeps resolve_repo_paths for the tree folder and writes no state.json. (best practice) [sources: src/devops_cli/ai/rag/ingest.py]
    • Chosen: Remove the state file. One record cannot disagree with itself, and the pod loses the file at each start.
    • Rejected: Keep the file as a cache. Two records can disagree, and the cache is empty in a new pod.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    type/bug
    scope/ai
    on Nov 27, 2026
  2. dan-petty commented on Nov 27, 2026

    @dan-petty
    OwnerAuthor
    • Priority: Each pod re-clones and re-scans every repository, and removed repos keep stale points in Qdrant, causing performance degradation and index drift.
  3. added
    source/agent
    status/new
    value/medium
    effort/medium
    priority/p1-high
    on Nov 27, 2026
  4. devops-cli-service commented on Nov 27, 2026

    @devops-cli-service
    Contributor

    Next step: the alternatives check records a verdict. See the section Proposed design of the body.

  5. devops-cli-service commented on Nov 27, 2026

    @devops-cli-service
    Contributor

    The result in the alternatives block of the issue body changed. Before this check: no check. A person decides what the new result means for the item.

    Searches (5)

    Tools considered:

    Searches run:

    • Qdrant scroll payload filter list project names by payload field, results: 5
    • Qdrant set_payload by filter update payload on points matching filter, results: 5
    • qdrant set payload points API docs, results: 5
    • qdrant documentation scroll points with payload, results: 5
    • qdrant.tech documentation payload filtering scroll delete points by filter, results: 5

    Sources:

  6. added
    status/ready
    and removed
    status/new
    on Nov 28, 2026
  7. devops-cli-service commented on Nov 28, 2026

    @devops-cli-service
    Contributor

    Next step: the stage job writes the plan of the item. See the section Proposed design of the body.

  8. added
    owner/agent
    status/in-progress
    and removed
    status/ready
    on Nov 28, 2026
  9. added
    status/in-review
    and removed
    status/in-progress
    on Nov 28, 2026
  10. removed
    status/in-review
    owner/agent
    on Nov 28, 2026
  11. devops-cli-service commented on Nov 28, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-28 06:56 UTC

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

    effort/mediumpriority/p1-highscope/aisource/agenttype/bugvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions