Skip to content

fix(ai): skip unchanged files in a run with no index cache - #7478

Merged
dan-petty merged 5 commits into
mainfrom
fix/7467-rag-ingest-skips-unchanged-files
Nov 27, 2026
Merged

dan-petty merged 5 commits into
mainfrom
fix/7467-rag-ingest-skips-unchanged-files

Conversation

@dan-petty

Copy link
Copy Markdown
Owner

Each pod of the rag-ingest Workflow starts with an empty data folder. The indexer found no cache file there, so each run embedded every chunk again: a run took 73.5 minutes, and the CronWorkflow started the next run at once.

Each point now holds the content hash of its whole file (file_hash) and the count of the chunks of that version (file_chunks). When the cache file does not hold a file, the run reads these keys of the project from Qdrant once, with a paged scroll of each collection. It skips each file that Qdrant holds whole with its current hash. It embeds an edited or incomplete file again after it deletes the old points, and it deletes the points of a deleted file. A failed read stops the run before any embed. The cache file stays a local speed-up.

Points from an earlier release hold no file hash. The first run after the release embeds each file once more. Later runs skip it.

Closes #7467

Change: openspec/changes/archive/2026-11-27-7467-rag-ingest-skips-unchanged-files/

…ore holds

The tests fail on the base: each run with a new cache folder embeds every
file again (#7467).
Each point now holds the content hash of its whole file and the count of
the chunks of that version. When the cache file does not hold the hash of
a file, the run reads the file state of its project from Qdrant with one
paged scroll of three payload keys for each collection, and skips a file
that the store holds whole and current. A new pod of the rag-ingest
Workflow thus embeds only the changed files (#7467).
Add the test of the file_hash and file_chunks keys of each point.
@dan-petty dan-petty added type/bug Type bug: the code does not do what it must scope/ai AI review pipeline, personas, prompts, LLM client, or RAG labels Nov 27, 2026
@dan-petty

Copy link
Copy Markdown
Owner Author

Proof

Fail-to-pass: the CI check Fail-to-Pass Check passed. The local run uv run devops ci fail-to-pass --base origin/main gave the same result. These changed tests fail on the base and prove the fix:

  • tests/ai/rag/test_index_skip_state_from_store.py: test_each_point_holds_the_hash_and_the_chunk_count_of_its_file, test_a_run_with_no_cache_file_embeds_no_file_that_the_store_holds, test_a_run_with_no_cache_file_embeds_only_the_edited_file_and_drops_its_old_points, test_points_with_no_file_hash_are_embedded_once_then_skipped, test_a_run_with_no_cache_file_drops_the_points_of_a_deleted_file, test_a_store_read_that_fails_stops_the_run_before_any_embed
  • tests/ai/rag/test_indexing_failure_and_resume.py::test_a_resume_with_no_cache_file_embeds_the_partly_stored_file_and_skips_the_others (the incomplete-file case of fix(ai): an interrupted rag index resumes every file whose chunks were not all stored #1296, with no cache file)
  • tests/ai/rag/test_rag_qdrant.py: the two scroll_payloads contract tests, [native] (local mode)
  • tests/ai/rag/test_qdrant_server_label.py::test_a_failed_payload_scroll_names_the_server_and_holds_no_url

test_a_run_with_its_cache_file_reads_no_store_state passes on the base and on the head: a workstation cache file still skips each file with no store read.

Local checks on the head 8350f3e

  • uv run devops ci --check --only lint,format,typecheck,docs,openspec,test-tree: all pass.
  • uv run devops ci test on the 10 covering files under tests/ai/rag/: 154 passed.
  • uv run pytest -n 4 tests/ai/rag tests/ai/test_kb.py tests/ai/research tests/commands/test_ai_rag_commands.py tests/commands/test_analyze.py tests/commands/test_rag.py tests/commands/test_ai_rag_ingest_analyze_dry_run.py: 649 passed.
  • uv run mypy src/devops_cli/ai/rag/indexer.py src/devops_cli/ai/rag/qdrant.py: no issues.

PR checks: all pass. Trivy shows neutral because code scanning cannot find the configuration trivy-image-devcontainer, which release.yml runs on main only.

Pending a person, after the release

  • Watch two rag-ingest runs in a row with no change in the indexed repositories. The first run after the release embeds each file once more, because the old points hold no file_hash. After that run, the next run ends in less than 3 minutes, and its log and its span ai.rag.read_stored_files show no embedded chunk.
  • Review the diff in tuicr (tuicr -r origin/main..HEAD).

Follow-up

@dan-petty
dan-petty marked this pull request as ready for review November 27, 2026 23:14
@dan-petty
dan-petty merged commit 60a3540 into main Nov 27, 2026
28 checks passed
@dan-petty
dan-petty deleted the fix/7467-rag-ingest-skips-unchanged-files branch November 27, 2026 23:14
dan-petty-release Bot added a commit that referenced this pull request Nov 27, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.229.5](v0.229.4...v0.229.5)
(2026-11-27)


### Bug Fixes

* **ai:** skip unchanged files in a run with no index cache
([#7478](#7478))
([60a3540](60a3540))
* **repos:** onboard requires checks of a merged template pull request
([#7477](#7477))
([46b9c95](46b9c95))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: dan-petty-release[bot] <346998822+dan-petty-release[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope/ai AI review pipeline, personas, prompts, LLM client, or RAG type/bug Type bug: the code does not do what it must

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(ai): each rag-ingest run embeds every file again

1 participant