_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>
Two defects that only showed up on the real machine, both of which left the
schedule frozen on a fallback plan with nothing in the logs to say so.
The plugin asked for a chat provider 0.8s before AstrBot finished loading
them, wrote a template fallback, and stamped it with today's date -- so the
next 24 hours never retried. Resolution now falls back through get_config()
(4.26.6's Context exposes nothing else) and validates the configured id with
get_provider_by_id, because a configured default is not a loaded instance.
When nothing is ready yet the round is skipped instead of downgraded, up to
DAILY_PLAN_PROVIDER_MAX_WAITS rounds.
Once the model recovered, the real plan still could not reach the archive:
the idempotency key is always daily_plan:<date> but the plan dict never
carried a version, so every rewrite re-sent v1 and the memory side rejected
it as version_conflict. The companion swallowed that -- outbox state is only
touched when enqueue accepts, and a same key/version enqueue does not. Plans
now carry a version watermark drawn from both daily_plan and its history, and
any ok=False archive response logs a warning regardless of outbox state.
Verified on the VM: provider wait counted once and no fallback written, plan
generated at v2 with 10 segments from the model, and the stored record
upserted from the 8-segment fallback to the same v2 content.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>