From 31aca2b66ffb5c1f7a67d2696b5c2d07c5e1c971 Mon Sep 17 00:00:00 2001 From: Virgil Date: Thu, 2 Apr 2026 00:33:10 +0000 Subject: [PATCH] fix(agentic): mark handoff sessions as handed_off Co-Authored-By: Virgil --- pkg/agentic/commands_session.go | 4 ++-- pkg/agentic/commands_session_test.go | 2 +- pkg/agentic/prep.go | 2 +- pkg/agentic/session.go | 4 ++-- pkg/agentic/session_test.go | 12 ++++++------ 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/pkg/agentic/commands_session.go b/pkg/agentic/commands_session.go index c41195f..fc4023a 100644 --- a/pkg/agentic/commands_session.go +++ b/pkg/agentic/commands_session.go @@ -16,8 +16,8 @@ func (s *PrepSubsystem) registerSessionCommands() { c.Command("agentic:session/start", core.Command{Description: "Start a stored session for a plan", Action: s.cmdSessionStart}) c.Command("session/continue", core.Command{Description: "Continue a stored session from saved context", Action: s.cmdSessionContinue}) c.Command("agentic:session/continue", core.Command{Description: "Continue a stored session from saved context", Action: s.cmdSessionContinue}) - c.Command("session/handoff", core.Command{Description: "Pause a stored session with handoff context", Action: s.cmdSessionHandoff}) - c.Command("agentic:session/handoff", core.Command{Description: "Pause a stored session with handoff context", Action: s.cmdSessionHandoff}) + c.Command("session/handoff", core.Command{Description: "Hand off a stored session with context for the next agent", Action: s.cmdSessionHandoff}) + c.Command("agentic:session/handoff", core.Command{Description: "Hand off a stored session with context for the next agent", Action: s.cmdSessionHandoff}) c.Command("session/end", core.Command{Description: "End a stored session with status, summary, and handoff notes", Action: s.cmdSessionEnd}) c.Command("agentic:session/end", core.Command{Description: "End a stored session with status, summary, and handoff notes", Action: s.cmdSessionEnd}) c.Command("session/complete", core.Command{Description: "Mark a stored session completed with status, summary, and handoff notes", Action: s.cmdSessionEnd}) diff --git a/pkg/agentic/commands_session_test.go b/pkg/agentic/commands_session_test.go index b37908d..e296a28 100644 --- a/pkg/agentic/commands_session_test.go +++ b/pkg/agentic/commands_session_test.go @@ -238,7 +238,7 @@ func TestCommandsSession_CmdSessionHandoff_Good(t *testing.T) { cached, err := readSessionCache("ses-handoff") require.NoError(t, err) require.NotNil(t, cached) - assert.Equal(t, "paused", cached.Status) + assert.Equal(t, "handed_off", cached.Status) assert.NotEmpty(t, cached.Handoff) } diff --git a/pkg/agentic/prep.go b/pkg/agentic/prep.go index 195c0f6..9eaae4e 100644 --- a/pkg/agentic/prep.go +++ b/pkg/agentic/prep.go @@ -220,7 +220,7 @@ func (s *PrepSubsystem) OnStartup(ctx context.Context) core.Result { c.Action("session.complete", s.handleSessionEnd).Description = "Mark a session completed with status, summary, and handoff notes" c.Action("session.log", s.handleSessionLog).Description = "Append a typed work-log entry to a stored session" c.Action("session.artifact", s.handleSessionArtifact).Description = "Record a created, modified, deleted, or reviewed artifact for a session" - c.Action("session.handoff", s.handleSessionHandoff).Description = "Pause a session with handoff notes for the next agent" + c.Action("session.handoff", s.handleSessionHandoff).Description = "Hand off a session with notes for the next agent" c.Action("session.resume", s.handleSessionResume).Description = "Resume a paused or handed-off session from local cache" c.Action("session.replay", s.handleSessionReplay).Description = "Build replay context for a session from work logs and artifacts" c.Action("state.set", s.handleStateSet).Description = "Store shared plan state for later sessions" diff --git a/pkg/agentic/session.go b/pkg/agentic/session.go index 660ed4d..55d9f1e 100644 --- a/pkg/agentic/session.go +++ b/pkg/agentic/session.go @@ -343,7 +343,7 @@ func (s *PrepSubsystem) registerSessionTools(server *mcp.Server) { mcp.AddTool(server, &mcp.Tool{ Name: "session_handoff", - Description: "Prepare a stored session for handoff and pause it with summary, blockers, and next-step context.", + Description: "Prepare a stored session for handoff and mark it handed_off with summary, blockers, and next-step context.", }, s.sessionHandoff) mcp.AddTool(server, &mcp.Tool{ @@ -588,7 +588,7 @@ func (s *PrepSubsystem) sessionHandoff(ctx context.Context, _ *mcp.CallToolReque "blockers": cleanStrings(input.Blockers), "context_for_next": input.ContextForNext, } - session.Status = "paused" + session.Status = "handed_off" session.UpdatedAt = time.Now().Format(time.RFC3339) if err := writeSessionCache(&session); err != nil { diff --git a/pkg/agentic/session_test.go b/pkg/agentic/session_test.go index 7b458df..7719595 100644 --- a/pkg/agentic/session_test.go +++ b/pkg/agentic/session_test.go @@ -226,7 +226,7 @@ func TestSession_HandleSessionEnd_Good_HandoffNotes(t *testing.T) { var payload map[string]any parseResult := core.JSONUnmarshalString(bodyResult.Value.(string), &payload) require.True(t, parseResult.OK) - require.Equal(t, "paused", payload["status"]) + require.Equal(t, "handed_off", payload["status"]) require.Equal(t, "Ready for review", payload["summary"]) handoffNotes, ok := payload["handoff_notes"].(map[string]any) @@ -235,7 +235,7 @@ func TestSession_HandleSessionEnd_Good_HandoffNotes(t *testing.T) { assert.Equal(t, []any{"Run the verifier"}, handoffNotes["next_steps"]) assert.Equal(t, []any{"Needs input"}, handoffNotes["blockers"]) - _, _ = w.Write([]byte(`{"data":{"session_id":"ses_handoff","agent_type":"codex","status":"paused","summary":"Ready for review","handoff_notes":{"summary":"Ready for review","next_steps":["Run the verifier"],"blockers":["Needs input"]}}}`)) + _, _ = w.Write([]byte(`{"data":{"session_id":"ses_handoff","agent_type":"codex","status":"handed_off","summary":"Ready for review","handoff_notes":{"summary":"Ready for review","next_steps":["Run the verifier"],"blockers":["Needs input"]}}}`)) case "/v1/brain/remember": require.Equal(t, http.MethodPost, r.Method) require.Equal(t, "Bearer secret-token", r.Header.Get("Authorization")) @@ -265,7 +265,7 @@ func TestSession_HandleSessionEnd_Good_HandoffNotes(t *testing.T) { subsystem := testPrepWithPlatformServer(t, server, "secret-token") result := subsystem.handleSessionEnd(context.Background(), core.NewOptions( core.Option{Key: "session_id", Value: "ses_handoff"}, - core.Option{Key: "status", Value: "paused"}, + core.Option{Key: "status", Value: "handed_off"}, core.Option{Key: "summary", Value: "Ready for review"}, core.Option{Key: "handoff_notes", Value: `{"summary":"Ready for review","next_steps":["Run the verifier"],"blockers":["Needs input"]}`}, )) @@ -273,7 +273,7 @@ func TestSession_HandleSessionEnd_Good_HandoffNotes(t *testing.T) { output, ok := result.Value.(SessionOutput) require.True(t, ok) - assert.Equal(t, "paused", output.Session.Status) + assert.Equal(t, "handed_off", output.Session.Status) assert.Equal(t, "Ready for review", output.Session.Summary) require.NotNil(t, output.Session.Handoff) assert.Equal(t, "Ready for review", output.Session.Handoff["summary"]) @@ -408,7 +408,7 @@ func TestSession_HandleSessionHandoff_Good(t *testing.T) { session, err := readSessionCache("ses_handoff") require.NoError(t, err) - assert.Equal(t, "paused", session.Status) + assert.Equal(t, "handed_off", session.Status) assert.Equal(t, "Ready for review", session.Handoff["summary"]) } @@ -434,7 +434,7 @@ func TestSession_HandleSessionResume_Good(t *testing.T) { require.NoError(t, writeSessionCache(&Session{ SessionID: "ses_resume", AgentType: "codex", - Status: "paused", + Status: "handed_off", Handoff: map[string]any{ "summary": "Ready for review", },