From a1f843c11d3445063f390f61082f47de8040338c Mon Sep 17 00:00:00 2001 From: coma Date: Mon, 26 Jan 2026 12:37:49 -0800 Subject: [PATCH] fix(convoy): ensure custom types before convoy creation Add EnsureCustomTypes call to createAutoConvoy (sling) and executeConvoyFormula (formula) to ensure the 'convoy' type is registered before attempting to create convoy beads. This fixes "validation failed: invalid issue type: convoy" errors that occurred when convoy creation was attempted before custom types were configured in the beads database. Fixes: hq-ledua Co-Authored-By: Claude Opus 4.5 --- internal/cmd/formula.go | 6 ++++++ internal/cmd/sling_convoy.go | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/internal/cmd/formula.go b/internal/cmd/formula.go index eaf6bf51..5a3f63a4 100644 --- a/internal/cmd/formula.go +++ b/internal/cmd/formula.go @@ -315,6 +315,12 @@ func executeConvoyFormula(f *formulaData, formulaName, targetRig string) error { } townBeads := filepath.Join(townRoot, ".beads") + // Ensure custom types (including 'convoy') are registered in town beads. + // This handles cases where install didn't complete or beads was initialized manually. + if err := beads.EnsureCustomTypes(townBeads); err != nil { + return fmt.Errorf("ensuring custom types: %w", err) + } + // Step 1: Create convoy bead convoyID := fmt.Sprintf("hq-cv-%s", generateFormulaShortID()) convoyTitle := fmt.Sprintf("%s: %s", formulaName, f.Description) diff --git a/internal/cmd/sling_convoy.go b/internal/cmd/sling_convoy.go index 3d04873d..821c4ab1 100644 --- a/internal/cmd/sling_convoy.go +++ b/internal/cmd/sling_convoy.go @@ -71,6 +71,12 @@ func createAutoConvoy(beadID, beadTitle string, epicID string) (string, error) { townBeads := filepath.Join(townRoot, ".beads") + // Ensure custom types (including 'convoy') are registered in town beads. + // This handles cases where install didn't complete or beads was initialized manually. + if err := beads.EnsureCustomTypes(townBeads); err != nil { + return "", fmt.Errorf("ensuring custom types: %w", err) + } + // Generate convoy ID with hq-cv- prefix for visual distinction // The hq-cv- prefix is registered in routes during gt install convoyID := fmt.Sprintf("hq-cv-%s", slingGenerateShortID())