_agenda_closed_windows scanned a fixed -3..+1 day range. Past three days of
downtime the missed windows were never settled and left no trace -- "zero
snapshots" and "not due yet" look identical from the data, which is why this
sat in the backlog for four rounds. It now scans forward from a persisted
agenda_last_settled cursor, falling back to the old three days when the cursor
is absent. Catch-up is capped at 30 days and says so in the log rather than
truncating silently. The cursor advances only after both the snapshot and the
reconciliation are written, and never moves backwards.
Two long-deferred contract deviations went with it. reconciliation_id already
carries its own "reconciliation:" prefix and got another one on top; window
snapshots used the internal snapshot id as a business key. Both now go through
_bot_personal_window_key and match the formats the frozen contract recommends.
Records already stored keep their old keys -- settlements and snapshots are
terminal per-window writes, so there is nothing left to update.
The outbox called datetime.now() directly while window attribution used the
plugin's _environment_now. The now parameter had been there all along and no
caller passed it, which is more hidden than not having it at all. All eight
call sites now pass the plugin clock; the test asserts a 2031 timestamp so a
system-clock regression cannot pass.
Companion suite 231 passed, joint E2E 135/135. VM restarted clean.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>