Rstan - loading fit object from older version of model, while current version is compiled in memory

how does rstan determine whether a model needs to be re-compiled? sometimes, ctsem users want to load old fit objects and use them for various operations, but if they have since compiled a newer model that has slightly different data structure, errors (e.g. variable not found) arise. It seems a little spooky, in that even if I have a fresh r session and load an old fit object (containing the old stanmodel and old data structure) when I try to reinitalise that (ie using the sampling function) it seems to still expect the new data structure – even without the updated package or model loaded.

There are a variety of criteria. One of which is that if the stanmodel object was created with an older version of RStan, we cannot trust it and have to recompile. However, stanfit objects might be ok even if the stanmodel object within it is out of date.

yes the old stanfit object (as loaded in r) is fine, except it somehow links to the newer compiled c++, which is a problem because the newer c++ may contain small changes in data structure. I can work around it, just wondered if there was a recommended way to handle this kind of thing, because it seemed pretty weird that it would be able to find the newer compiled version (in memory or temp files somewhere I guess) even in a fresh r session.