[core/db] Retry transient 55P03 lock_timeout in ensureSchemaObject / runGuardedDdl during migrations
Package: @agent-native/[email protected] (PostgreSQL / Neon)
Summary
During production migrations across a multi-app workspace against a shared PostgreSQL database with live traffic, ensureColumnExists on application_state can fail with a DDL lock timeout (55P03) instead of retrying after a brief backoff.
Verified source details (@agent-native/[email protected])
dist/db/ddl-guard.js:383:runGuardedDdldefaultslockTimeoutto"3s"(SET LOCAL lock_timeout = '${lockTimeout}'at:391).dist/db/ddl-guard.js:374-380,407-410:isLockTimeoutErrorcatches55P03/canceling statement due to lock timeoutand returnsfalse.dist/db/ddl-guard.js:270-290:ensureSchemaObjectdoes not retry afterrunGuardedDdlreturnsfalse, re-probes once, and throwsensureSchemaObject: required schema "column application_state.writer" is still missing after a lock-timed-out DDL.dist/db/runtime-facts.js:6-35:retryOnDdlRace(:6-14) only retriesisPgCatalogRace(42P07,42710,23505onpg_type/pg_class), not55P03/ lock timeouts.
Suggested improvement
Retry transient 55P03 / lock_timeout DDL failures with bounded backoff (and/or allow configurable migration lock_timeout) inside ensureSchemaObject / runGuardedDdl or retryOnDdlRace, so transient read/transaction locks on active tables like application_state do not abort production migrations on the first 3-second contention window.
Thanks — a change to retry transient migration lock timeouts is in review at https://github.com/BuilderIO/agent-native/pull/9194; the production cause remains unconfirmed.