fix(start-work): always hand off to atlas regardless of current session agent (#3155)
/start-work is the "execute this plan with atlas" command. Previously, if the user's current session agent was sisyphus (or any non-prometheus/non-atlas agent), the hook would keep that agent instead of switching to atlas. This caused sisyphus to execute the plan. Fix: unconditionally select atlas (when registered) or sisyphus (fallback). The current session agent is irrelevant to /start-work's intent. Adds regression test: running /start-work from a sisyphus session must always hand off to atlas when atlas is available.
This commit is contained in:
@@ -456,6 +456,27 @@ You are starting a Sisyphus work session.
|
|||||||
expect(output.message.agent).toBe(getAgentListDisplayName("atlas"))
|
expect(output.message.agent).toBe(getAgentListDisplayName("atlas"))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test("should switch to Atlas even when current session is Sisyphus (regression: #3155)", async () => {
|
||||||
|
// given: user runs /start-work while in a Sisyphus session
|
||||||
|
// atlas is registered, so /start-work must always hand off to atlas
|
||||||
|
sessionState.updateSessionAgent("ses-sisyphus-to-atlas", "sisyphus")
|
||||||
|
|
||||||
|
const hook = createStartWorkHook(createMockPluginInput())
|
||||||
|
const output = {
|
||||||
|
message: {} as Record<string, unknown>,
|
||||||
|
parts: [{ type: "text", text: createStartWorkPrompt() }],
|
||||||
|
}
|
||||||
|
|
||||||
|
await hook["chat.message"](
|
||||||
|
{ sessionID: "ses-sisyphus-to-atlas" },
|
||||||
|
output
|
||||||
|
)
|
||||||
|
|
||||||
|
// atlas is registered in beforeEach, so it must be selected
|
||||||
|
expect(output.message.agent).toBe(getAgentListDisplayName("atlas"))
|
||||||
|
expect(sessionState.getSessionAgent("ses-sisyphus-to-atlas")).toBe("atlas")
|
||||||
|
})
|
||||||
|
|
||||||
test("should keep the current agent when Atlas is unavailable", async () => {
|
test("should keep the current agent when Atlas is unavailable", async () => {
|
||||||
// given
|
// given
|
||||||
sessionState._resetForTesting()
|
sessionState._resetForTesting()
|
||||||
|
|||||||
@@ -12,12 +12,10 @@ import {
|
|||||||
} from "../../features/boulder-state"
|
} from "../../features/boulder-state"
|
||||||
import { log } from "../../shared/logger"
|
import { log } from "../../shared/logger"
|
||||||
import {
|
import {
|
||||||
getAgentConfigKey,
|
|
||||||
getAgentDisplayName,
|
getAgentDisplayName,
|
||||||
getAgentListDisplayName,
|
getAgentListDisplayName,
|
||||||
} from "../../shared/agent-display-names"
|
} from "../../shared/agent-display-names"
|
||||||
import {
|
import {
|
||||||
getSessionAgent,
|
|
||||||
isAgentRegistered,
|
isAgentRegistered,
|
||||||
updateSessionAgent,
|
updateSessionAgent,
|
||||||
} from "../../features/claude-code-session-state"
|
} from "../../features/claude-code-session-state"
|
||||||
@@ -84,18 +82,9 @@ export function createStartWorkHook(ctx: PluginInput) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
log(`[${HOOK_NAME}] Processing start-work command`, { sessionID: input.sessionID })
|
log(`[${HOOK_NAME}] Processing start-work command`, { sessionID: input.sessionID })
|
||||||
const currentSessionAgent = getSessionAgent(input.sessionID)
|
const activeAgent = isAgentRegistered("atlas")
|
||||||
const currentSessionAgentKey = currentSessionAgent
|
? "atlas"
|
||||||
? getAgentConfigKey(currentSessionAgent)
|
: "sisyphus"
|
||||||
: undefined
|
|
||||||
const activeAgent = currentSessionAgent
|
|
||||||
&& currentSessionAgentKey
|
|
||||||
&& currentSessionAgentKey !== "prometheus"
|
|
||||||
&& currentSessionAgentKey !== "atlas"
|
|
||||||
? currentSessionAgent
|
|
||||||
: isAgentRegistered("atlas")
|
|
||||||
? "atlas"
|
|
||||||
: "sisyphus"
|
|
||||||
const activeAgentDisplayName = activeAgent === "atlas"
|
const activeAgentDisplayName = activeAgent === "atlas"
|
||||||
? getAgentListDisplayName(activeAgent)
|
? getAgentListDisplayName(activeAgent)
|
||||||
: getAgentDisplayName(activeAgent)
|
: getAgentDisplayName(activeAgent)
|
||||||
|
|||||||
Reference in New Issue
Block a user