You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
agent: a renewal instant that passes during host suspend is not acted on after resume — no wall-clock renewal check at stream establishment #218
A credential issued 2026-10-25 ~20:37 UTC (24h TTL) had its renewal point at ~12:37 UTC the next day. The agent's host (a VM on a laptop) was suspended across that instant. After resume, the agent re-established its sync stream (18:58 UTC), reported flows normally, and by 19:07 UTC had attempted no renewal — the journal shows reconnects, late-delivered buffered windows (correctly, with no gap), and steady reports, but not one renewal line, with expiry 90 minutes away. The entire one-third safety margin was consumed by the suspension, silently.
Mechanism: the renewal timer runs on monotonic time, which pauses with the host, so after resume it still believes hours remain. The wall-clock half of the scheduling (added with the renewal-robustness work) evidently does not cover an instant that passed during suspension, and nothing compares the wall clock to the renewal point at stream (re)establishment, where the agent demonstrably has connectivity.
Consequences are bounded — past expiry the agent's expired-retry path (≤5 min cadence) renews within the grace, and the control plane's pre-expiry directive and stream bound turn the expiry into a reconnect rather than an outage — but the margin exists so renewal happens before the cliff, and suspension defeats it invisibly. Host suspend is the laptop shape of a real production family: VM pause and live migration.
Suggested fix shape: at stream establishment, and on each heartbeat tick, compare the wall clock to the renewal point and renew immediately when past it. Both are moments the agent is provably connected; neither adds polling.
Found on a release-gate run, with v0.4.3 agents; the relevant agent code is unchanged on main.
Two live runs of the fix from #244, on agents built from main at af42131, in Linux VMs on a laptop whose host was put to sleep across the renewal point.
Run 1: a 14-minute sleep, 30-minute credentials. Three agents were frozen across their renewal points and renewed within 11 ms of each other at the moment of wake, about three minutes before expiry. None logged the new warning, and none of their sync streams dropped. Renewing in the same instant, with heartbeats seconds apart, means the ordinary renewal timers fired at wake: the VM's monotonic clock had caught up.
Run 2: an 18-hour sleep, 18-hour credentials. Three agents were frozen from before their renewal points (03:40 to 03:56) until wake at 10:15:55, 47 seconds before expiry. All three renewed once, at 10:15:55.6. One of them took the new path:
level=WARN msg="the renewal point passed while the timer was not running (the host was suspended or paused); renewing now" renew_at=2026-11-11T09:40:50.607Z wall_clock=2026-11-11T10:15:55.117-06:00
level=INFO msg="credential renewed"
The other two renewed with no warning. Each agent's heartbeat send failed on the dead connection and its stream was re-established within about a second.
What this shows.
The wall-clock check works in real conditions: the right warning, one renewal, no further attempts.
At wake both the renewal timer and the heartbeat's check were ready at once, and which one the renewer took differed per agent. So on this setup the timer catches up on wake after a short sleep and after a long one, and the code before agent: renew when the renewal point passed while the host was suspended #244 would also have renewed at wake in both runs.
The failure this issue reported, no renewal for at least nine minutes after resume with the stream re-established, was therefore not reproduced, and its mechanism is not established by these runs. The description's premise (the timer standing still after resume) did not hold in either of them. Whatever differed on the original occasion, a renewal point that has passed is now acted on at the next stream establishment or heartbeat whether or not the timer fires.
If it is seen again on a build with #244, the journal around the resume is the evidence to keep: whether the warning appears, and how long after sync stream established the renewal comes.
Activity
avi-papineni commentedon Nov 11, 2026
Two live runs of the fix from #244, on agents built from
mainat af42131, in Linux VMs on a laptop whose host was put to sleep across the renewal point.Run 1: a 14-minute sleep, 30-minute credentials. Three agents were frozen across their renewal points and renewed within 11 ms of each other at the moment of wake, about three minutes before expiry. None logged the new warning, and none of their sync streams dropped. Renewing in the same instant, with heartbeats seconds apart, means the ordinary renewal timers fired at wake: the VM's monotonic clock had caught up.
Run 2: an 18-hour sleep, 18-hour credentials. Three agents were frozen from before their renewal points (03:40 to 03:56) until wake at 10:15:55, 47 seconds before expiry. All three renewed once, at 10:15:55.6. One of them took the new path:
The other two renewed with no warning. Each agent's heartbeat send failed on the dead connection and its stream was re-established within about a second.
What this shows.
If it is seen again on a build with #244, the journal around the resume is the evidence to keep: whether the warning appears, and how long after
sync stream establishedthe renewal comes.Generated by Claude Code