fix(schema): self-heal generation_log writes on half-migrated state

A cron-triggered generation can run right after a deploy, before any
admin_init migration pass — inserts carrying the new agent_role /
prompt_version columns would fail silently on the old schema and lose
the cost row. Two-sided heal: (1) log_api_call/log_image_generation
retry the insert without the v0.18.0 columns when it fails; (2) the
db-version check now also runs on cron requests (init + wp_doing_cron),
so the schema migrates on the first cron hit, not the first admin visit.

Agent-Session: pipeline-v2-phase1-engineer-20260612
This commit is contained in:
peptiderepo
2026-06-11 04:33:22 +00:00
committed by peptiderepo
parent 50da840553
commit c5e2a73e42
3 changed files with 59 additions and 20 deletions

View File

@@ -95,6 +95,10 @@ behavior change** to the Economy (single-pass) and multi-step publish paths.
### Fixed
- ARCHITECTURE.md documented the multi-step edit stage as `edit`; the code has always
written `polish`. Canonicalized to **`polish`** everywhere.
- Half-migrated-schema hardening: generation_log inserts retry without the new audit
columns when the columns are missing (a cron run right after deploy no longer loses cost
rows), and the db-version self-heal now also runs on cron requests (`init` +
`wp_doing_cron()`), not only on `admin_init`.
## [0.17.0] - 2026-06-11