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 6a71ccb27d
commit 49b77ef3fc
2 changed files with 9 additions and 10 deletions
+7 -7
View File
@@ -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: "<session-context></session-context>" }],
}
// #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()
})
})
})