fix(sling): allow auto-attach mol-polecat-work on open polecat beads

This commit is contained in:
benzene
2026-01-20 14:00:13 +13:00
committed by Steve Yegge
parent 5218102f49
commit 195ecf7578
2 changed files with 9 additions and 3 deletions

View File

@@ -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

View File

@@ -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)