feat(agentic): add poke command alias

Co-Authored-By: Virgil <virgil@lethean.io>
This commit is contained in:
Virgil 2026-04-02 03:36:31 +00:00
parent cf7b26d450
commit e5bd8ccc7e
2 changed files with 27 additions and 0 deletions

View file

@ -32,6 +32,8 @@ func (s *PrepSubsystem) registerCommands(ctx context.Context) {
c.Command("agentic:dispatch/shutdown", core.Command{Description: "Freeze the dispatch queue gracefully", Action: s.cmdDispatchShutdown})
c.Command("dispatch/shutdown-now", core.Command{Description: "Hard stop the dispatch queue and kill running agents", Action: s.cmdDispatchShutdownNow})
c.Command("agentic:dispatch/shutdown-now", core.Command{Description: "Hard stop the dispatch queue and kill running agents", Action: s.cmdDispatchShutdownNow})
c.Command("poke", core.Command{Description: "Drain the dispatch queue immediately", Action: s.cmdPoke})
c.Command("agentic:poke", core.Command{Description: "Drain the dispatch queue immediately", Action: s.cmdPoke})
c.Command("prep", core.Command{Description: "Prepare a workspace: clone repo, build prompt", Action: s.cmdPrep})
c.Command("prep-workspace", core.Command{Description: "Prepare a workspace: clone repo, build prompt", Action: s.cmdPrep})
c.Command("agentic:prep-workspace", core.Command{Description: "Prepare a workspace: clone repo, build prompt", Action: s.cmdPrep})
@ -277,6 +279,12 @@ func (s *PrepSubsystem) cmdDispatchShutdownNow(_ core.Options) core.Result {
return core.Result{Value: output, OK: true}
}
func (s *PrepSubsystem) cmdPoke(_ core.Options) core.Result {
s.Poke()
core.Print(nil, "queue poke requested")
return core.Result{OK: true}
}
func (s *PrepSubsystem) runDispatchLoop(label string) core.Result {
ctx := s.commandContext()
core.Print(nil, "core-agent %s running (pid %s)", label, core.Env("PID"))

View file

@ -1423,6 +1423,23 @@ func TestCommands_CmdDispatchShutdownNow_Good(t *testing.T) {
assert.Contains(t, output, "killed all agents")
}
func TestCommands_CmdPoke_Good(t *testing.T) {
s, c := testPrepWithCore(t, nil)
called := false
c.Action("runner.poke", func(_ context.Context, _ core.Options) core.Result {
called = true
return core.Result{OK: true}
})
output := captureStdout(t, func() {
r := s.cmdPoke(core.NewOptions())
assert.True(t, r.OK)
})
assert.True(t, called)
assert.Contains(t, output, "queue poke requested")
}
func TestCommands_ParseIntStr_Good(t *testing.T) {
assert.Equal(t, 42, parseIntString("42"))
assert.Equal(t, 123, parseIntString("issue-123"))
@ -1454,6 +1471,8 @@ func TestCommands_RegisterCommands_Good_AllRegistered(t *testing.T) {
assert.Contains(t, cmds, "agentic:dispatch/shutdown")
assert.Contains(t, cmds, "dispatch/shutdown-now")
assert.Contains(t, cmds, "agentic:dispatch/shutdown-now")
assert.Contains(t, cmds, "poke")
assert.Contains(t, cmds, "agentic:poke")
assert.Contains(t, cmds, "prep")
assert.Contains(t, cmds, "agentic:prep-workspace")
assert.Contains(t, cmds, "resume")