From e5bd8ccc7edf986be41e59a8d816eedecd82417b Mon Sep 17 00:00:00 2001 From: Virgil Date: Thu, 2 Apr 2026 03:36:31 +0000 Subject: [PATCH] feat(agentic): add poke command alias Co-Authored-By: Virgil --- pkg/agentic/commands.go | 8 ++++++++ pkg/agentic/commands_test.go | 19 +++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/pkg/agentic/commands.go b/pkg/agentic/commands.go index 4936029..36fecbf 100644 --- a/pkg/agentic/commands.go +++ b/pkg/agentic/commands.go @@ -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")) diff --git a/pkg/agentic/commands_test.go b/pkg/agentic/commands_test.go index 6f7e935..5283f0a 100644 --- a/pkg/agentic/commands_test.go +++ b/pkg/agentic/commands_test.go @@ -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")