Repository navigation
fix(storage): create the relay and approval tables with the schema, never cache a failed create - #1177
Merged
Conversation
Create execution_relay, run_owners, and execution_approval_questions at startup in LocalStorage.autoMigrateSchema for both SQLite and PostgreSQL using single DDL definitions shared with the lazy fallback guards. Guard fallback creation per *sqlDatabase with a mutex and a positive-only table set so concurrent goroutines in one process never race CREATE TABLE, runOwnerTable issues no DDL in steady state, and a failed CREATE TABLE is never cached. On PostgreSQL, treat SQLSTATE 23505 and 42P07 as success when the table exists after a concurrent peer finished creating it. Found by the existing-deployments smoke suite against postgres:16: "create execution_relay: duplicate key value violates unique constraint pg_type_typname_nsp_index", after which the cached error left run ownership broken until restart. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
AbirAbbas
added a commit
that referenced
this pull request
Nov 10, 2026
The candidate control plane in this suite is built from this branch, so merging the fix here runs Checks A-D against main plus #1177. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
📊 Coverage gateThresholds from
✅ Gate passedNo surface regressed past the allowed threshold and the aggregate stayed above the floor. |
Contributor
📐 Patch coverage gateThreshold: 80% on lines this PR touches vs
✅ Patch gate passedEvery surface whose lines were touched by this PR has patch coverage at or above the threshold. |
AbirAbbas
added a commit
that referenced
this pull request
Nov 10, 2026
Check C hung until its job timed out: the owned burst's bare `wait` also waited on the test nodes the shell runs in the background. Wait on the burst's own PIDs. On control plane v0.1.57 every node, stable SDKs included, registered and ran its sync and async executes, then failed the heartbeat-survival step for not being "active". That step now uses the same SMOKE_ACCEPT_HEALTH as registration, with the advancing heartbeat as the survival proof. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The patch-coverage gate measured 74% on #1177's touched control-plane lines. Drive each uncovered branch through real behaviour: an uninitialized store, a seam that fails only the second or third CREATE so the run_owners or approval-question error surfaces, autoMigrateSchema wrapping that error, nil and non-SQLState errors, and the race probe when the table is still absent. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What broke
#1174 added three tables that the control-plane store created lazily, on first use, with
CREATE TABLE IF NOT EXISTS:execution_relay,run_ownersandexecution_approval_questions. Against a realpostgres:16control plane, the existing-deployments smoke suite logged:Three problems compounded:
CREATE TABLE IF NOT EXISTS, and on Postgres the loser fails on the catalog's unique index.relayTableOnceandapprovalQuestionTableOncestored the error per db handle. After one lost race, relay writes, run ownership and approval questions failed until the control plane restarted, so on a Postgres control plane nothing streamed to the run's owner.runOwnerTableranCREATE TABLE IF NOT EXISTS run_ownerson every call, and the run-watched lookup consults it for ordinary executions.The fix
autoMigrateSchema, for SQLite and Postgres. The DDL is unchanged and each table has a single definition, so databases that already have the tables are untouched.Tests
CREATE TABLE.-race, with exactly one owner row per run.Proof against real deployments
The existing-deployments smoke suite ran on a candidate built from
mainplus this fix, run 42759516796, with 15 of 15 jobs green:pg_type_typname_nsp_index, and ownership was lost.The coverage commit after that run adds tests only. The patch-coverage gate now passes.
🤖 Generated with Claude Code