Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

fix: tolerate concurrent approval schema migration

Steven Enamakel4f726d703cdf
diff --git a/crates/openhuman-core/src/security/approval/store.rs b/crates/openhuman-core/src/security/approval/store.rs
index 52731e706d..0a82a21058 100644
--- a/crates/openhuman-core/src/security/approval/store.rs
+++ b/crates/openhuman-core/src/security/approval/store.rs
@@ -130,8 +130,16 @@ fn migrate_columns(conn: &Connection) -> Result<()> {
),
] {
if !have.contains(col) {
- conn.execute(ddl, params![])
- .with_context(|| format!("[approval::store] add column {col}"))?;
+ // Two cores can open the same workspace during startup (for
+ // example, a reconnecting desktop shell and its replacement).
+ // Both may observe the old schema before either ALTER commits;
+ // SQLite then reports a harmless duplicate-column race here.
+ if let Err(error) = conn.execute(ddl, params![]) {
+ if !error.to_string().contains("duplicate column name") {
+ return Err(error)
+ .with_context(|| format!("[approval::store] add column {col}"));
+ }
+ }
tracing::info!(column = col, "[approval::store] migrated v1 schema");
}
}