diff --git a/src/hooks/start-work/index.test.ts b/src/hooks/start-work/index.test.ts index 73c1f2a59..7731649a0 100644 --- a/src/hooks/start-work/index.test.ts +++ b/src/hooks/start-work/index.test.ts @@ -379,24 +379,24 @@ describe("start-work hook", () => { }) describe("session agent management", () => { - test("should clear session agent when start-work command is triggered", async () => { - // #given - spy on clearSessionAgent - const clearSpy = spyOn(sessionState, "clearSessionAgent") + test("should update session agent to orchestrator-sisyphus when start-work command is triggered", async () => { + // #given + const updateSpy = spyOn(sessionState, "updateSessionAgent") const hook = createStartWorkHook(createMockPluginInput()) const output = { parts: [{ type: "text", text: "" }], } - // #when - start-work command is processed + // #when await hook["chat.message"]( { sessionID: "ses-prometheus-to-sisyphus" }, output ) - // #then - clearSessionAgent should be called with the sessionID - expect(clearSpy).toHaveBeenCalledWith("ses-prometheus-to-sisyphus") - clearSpy.mockRestore() + // #then + expect(updateSpy).toHaveBeenCalledWith("ses-prometheus-to-sisyphus", "orchestrator-sisyphus") + updateSpy.mockRestore() }) }) }) diff --git a/src/hooks/start-work/index.ts b/src/hooks/start-work/index.ts index 25df6b114..704435a5e 100644 --- a/src/hooks/start-work/index.ts +++ b/src/hooks/start-work/index.ts @@ -10,7 +10,7 @@ import { clearBoulderState, } from "../../features/boulder-state" import { log } from "../../shared/logger" -import { clearSessionAgent } from "../../features/claude-code-session-state" +import { updateSessionAgent } from "../../features/claude-code-session-state" export const HOOK_NAME = "start-work" @@ -71,8 +71,7 @@ export function createStartWorkHook(ctx: PluginInput) { sessionID: input.sessionID, }) - // Clear previous session agent (e.g., Prometheus) to allow mode transition - clearSessionAgent(input.sessionID) + updateSessionAgent(input.sessionID, "orchestrator-sisyphus") const existingState = readBoulderState(ctx.directory) const sessionId = input.sessionID