Article chapter 06 of 08
Wake the agent when the board changes
The agent doesn't sit in a loop watching the board. A small read-only monitor checks the To do column every five minutes and only wakes the agent when the list of eligible cards changes.
The monitor doesn't change anything. It reads the cards in To do and the IDs already in Doing, and returns them in a stable format. If the output is the same as last time, nothing happens. If someone adds a card, the output changes and the agent gets a turn. That keeps the agent from burning time re-reading a board where nothing is happening, and it means every run starts with something to do.
Two details turned out to matter more than I expected.
First, an error isn't an empty board. If the monitor can't read the board, it reports a probe error, and the agent must not treat that as "no cards in To do". It retries the exact read once and then reports the problem. Before that rule existed, a failed read and a quiet board looked the same.
Second, authentication needs its own plan. The board connection uses OAuth, and at one point the cached tokens didn't carry an expiry time, so the client never refreshed them before they ran out. The fix was to configure the actual client details the provider expected, which produced a successful refresh and stored a proper expiry. The runbook now says not to undo that configuration, and not to keep re-authorising in a loop as a way around it. If a grant really is expired, there's one bounded recovery path, using the browser session that's already signed in. The agent doesn't type passwords or codes, and if a person has to sign in, it stops and says so.
Both of these are boring, and both of them are what decides whether an unattended agent quietly stops working without anyone noticing.