fix(sling): handle agent bead not found gracefully
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
+10
-2
@@ -190,7 +190,8 @@ func runSling(cmd *cobra.Command, args []string) error {
|
|||||||
// Determine target agent (self or specified)
|
// Determine target agent (self or specified)
|
||||||
var targetAgent string
|
var targetAgent string
|
||||||
var targetPane string
|
var targetPane string
|
||||||
var hookWorkDir string // Working directory for running bd hook commands
|
var hookWorkDir string // Working directory for running bd hook commands
|
||||||
|
var hookSetAtomically bool // True if hook was set during polecat spawn (skip redundant update)
|
||||||
|
|
||||||
if len(args) > 1 {
|
if len(args) > 1 {
|
||||||
target := args[1]
|
target := args[1]
|
||||||
@@ -247,6 +248,7 @@ func runSling(cmd *cobra.Command, args []string) error {
|
|||||||
targetAgent = spawnInfo.AgentID()
|
targetAgent = spawnInfo.AgentID()
|
||||||
targetPane = spawnInfo.Pane
|
targetPane = spawnInfo.Pane
|
||||||
hookWorkDir = spawnInfo.ClonePath // Run bd commands from polecat's worktree
|
hookWorkDir = spawnInfo.ClonePath // Run bd commands from polecat's worktree
|
||||||
|
hookSetAtomically = true // Hook was set during spawn (GH #gt-mzyk5)
|
||||||
|
|
||||||
// Wake witness and refinery to monitor the new polecat
|
// Wake witness and refinery to monitor the new polecat
|
||||||
wakeRigAgents(rigName)
|
wakeRigAgents(rigName)
|
||||||
@@ -278,6 +280,7 @@ func runSling(cmd *cobra.Command, args []string) error {
|
|||||||
targetAgent = spawnInfo.AgentID()
|
targetAgent = spawnInfo.AgentID()
|
||||||
targetPane = spawnInfo.Pane
|
targetPane = spawnInfo.Pane
|
||||||
hookWorkDir = spawnInfo.ClonePath
|
hookWorkDir = spawnInfo.ClonePath
|
||||||
|
hookSetAtomically = true // Hook was set during spawn (GH #gt-mzyk5)
|
||||||
|
|
||||||
// Wake witness and refinery to monitor the new polecat
|
// Wake witness and refinery to monitor the new polecat
|
||||||
wakeRigAgents(rigName)
|
wakeRigAgents(rigName)
|
||||||
@@ -505,7 +508,12 @@ func runSling(cmd *cobra.Command, args []string) error {
|
|||||||
_ = events.LogFeed(events.TypeSling, actor, events.SlingPayload(beadID, targetAgent))
|
_ = events.LogFeed(events.TypeSling, actor, events.SlingPayload(beadID, targetAgent))
|
||||||
|
|
||||||
// Update agent bead's hook_bead field (ZFC: agents track their current work)
|
// Update agent bead's hook_bead field (ZFC: agents track their current work)
|
||||||
updateAgentHookBead(targetAgent, beadID, hookWorkDir, townBeadsDir)
|
// Skip if hook was already set atomically during polecat spawn - avoids "agent bead not found"
|
||||||
|
// error when polecat redirect setup fails (GH #gt-mzyk5: agent bead created in rig beads
|
||||||
|
// but updateAgentHookBead looks in polecat's local beads if redirect is missing).
|
||||||
|
if !hookSetAtomically {
|
||||||
|
updateAgentHookBead(targetAgent, beadID, hookWorkDir, townBeadsDir)
|
||||||
|
}
|
||||||
|
|
||||||
// Auto-attach mol-polecat-work to polecat agent beads
|
// Auto-attach mol-polecat-work to polecat agent beads
|
||||||
// This ensures polecats have the standard work molecule attached for guidance.
|
// This ensures polecats have the standard work molecule attached for guidance.
|
||||||
|
|||||||
Reference in New Issue
Block a user