Skip to content

Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.

Go

fix(migrate): restore unique migration prefixes after the 362 collision (#7319)

Bohan Jiang18f130a5d98c
diff --git a/server/internal/migrations/migrations_lint_test.go b/server/internal/migrations/migrations_lint_test.go
index a6e95589aa..48c932c190 100644
--- a/server/internal/migrations/migrations_lint_test.go
+++ b/server/internal/migrations/migrations_lint_test.go
@@ -14,12 +14,12 @@ import (
const maxLegacyMigrationPrefix = 148
+// legacyDuplicateMigrationStems lists prefixes that were already duplicated
+// before this lint existed. It is a frozen historical record, not an escape
+// hatch: a new collision must be renumbered instead of added here. Prefix 362
+// was briefly listed and is deliberately absent again — the later of the two
+// migrations was renumbered to 376, which its idempotent DDL made safe.
var legacyDuplicateMigrationStems = map[string][]string{
- // 362 is not historical: two PRs took the prefix within the same hour and
- // both merged. It is listed here rather than renamed because the runner
- // keys the ledger on the full stem, so renaming a migration that already
- // ran would re-run it in every environment that has it.
- "362": {"362_agent_task_durable_work_dir", "362_plugin_hook_engine"},
"020": {"020_issue_number", "020_task_session"},
"026": {"026_comment_reactions", "026_task_messages"},
"029": {"029_attachment", "029_daemon_token", "029_drop_daemon_pairing"},
diff --git a/server/migrations/362_agent_task_durable_work_dir.up.sql b/server/migrations/362_agent_task_durable_work_dir.up.sql
deleted file mode 100644
index dff2610c4f..0000000000
--- a/server/migrations/362_agent_task_durable_work_dir.up.sql
+++ /dev/null
@@ -1,5 +0,0 @@
--- Records the durable directory that replaces a disposable task worktree
--- after the daemon has confirmed that worktree was finalized and removed.
--- NULL means no such handoff was reported, so clients must keep using work_dir.
-ALTER TABLE agent_task_queue
-ADD COLUMN IF NOT EXISTS durable_work_dir TEXT;
diff --git a/server/migrations/362_agent_task_durable_work_dir.down.sql b/server/migrations/376_agent_task_durable_work_dir.down.sql
similarity index 100%
rename from server/migrations/362_agent_task_durable_work_dir.down.sql
rename to server/migrations/376_agent_task_durable_work_dir.down.sql
diff --git a/server/migrations/376_agent_task_durable_work_dir.up.sql b/server/migrations/376_agent_task_durable_work_dir.up.sql
new file mode 100644
index 0000000000..e6836c9afb
--- /dev/null
+++ b/server/migrations/376_agent_task_durable_work_dir.up.sql
@@ -0,0 +1,11 @@
+-- Records the durable directory that replaces a disposable task worktree
+-- after the daemon has confirmed that worktree was finalized and removed.
+-- NULL means no such handoff was reported, so clients must keep using work_dir.
+--
+-- Renumbered from 362: #7176 and #7182 both took prefix 362 before either
+-- merged, and neither had shipped in a release when the collision was found.
+-- The runner keys schema_migrations on the full stem, so a database that
+-- already ran 362_agent_task_durable_work_dir re-runs this file under the new
+-- stem; the DDL is idempotent, so that replay is a no-op. Keep it that way.
+ALTER TABLE agent_task_queue
+ADD COLUMN IF NOT EXISTS durable_work_dir TEXT;