fix(sling): Format cross-rig beads as external refs in convoy tracking

When creating auto-convoys for cross-rig beads (e.g., gt-xxx or gu-xxx),
the tracking relation was failing because bd couldn't resolve the bead ID
from HQ context. Now formats non-HQ beads as external:prefix:id for proper
resolution.

Fixes convoy tracking for cross-rig sling operations.
This commit is contained in:
gastown/witness
2026-01-04 20:28:28 -05:00
committed by akatz-ai
parent 86c4ea2fa6
commit e11bcb931e

View File

@@ -1240,7 +1240,16 @@ func createAutoConvoy(beadID, beadTitle string) (string, error) {
}
// Add tracking relation: convoy tracks the issue
depArgs := []string{"dep", "add", convoyID, beadID, "--type=tracks"}
// Format cross-prefix beads as external refs so bd can resolve them
trackBeadID := beadID
if !strings.HasPrefix(beadID, "hq-") {
parts := strings.SplitN(beadID, "-", 3)
if len(parts) >= 2 {
rigPrefix := parts[0] + "-" + parts[1]
trackBeadID = fmt.Sprintf("external:%s:%s", rigPrefix, beadID)
}
}
depArgs := []string{"dep", "add", convoyID, trackBeadID, "--type=tracks"}
depCmd := exec.Command("bd", depArgs...)
depCmd.Dir = townBeads
depCmd.Stderr = os.Stderr
@@ -1278,10 +1287,10 @@ func runBatchSling(beadIDs []string, rigName string, townBeadsDir string) error
// Track results for summary
type slingResult struct {
beadID string
polecat string
success bool
errMsg string
beadID string
polecat string
success bool
errMsg string
}
results := make([]slingResult, 0, len(beadIDs))