Right Code, Wrong Version: Evaluating Temporal Robustness in Repository-Level Code Retrieval

Code assistants answer questions by retrieving from repository indexes, and those indexes often hold more than one version of the same code: a release branch beside main, an index that was never rebuilt, or a vendored copy. A retriever that returns the right function from the wrong version produces an answer that looks grounded but is false for the code the user runs. We measure this failure on 41 real code locations that changed between two consecutive releases of six Python libraries (arrow, attrs, click, httpx, marshmallow and rich). Both releases are indexed together, every query is scored against each release as the target, and Git decides which code is valid. With Cohere embed-v4.0, a wrong-version chunk outranks the valid one in 44% of cases when the target is the older release and 17% when it is the newer one. Reranking with rerank-v4.0-pro does not reduce this (52% and 11%), and giving the reranker revision and commit-date metadata does not help either (54% and 10%). A Git validity filter applied after reranking removes wrong-version results entirely and raises Recall@1 at the older release from 0.05 to 0.29. In a command-a-03-2025 agent, the filter cut wrong-version answers from 4 to 2 out of 24, and both remaining errors came from the model's own knowledge, not from retrieved code. Version validity has to be enforced by Git inside retrieval. Rankers and language models do not enforce it. Code, data and workshop slides: https://github.com/dunia-hub/cohere-workshops Supported by API credits from a Cohere Labs Catalyst Grant.

Authors

Publication Details

Journal
Zenodo (CERN European Organization for Nuclear Research)
Published
2026-11-30
DOI
https://doi.org/10.5281/zenodo.24678971
Primary Topic
Software Engineering Research
Type
article
Field-Weighted Citation Impact
0.00
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
NOV
article

Right Code, Wrong Version: Evaluating Temporal Robustness in Repository-Level Code Retrieval

Fatuma Yattani
Zenodo (CERN European Organization for Nuclear Research)
Software Engineering Research
article

Right Code, Wrong Version: Evaluating Temporal Robustness in Repository-Level Code Retrieval

Fatuma Yattani
article en

Abstract

Code assistants answer questions by retrieving from repository indexes, and those indexes often hold more than one version of the same code: a release branch beside main, an index that was never rebuilt, or a vendored copy. A retriever that returns the right function from the wrong version produces an answer that looks grounded but is false for the code the user runs. We measure this failure on 41 real code locations that changed between two consecutive releases of six Python libraries (arrow, attrs, click, httpx, marshmallow and rich). Both releases are indexed together, every query is scored against each release as the target, and Git decides which code is valid. With Cohere embed-v4.0, a wrong-version chunk outranks the valid one in 44% of cases when the target is the older release and 17% when it is the newer one. Reranking with rerank-v4.0-pro does not reduce this (52% and 11%), and giving the reranker revision and commit-date metadata does not help either (54% and 10%). A Git validity filter applied after reranking removes wrong-version results entirely and raises Recall@1 at the older release from 0.05 to 0.29. In a command-a-03-2025 agent, the filter cut wrong-version answers from 4 to 2 out of 24, and both remaining errors came from the model's own knowledge, not from retrieved code. Version validity has to be enforced by Git inside retrieval. Rankers and language models do not enforce it. Code, data and workshop slides: https://github.com/dunia-hub/cohere-workshops Supported by API credits from a Cohere Labs Catalyst Grant.

Zenodo (CERN European Organization for Nuclear Research)
Software Engineering Research
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.

Laika access coming soon
Right Code, Wrong Version: Evaluating Temporal Robustness in Repository-Level Code Retrieval — Fatuma Yattani · Zenodo (CERN European Organization for Nuclear Research) (2026) | TGRS Research Map | TGRS