Faulty caching logic

It seems there is some funky caching logic. I’ll retag a file and it will say I have typos, citing old code. Mangling code also happens in other ways that I can’t explain away through caching. For example, it will say things like

Looking at the provided codebase context, I can see an issue with the Response.kt file. The error method in the companion object has syntax errors and parameter naming issues:

fun error(message: String, code: String, detailerrorMessage: String, field: String? = nul): Error > = 
   Error(message = message, errors = listOf(ErrorInfo(code, detail, field)))age, field))

There are several problems here:

  1. nul should be null
  2. detailerrorMessage is used as a parameter but then detail is used in the constructor
  3. There’s a syntax error at the end with age, field))

when in fact the code is

fun error(message: String, code: String, detail: String, field: String? = null): Error =
            Error(message = message, errors = listOf(ErrorInfo(code, detail, field)))

This is with Claude 3.7, but it happens with other models (Google, OpenAI) too.

Oh yes this is so frustrating, to always have to remind it to reload the file to pick up my manual coding. Not even that work every time.

I’m on Linux using VSCode

Hey @esafak @magnushammar Does this happens within long conversations or in a new chat too? This looks very suspicious in kind of context window restrictions. On what OS you are and what Cody version? And what IDE are you using?

Thank you

It happens even in the first response.

IntelliJ IDEA 2024.3.5 (Ultimate Edition)
Build #IU-243.26053.27, built on March 16, 2025
MacOS 15.4.1, Cody 7.92.0

1 Like

I have another example from today that I think is related.

I created a ./sourcegraph/*.rule.md. but didn’t get it to work so I included it manually instead with @.

When I edit this file, the changes are not picked up unless I force a index rebuild.

To ensure a collaborative editing experience, any referenced file that is saved would need to get “re-indexed”.

The problem is not fully deterministic so I assume that it is a bug. Sometimes it do pick up the changes without rebuilding the index.

CODY:
sourcegraph.cody-ai
Version 1.93.1747152335
Last Updated 2025-05-13, 20:55:03

VSCODE
Version: 1.100.0
Commit: 19e0f9e681ecb8e5c09d8784acaa601316ca4571
Date: 2025-05-07T12:48:53.763Z
Electron: 34.5.1
ElectronBuildId: 11369351
Chromium: 132.0.6834.210
Node.js: 20.19.0
V8: 13.2.152.41-electron.0
OS: Linux x64 6.11.0-24-generic

@magnushammar The problem with the rule feature actually lies in its implementation. Sometimes the rules are picked up correctly, sometimes not.
You can see this, for example, when you open a new chat and the rules are not displayed automatically but you switch between two open editor tabs and the rules are then suddenly displayed.

Now when you say it I think I noticed that.

The other problem still stands though, its not rule-related per se, but an example of the “caching”-problem with referenced files in general, text or code.

It’s not a smooth interaction when I always have to remember to force it to rebuild index and reload files after my code edits.

How do you re-build and re-index in IntelliJ, just @ them again?