fix(start-work): use updateSessionAgent instead of clearSessionAgent to prevent Prometheus fallback

This commit is contained in:
justsisyphus 2026-01-20 15:23:36 +09:00
parent 7ccb8fcebb
commit 18262e7b60
2 changed files with 9 additions and 10 deletions

View File

@ -379,24 +379,24 @@ describe("start-work hook", () => {
}) })
describe("session agent management", () => { describe("session agent management", () => {
test("should clear session agent when start-work command is triggered", async () => { test("should update session agent to orchestrator-sisyphus when start-work command is triggered", async () => {
// #given - spy on clearSessionAgent // #given
const clearSpy = spyOn(sessionState, "clearSessionAgent") const updateSpy = spyOn(sessionState, "updateSessionAgent")
const hook = createStartWorkHook(createMockPluginInput()) const hook = createStartWorkHook(createMockPluginInput())
const output = { const output = {
parts: [{ type: "text", text: "<session-context></session-context>" }], parts: [{ type: "text", text: "<session-context></session-context>" }],
} }
// #when - start-work command is processed // #when
await hook["chat.message"]( await hook["chat.message"](
{ sessionID: "ses-prometheus-to-sisyphus" }, { sessionID: "ses-prometheus-to-sisyphus" },
output output
) )
// #then - clearSessionAgent should be called with the sessionID // #then
expect(clearSpy).toHaveBeenCalledWith("ses-prometheus-to-sisyphus") expect(updateSpy).toHaveBeenCalledWith("ses-prometheus-to-sisyphus", "orchestrator-sisyphus")
clearSpy.mockRestore() updateSpy.mockRestore()
}) })
}) })
}) })

View File

@ -10,7 +10,7 @@ import {
clearBoulderState, clearBoulderState,
} from "../../features/boulder-state" } from "../../features/boulder-state"
import { log } from "../../shared/logger" 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" export const HOOK_NAME = "start-work"
@ -71,8 +71,7 @@ export function createStartWorkHook(ctx: PluginInput) {
sessionID: input.sessionID, sessionID: input.sessionID,
}) })
// Clear previous session agent (e.g., Prometheus) to allow mode transition updateSessionAgent(input.sessionID, "orchestrator-sisyphus")
clearSessionAgent(input.sessionID)
const existingState = readBoulderState(ctx.directory) const existingState = readBoulderState(ctx.directory)
const sessionId = input.sessionID const sessionId = input.sessionID