Repository navigation
Description
Problem Description
Each run of the rag-ingest Workflow embeds every file again. The incremental indexer (src/devops_cli/ai/rag/indexer.py) skips a file whose content hash is in its cache file, and it reads and writes that file under DEVOPS_CLI_DATA_DIR. The WorkflowTemplate rag-ingest sets DEVOPS_CLI_DATA_DIR=/home/devops/.data on the volume home, which is an emptyDir. So each pod starts with no cache, clones again, and embeds each chunk again.
The CronWorkflow runs every 3 minutes with concurrencyPolicy: Forbid. A run that takes more than 3 minutes is followed at once by the next one, so the ingest embeds the full set without a stop, and the local embedding model (ai.tasks.embedding.model) gets a constant load.
Evidence, 2026-11-27
- After fix(k8s): the Argo controller manages namespace devops for rag-ingest #5289 (release 0.228.2), the first run
rag-ingest-1795804020ran from 18:27:00 to 19:40:30 UTC (73.5 minutes) and endedSucceeded. - The next run
rag-ingest-1795808520started at 19:42:00 UTC and still runs at 19:55 UTC, with no change in the indexed repositories that needs a full embed.
Expected Behavior
A run after a complete run embeds only the files whose content changed. The skip state outlives the pod: for example, the run compares the content hashes with the points that Qdrant already holds, or keeps the cache file on a volume that outlives the pod. A run with no change ends within one schedule period.
Acceptance Criteria
- A test: an ingest whose store already holds the points of each file, with no cache file on disk, embeds no chunk.
- Pending a person or an agent after the release: two runs in a row with no repository change; the second ends in less than 3 minutes and embeds no chunk.
Related
- fix(k8s): the Argo controller manages namespace devops for rag-ingest #5289 (the Workflow runs on Argo v4), feat(k8s): Keep the RAG index current on poll and push #3589 (keep the index current on poll and push).
Proposed design
Problem statement
The rag-ingest Workflow embeds every file on each run. The indexer keeps its skip state in a cache file under DEVOPS_CLI_DATA_DIR, and the workflow pod mounts that directory as an emptyDir. Each run starts with no state, clones again and embeds the full workspace again.
Acceptance criteria
Requirement: Skip state comes from the store
The indexer SHALL treat a file as unchanged when the store holds its current content hash, with no cache file on disk.
Scenario: Store already holds every file
- WHEN a test calls
index_workspaceon a workspace of two files with a fake store that holds each file's currentcontent_hash, and the cache directory holds no cache file - THEN the fake embedder records no call, and the run returns
skipped_files2 andtotal_chunks0
Requirement: Changed file embeds again
The indexer SHALL embed a file whose content hash differs from the hash that the store holds.
Scenario: One file changed
- WHEN a test indexes a workspace of two files with a fake store that holds a stale hash for one file and the current hash of the other
- THEN the fake embedder records the chunks of the changed file and no chunk of the unchanged file
Requirement: Points of a deleted file are purged
The indexer SHALL delete the points of a file that the store holds and the workspace no longer has.
Scenario: File removed from the workspace
- WHEN a test indexes a workspace with no cache file, and a fake store holds points for a file that the workspace lacks and reports a non-zero count for its project
- THEN the fake store records a
delete_points_by_filescall with the path of the missing file, and the run returnsremoved_files1
Requirement: A failed store read stops the run
The indexer MUST stop with the error of the store read and MUST NOT embed every file.
Scenario: Store read fails
- WHEN a test indexes a workspace with no cache file and a fake store whose payload read raises
DevOpsCLIError - THEN
index_workspaceraises that error and the fake embedder records no call
Requirement: Pending a person after the merge
The rag-ingest Workflow MUST end a second run with no repository change in less than 3 minutes and MUST embed no chunk.
Scenario: Two runs in a row after the release
- WHEN a person watches two
rag-ingestruns in a row after the release, with no change in the indexed repositories - THEN the second run ends in less than 3 minutes and its log shows no embedded chunk
Existing Tool Considered
No alternatives check has run on this issue. The need is to read the state that the store already holds, and the Qdrant client that the repository already uses (src/devops_cli/ai/rag/qdrant.py) covers it: each point payload carries content_hash, and the indexer already calls scroll_points with with_payload=True (src/devops_cli/ai/rag/indexer.py). The change adds no library. Written cost of the code that the fix adds: about 1 500 tokens to write the store read and its tests, about 400 tokens for each later fix, and about 2 hours of elapsed time.
Key questions
- Where does the skip state live so that it outlives the pod?: The run reads the content hashes from the points that the store holds for each scanned project. The cache file stays a local record, and the store wins for the projects that the run scans. (best practice) [sources: src/devops_cli/ai/rag/indexer.py, k8s/devops/workflowtemplate-rag-ingest.yaml]
- Chosen: Read the hashes from the store. The store is already durable, each payload carries
content_hash, and the client already reads payloads. No cluster change is needed, and the read also finds the points of deleted files. - Rejected: Keep the cache file on a PersistentVolumeClaim. A claim adds a cluster resource with its own lifecycle and a manifest check, and the cache can still disagree with the store.
- Rejected: Copy the cache file to the object store. It adds a second durable copy of state that the store already holds, and a new client path.
- Chosen: Read the hashes from the store. The store is already durable, each payload carries
- Which data does a point payload hold that identifies the version of a file?:
_build_chunk_pointwritesfile_path,project_name,content_hashandindexed_atin each point payload, next to the chunk fields. [sources: src/devops_cli/ai/rag/indexer.py] - Why does the cache not survive a
rag-ingestrun?:WorkspaceIndexerkeepscache_fileunder the data directory. The WorkflowTemplate setsDEVOPS_CLI_DATA_DIR=/home/devops/.dataon thehomevolume, which is anemptyDir. [sources: src/devops_cli/ai/rag/indexer.py, k8s/devops/workflowtemplate-rag-ingest.yaml] - Does the store state replace the cache file, or only fill its gaps?: The store state replaces the cache file for the projects that the run scans. The file keeps the state of projects that the run does not scan. (best practice) [sources: src/devops_cli/ai/rag/indexer.py]
- Chosen: Store wins for the scanned projects. A stale file entry can then never skip a file whose points the store no longer holds.
- Rejected: File wins where it has an entry. A stale entry hides lost points, and the fix would depend on the file again.
- Rejected: Remove the cache file.
_check_project_points_intactreads it as a fallback, and many tests set it.
- How does the indexer read the hashes without loading the whole collection?: It pages
scroll_pointswithwith_payload=Trueand theproject_namefilter, for each scanned project and collection, until a page is short. A client withoutscroll_pointskeeps the cache file behavior. (best practice) [sources: src/devops_cli/ai/rag/indexer.py]- Chosen: Page
scroll_pointsper project and collection, payload only. The payload read is small next to an embed, and paging bounds the memory of a large collection. - Rejected: Read every point of the collection at once. A large collection would hold every payload in memory.
- Rejected: Skip the store read when the cache file is empty. That is the state of every pod, so the defect stays.
- Chosen: Page
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
dan-petty commentedon Nov 27, 2026
The embedding model gets constant load and each run takes over 70 minutes, causing sustained performance degradation.devops-cli-service commentedon Nov 27, 2026
Next step: the alternatives check records a verdict. See the section Proposed design of the body.
dan-petty commentedon Nov 27, 2026
More evidence, 2026-11-27 23:08 UTC: the runs with no repository change take as long as the first one.
rag-ingest-1795804020rag-ingest-1795813020rag-ingest-1795817520The run that started at 19:42 UTC ended before 20:57 UTC. Each new run starts within 90 seconds of the end of the last one. PR #7478 holds the fix.
devops-cli-service commentedon Nov 27, 2026
Released in v0.229.5: https://github.com/dan-petty/devops-cli/releases/tag/v0.229.5
devops-cli-service commentedon Nov 28, 2026
Live since 2026-11-28 02:40 UTC