Repository navigation
Description
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_repositoryskips a repository only whenstate.jsonholds 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_reposfinds a removed repository throughrepos/*/*/state.json. In a new pod no such file exists, so a repository that a person removes fromservice.reposkeeps 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: volumehomeis anemptyDir, andDEVOPS_CLI_DATA_DIR=/home/devops/.data.src/devops_cli/ai/rag/ingest.py:recorded_head = state.get("head"), andcleanup_removed_reposglobsrepos/*/*/state.jsonunder 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/nameproject that the store holds andservice.reposdoes 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_repositoryforowner/nameat headabc123with a fake Qdrant client and a new empty data folder. - THEN The fake Qdrant client records a
set_payloadcall forproject_nameowner/namewithheadabc123, and norepos/owner/name/state.jsonexists 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_repositoryforowner/nameand the indexer raises an error fromindex_workspace. - THEN The fake Qdrant client records no
set_payloadcall that holds aheadfield.
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
abc123and intact points forowner/name, andgit ls-remotereturnsabc123. - THEN The git stub records no
clone, the indexer records noindex_workspacecall, and the result hasskippedTrue.
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
abc123in the fake Qdrant client and the points ofowner/namenot intact. - THEN The git stub records one
cloneand the indexer records oneindex_workspacecall withforceTrue.
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
cloneand the indexer records oneindex_workspacecall.
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_passwith a new empty data folder,service.repos["owner/kept"], and a fake Qdrant client that holds a point ofowner/keptand a point ofowner/gone. - THEN The fake Qdrant client records
delete_points_by_projectforowner/gonein the code collection and in the docs collection, and no delete forowner/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_passwithservice.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_projectforowner/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_repositoryforowner/name, the fake Qdrant client holds visibilityprivatefor the project, and the GitHub stub answerspublic. - THEN The fake Qdrant client records a
set_payloadcall 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_repositoryreads the fieldheadfromrepos/<owner>/<name>/state.json. It skips a repository only when that head equals the remote head and the points are intact.cleanup_removed_reposglobsrepos/*/*/state.jsonto find a removed repository. Volumehomeof WorkflowTemplaterag-ingestis anemptyDir. 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,branchandvisibilityon every point with thatproject_name. The pass writes them to both collections withset_payloadand reads them withscroll_points, the calls that the module already uses. The pass writes nostate.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_namefilter 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.
- Chosen: Payload of the points of the project. The store is already the durable record of the project, and the
- Which projects does the cleanup compare with
service.repos?: Eachproject_namethat the code collection or the docs collection holds, as one set. The cleanup compares the set with the fullservice.reposlist, not with the repositories that--reposelects. 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_namevalues 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_namevalues of the code collection only. A project with points only in the docs collection keeps its points after a removal. - Rejected: The
repos/*/*/state.jsonglob. 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.
- Chosen: The
- Which Qdrant call reads the stored head and the project names?:
scroll_pointswith the filter{"project_name": repo}returns the payload of one point of the project, which holdshead,branchandvisibility.scroll_payloadswithkeys["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 addsread_project_state,write_project_stateandlist_project_namesto it, next topoints_intact, and the pass calls them on the indexer that it already builds. The test builds a realWorkspaceIndexerover the fake Qdrant client intests/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
WorkspaceIndexerseam. The pass already builds an indexer,points_intactalready 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.
- Chosen: The
- Does the change need a change to the WorkflowTemplate or a new volume?: No. Volume
homestays anemptyDir. 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.jsonfile?: 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 keepsresolve_repo_pathsfor the tree folder and writes nostate.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
dan-petty commentedon Nov 27, 2026
Each pod re-clones and re-scans every repository, and removed repos keep stale points in Qdrant, causing performance degradation and index drift.devops-cli-service commentedon Nov 27, 2026
Next step: the alternatives check records a verdict. See the section Proposed design of the body.
devops-cli-service commentedon Nov 27, 2026
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:
Sources:
devops-cli-service commentedon Nov 28, 2026
Next step: the stage job writes the plan of the item. See the section Proposed design of the body.
test(ai): cover Qdrant error paths in WorkspaceIndexer project state (#…
devops-cli-service commentedon Nov 28, 2026
Released in v0.232.4: https://github.com/dan-petty/devops-cli/releases/tag/v0.232.4
devops-cli-service commentedon Nov 28, 2026
Live since 2026-11-28 06:56 UTC