From 711aac0f0a567f1dd63aa5a711f6aa604090175b Mon Sep 17 00:00:00 2001 From: Jean Philippe Wan Date: Sun, 15 Mar 2026 19:04:20 -0400 Subject: [PATCH] fix: preserve atlas handoff on start-work --- src/hooks/start-work/index.test.ts | 18 ++++++++++++++++++ src/hooks/start-work/start-work-hook.ts | 5 +++++ 2 files changed, 23 insertions(+) diff --git a/src/hooks/start-work/index.test.ts b/src/hooks/start-work/index.test.ts index 565b2decb..ddea999a0 100644 --- a/src/hooks/start-work/index.test.ts +++ b/src/hooks/start-work/index.test.ts @@ -404,6 +404,24 @@ describe("start-work hook", () => { expect(updateSpy).toHaveBeenCalledWith("ses-prometheus-to-sisyphus", "atlas") updateSpy.mockRestore() }) + + test("should stamp the outgoing message with Atlas so follow-up events keep the handoff", async () => { + // given + const hook = createStartWorkHook(createMockPluginInput()) + const output = { + message: {}, + parts: [{ type: "text", text: "" }], + } + + // when + await hook["chat.message"]( + { sessionID: "ses-prometheus-to-atlas" }, + output + ) + + // then + expect(output.message.agent).toBe("Atlas (Plan Executor)") + }) }) describe("worktree support", () => { diff --git a/src/hooks/start-work/start-work-hook.ts b/src/hooks/start-work/start-work-hook.ts index 81ec85cc3..47c3889ed 100644 --- a/src/hooks/start-work/start-work-hook.ts +++ b/src/hooks/start-work/start-work-hook.ts @@ -11,6 +11,7 @@ import { clearBoulderState, } from "../../features/boulder-state" import { log } from "../../shared/logger" +import { getAgentDisplayName } from "../../shared/agent-display-names" import { updateSessionAgent } from "../../features/claude-code-session-state" import { detectWorktreePath } from "./worktree-detector" import { parseUserRequest } from "./parse-user-request" @@ -23,6 +24,7 @@ interface StartWorkHookInput { } interface StartWorkHookOutput { + message?: Record parts: Array<{ type: string; text?: string }> } @@ -79,6 +81,9 @@ export function createStartWorkHook(ctx: PluginInput) { log(`[${HOOK_NAME}] Processing start-work command`, { sessionID: input.sessionID }) updateSessionAgent(input.sessionID, "atlas") + if (output.message) { + output.message["agent"] = getAgentDisplayName("atlas") + } const existingState = readBoulderState(ctx.directory) const sessionId = input.sessionID