fix(start-work): use updateSessionAgent instead of clearSessionAgent to prevent Prometheus fallback
This commit is contained in:
@@ -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()
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user