fix(witness): Add worktree cleanup to HandleMerged (gt-7uuye)
DefaultWitnessHandler.HandleMerged was only logging a message but not actually cleaning up the polecat worktree. This left worktrees behind after merges, even though sessions were killed. Fixed by calling witness.AutoNukeIfClean which: - Verifies cleanup_status before nuking (prevents work loss) - Calls NukePolecat to kill session, remove worktree, and cleanup 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
committed by
Steve Yegge
parent
62354dfe1b
commit
261defa3b4
@@ -6,6 +6,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/steveyegge/gastown/internal/mail"
|
"github.com/steveyegge/gastown/internal/mail"
|
||||||
|
"github.com/steveyegge/gastown/internal/witness"
|
||||||
)
|
)
|
||||||
|
|
||||||
// DefaultWitnessHandler provides the default implementation for Witness protocol handlers.
|
// DefaultWitnessHandler provides the default implementation for Witness protocol handlers.
|
||||||
@@ -59,10 +60,18 @@ func (h *DefaultWitnessHandler) HandleMerged(payload *MergedPayload) error {
|
|||||||
// Continue - notification is best-effort
|
// Continue - notification is best-effort
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initiate polecat cleanup
|
// Initiate polecat cleanup using AutoNukeIfClean
|
||||||
// Note: Actual cleanup is done by a separate process/molecule
|
// This verifies cleanup_status before nuking to prevent work loss.
|
||||||
// This handler just records that cleanup is needed
|
nukeResult := witness.AutoNukeIfClean(h.WorkDir, h.Rig, payload.Polecat)
|
||||||
fmt.Fprintf(h.Output, "[Witness] ✓ Polecat %s work merged, cleanup can proceed\n", payload.Polecat)
|
if nukeResult.Nuked {
|
||||||
|
fmt.Fprintf(h.Output, "[Witness] ✓ Auto-nuked polecat %s: %s\n", payload.Polecat, nukeResult.Reason)
|
||||||
|
} else if nukeResult.Skipped {
|
||||||
|
fmt.Fprintf(h.Output, "[Witness] ⚠ Cleanup skipped for %s: %s\n", payload.Polecat, nukeResult.Reason)
|
||||||
|
} else if nukeResult.Error != nil {
|
||||||
|
fmt.Fprintf(h.Output, "[Witness] ✗ Cleanup failed for %s: %v\n", payload.Polecat, nukeResult.Error)
|
||||||
|
} else {
|
||||||
|
fmt.Fprintf(h.Output, "[Witness] ✓ Polecat %s work merged, cleanup can proceed\n", payload.Polecat)
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user