From 195ecf75789cc0c5647322b5759f21d3165ac90b Mon Sep 17 00:00:00 2001 From: benzene Date: Tue, 20 Jan 2026 14:00:13 +1300 Subject: [PATCH] fix(sling): allow auto-attach mol-polecat-work on open polecat beads --- internal/beads/handoff.go | 6 +++++- internal/cmd/sling.go | 6 ++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/internal/beads/handoff.go b/internal/beads/handoff.go index 7ab4afc5..0a2e7ee9 100644 --- a/internal/beads/handoff.go +++ b/internal/beads/handoff.go @@ -158,8 +158,12 @@ func (b *Beads) AttachMolecule(pinnedBeadID, moleculeID string) (*Issue, error) return nil, fmt.Errorf("fetching pinned bead: %w", err) } + // Allow pinned beads OR open polecat agent beads (polecats have a lifecycle, not permanent) if issue.Status != StatusPinned { - return nil, fmt.Errorf("issue %s is not pinned (status: %s)", pinnedBeadID, issue.Status) + _, role, _, ok := ParseAgentBeadID(pinnedBeadID) + if !(issue.Status == "open" && ok && role == "polecat") { + return nil, fmt.Errorf("issue %s is not pinned or open polecat (status: %s)", pinnedBeadID, issue.Status) + } } // Build attachment fields with current timestamp diff --git a/internal/cmd/sling.go b/internal/cmd/sling.go index 3c32b43e..d2885b3b 100644 --- a/internal/cmd/sling.go +++ b/internal/cmd/sling.go @@ -508,8 +508,10 @@ func runSling(cmd *cobra.Command, args []string) error { updateAgentHookBead(targetAgent, beadID, hookWorkDir, townBeadsDir) // Auto-attach mol-polecat-work to polecat agent beads - // This ensures polecats have the standard work molecule attached for guidance - if strings.Contains(targetAgent, "/polecats/") { + // This ensures polecats have the standard work molecule attached for guidance. + // Only do this for bare beads (no --on formula), since formula-on-bead + // mode already attaches the formula as a molecule. + if formulaName == "" && strings.Contains(targetAgent, "/polecats/") { if err := attachPolecatWorkMolecule(targetAgent, hookWorkDir, townRoot); err != nil { // Warn but don't fail - polecat will still work without molecule fmt.Printf("%s Could not attach work molecule: %v\n", style.Dim.Render("Warning:"), err)