fix(agentic): handle SpawnQueued IPC — actually spawn agents from queue drain

Runner's drainOne sends SpawnQueued but agentic never handled it,
creating ghost "running" entries with PID=0. Now agentic catches
SpawnQueued, calls spawnAgent, and updates status with real PID.

Co-Authored-By: Virgil <virgil@lethean.io>
This commit is contained in:
Snider 2026-03-26 14:02:56 +00:00
parent a174227a62
commit ac510fde19

View file

@ -27,6 +27,27 @@ func (s *PrepSubsystem) HandleIPCEvents(c *core.Core, msg core.Message) core.Res
s.ingestFindings(wsDir)
}
}
case messages.SpawnQueued:
// Runner asks agentic to spawn a queued workspace
wsDir := resolveWorkspace(ev.Workspace)
if wsDir == "" {
break
}
prompt := core.Concat("TASK: ", ev.Task, "\n\nResume from where you left off. Read CODEX.md for conventions. Commit when done.")
pid, outputFile, err := s.spawnAgent(ev.Agent, prompt, wsDir)
if err != nil {
break
}
// Update status with real PID
if st, serr := ReadStatus(wsDir); serr == nil {
st.PID = pid
writeStatus(wsDir, st)
if runnerSvc, ok := core.ServiceFor[workspaceTracker](c, "runner"); ok {
runnerSvc.TrackWorkspace(core.PathBase(wsDir), st)
}
}
_ = outputFile
}
return core.Result{OK: true}