From 30f4f06b9bb274eeab1f9d880b076012f0756d27 Mon Sep 17 00:00:00 2001 From: YeonGyu-Kim Date: Fri, 10 Apr 2026 11:40:20 +0900 Subject: [PATCH] test(chat-message): cover plain ulw without loop start Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus --- src/plugin/chat-message.test.ts | 37 +++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/src/plugin/chat-message.test.ts b/src/plugin/chat-message.test.ts index 6dd7a0397..7cf86656b 100644 --- a/src/plugin/chat-message.test.ts +++ b/src/plugin/chat-message.test.ts @@ -6,6 +6,7 @@ import { randomUUID } from "node:crypto" import { createChatMessageHandler } from "./chat-message" import { createAutoSlashCommandHook } from "../hooks/auto-slash-command" +import { createKeywordDetectorHook } from "../hooks/keyword-detector" import { createStartWorkHook } from "../hooks/start-work" import { readBoulderState } from "../features/boulder-state" import { _resetForTesting, setMainSession, subagentSessions, registerAgentName, updateSessionAgent, getSessionAgent } from "../features/claude-code-session-state" @@ -212,6 +213,42 @@ describe("createChatMessageHandler - /ulw-loop raw slash fallback", () => { }) }) +describe("createChatMessageHandler - plain ultrawork keyword routing", () => { + test("does not start ralph loop when plain ulw text flows through the full chat.message pipeline", async () => { + // given + setMainSession("test-session") + const startLoopCalls: Array<{ + sessionID: string + prompt: string + options: Record + }> = [] + const ralphLoop = { + startLoop: (sessionID: string, prompt: string, options?: Record) => { + startLoopCalls.push({ sessionID, prompt, options: options ?? {} }) + return true + }, + cancelLoop: () => true, + } + const args = createMockHandlerArgs() + args.hooks.ralphLoop = ralphLoop + args.hooks.keywordDetector = createKeywordDetectorHook(args.ctx as never, undefined, ralphLoop) + const handler = createChatMessageHandler(args) + const input = createMockInput("sisyphus") + const output: ChatMessageHandlerOutput = { + message: {}, + parts: [{ type: "text", text: "ulw fix the flaky keyword tests" }], + } + + // when + await handler(input, output) + + // then + expect(startLoopCalls).toHaveLength(0) + expect(output.parts[0]?.text).toContain("ULTRAWORK MODE ENABLED!") + expect(output.parts[0]?.text).toContain("ulw fix the flaky keyword tests") + }) +}) + function createMockInput(agent?: string, model?: { providerID: string; modelID: string }) { return { sessionID: "test-session",