test(keyword-detector): add plain ulw no-loop regressions
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -35,7 +35,7 @@ function createMockRalphLoop(startLoopCalls: StartLoopCall[], cancelLoopCalls: C
|
||||
}
|
||||
}
|
||||
|
||||
describe("keyword-detector ralph-loop activation", () => {
|
||||
describe("keyword-detector ultrawork routing", () => {
|
||||
beforeEach(() => {
|
||||
_resetForTesting()
|
||||
})
|
||||
@@ -44,7 +44,7 @@ describe("keyword-detector ralph-loop activation", () => {
|
||||
_resetForTesting()
|
||||
})
|
||||
|
||||
test("#given ulw keyword in main session #when chat.message fires #then ralph-loop startLoop is invoked with the user task", async () => {
|
||||
test("#given ulw keyword in main session #when chat.message fires #then ultrawork prompt is injected without starting ralph loop", async () => {
|
||||
// given
|
||||
setMainSession("main-session")
|
||||
const startLoopCalls: StartLoopCall[] = []
|
||||
@@ -59,13 +59,12 @@ describe("keyword-detector ralph-loop activation", () => {
|
||||
await hook["chat.message"]({ sessionID: "main-session", agent: "sisyphus" }, output)
|
||||
|
||||
// then
|
||||
expect(startLoopCalls).toHaveLength(1)
|
||||
expect(startLoopCalls[0].sessionID).toBe("main-session")
|
||||
expect(startLoopCalls[0].prompt).toContain("build a multi-agent backend architecture")
|
||||
expect(startLoopCalls[0].options.ultrawork).toBe(true)
|
||||
expect(startLoopCalls).toHaveLength(0)
|
||||
expect(output.parts[0]?.text).toContain("YOU MUST LEVERAGE ALL AVAILABLE AGENTS")
|
||||
expect(output.parts[0]?.text).toContain("ulw build a multi-agent backend architecture")
|
||||
})
|
||||
|
||||
test("#given ultrawork keyword in main session #when chat.message fires #then ralph-loop startLoop is invoked with ultrawork enabled", async () => {
|
||||
test("#given ultrawork keyword in main session #when chat.message fires #then ultrawork prompt is injected without starting ralph loop", async () => {
|
||||
// given
|
||||
setMainSession("main-session")
|
||||
const startLoopCalls: StartLoopCall[] = []
|
||||
@@ -80,13 +79,12 @@ describe("keyword-detector ralph-loop activation", () => {
|
||||
await hook["chat.message"]({ sessionID: "main-session", agent: "sisyphus" }, output)
|
||||
|
||||
// then
|
||||
expect(startLoopCalls).toHaveLength(1)
|
||||
expect(startLoopCalls[0].sessionID).toBe("main-session")
|
||||
expect(startLoopCalls[0].prompt).toContain("ship the dashboard")
|
||||
expect(startLoopCalls[0].options.ultrawork).toBe(true)
|
||||
expect(startLoopCalls).toHaveLength(0)
|
||||
expect(output.parts[0]?.text).toContain("YOU MUST LEVERAGE ALL AVAILABLE AGENTS")
|
||||
expect(output.parts[0]?.text).toContain("ultrawork ship the dashboard")
|
||||
})
|
||||
|
||||
test("#given ulw mentioned mid-sentence #when chat.message fires #then ralph-loop startLoop is invoked", async () => {
|
||||
test("#given ulw mentioned mid-sentence #when chat.message fires #then ultrawork prompt is injected without starting ralph loop", async () => {
|
||||
// given
|
||||
setMainSession("main-session")
|
||||
const startLoopCalls: StartLoopCall[] = []
|
||||
@@ -101,12 +99,11 @@ describe("keyword-detector ralph-loop activation", () => {
|
||||
await hook["chat.message"]({ sessionID: "main-session", agent: "sisyphus" }, output)
|
||||
|
||||
// then
|
||||
expect(startLoopCalls).toHaveLength(1)
|
||||
expect(startLoopCalls[0].prompt).toBe("please fix the flaky keyword tests")
|
||||
expect(startLoopCalls).toHaveLength(0)
|
||||
expect(output.parts[0]?.text).toContain("please ulw fix the flaky keyword tests")
|
||||
})
|
||||
|
||||
test("#given question about ultrawork #when chat.message fires #then ralph-loop startLoop is invoked", async () => {
|
||||
test("#given question about ultrawork #when chat.message fires #then ultrawork prompt is injected without starting ralph loop", async () => {
|
||||
// given
|
||||
setMainSession("main-session")
|
||||
const startLoopCalls: StartLoopCall[] = []
|
||||
@@ -121,8 +118,7 @@ describe("keyword-detector ralph-loop activation", () => {
|
||||
await hook["chat.message"]({ sessionID: "main-session", agent: "sisyphus" }, output)
|
||||
|
||||
// then
|
||||
expect(startLoopCalls).toHaveLength(1)
|
||||
expect(startLoopCalls[0].prompt).toBe("what is ?")
|
||||
expect(startLoopCalls).toHaveLength(0)
|
||||
expect(output.parts[0]?.text).toContain("what is ultrawork?")
|
||||
})
|
||||
|
||||
@@ -239,7 +235,7 @@ The system mentions ulw mode in passing.
|
||||
expect(startLoopCalls).toHaveLength(0)
|
||||
})
|
||||
|
||||
test("#given ulw keyword #when chat.message fires #then prompt is also injected as before", async () => {
|
||||
test("#given ulw keyword #when chat.message fires #then prompt is injected as before without starting ralph loop", async () => {
|
||||
// given
|
||||
setMainSession("main-session")
|
||||
const startLoopCalls: StartLoopCall[] = []
|
||||
@@ -257,6 +253,6 @@ The system mentions ulw mode in passing.
|
||||
const textPart = output.parts.find((p) => p.type === "text")
|
||||
expect(textPart!.text).toContain("YOU MUST LEVERAGE ALL AVAILABLE AGENTS")
|
||||
expect(textPart!.text).toContain("refactor the codebase")
|
||||
expect(startLoopCalls).toHaveLength(1)
|
||||
expect(startLoopCalls).toHaveLength(0)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -40,7 +40,7 @@ describe("keyword-detector ultrawork edge trigger", () => {
|
||||
_resetForTesting()
|
||||
})
|
||||
|
||||
test("#given greeting text before ulw and surrounding whitespace #when chat.message fires #then ultrawork still activates", async () => {
|
||||
test("#given greeting text before ulw and surrounding whitespace #when chat.message fires #then ultrawork still activates without starting ralph loop", async () => {
|
||||
// given
|
||||
const toastCalls: string[] = []
|
||||
const startLoopCalls: StartLoopCall[] = []
|
||||
@@ -59,22 +59,12 @@ describe("keyword-detector ultrawork edge trigger", () => {
|
||||
|
||||
// then
|
||||
expect(toastCalls).toContain("Ultrawork Mode Activated")
|
||||
expect(startLoopCalls).toHaveLength(1)
|
||||
expect(startLoopCalls[0]).toEqual({
|
||||
sessionID: "main-session",
|
||||
prompt: "Complete the task as instructed",
|
||||
options: {
|
||||
ultrawork: true,
|
||||
maxIterations: undefined,
|
||||
completionPromise: undefined,
|
||||
strategy: undefined,
|
||||
},
|
||||
})
|
||||
expect(startLoopCalls).toHaveLength(0)
|
||||
expect(output.parts[0]?.text).toContain("ULTRAWORK MODE ENABLED!")
|
||||
expect(output.parts[0]?.text).toContain(" hi there ulw ")
|
||||
})
|
||||
|
||||
test("#given greeting before ulw with a trailing task #when chat.message fires #then ultrawork activates and preserves the task", async () => {
|
||||
test("#given greeting before ulw with a trailing task #when chat.message fires #then ultrawork activates and preserves the task without starting ralph loop", async () => {
|
||||
// given
|
||||
const toastCalls: string[] = []
|
||||
const startLoopCalls: StartLoopCall[] = []
|
||||
@@ -93,22 +83,12 @@ describe("keyword-detector ultrawork edge trigger", () => {
|
||||
|
||||
// then
|
||||
expect(toastCalls).toContain("Ultrawork Mode Activated")
|
||||
expect(startLoopCalls).toHaveLength(1)
|
||||
expect(startLoopCalls[0]).toEqual({
|
||||
sessionID: "main-session",
|
||||
prompt: "fix the flaky keyword tests",
|
||||
options: {
|
||||
ultrawork: true,
|
||||
maxIterations: undefined,
|
||||
completionPromise: undefined,
|
||||
strategy: undefined,
|
||||
},
|
||||
})
|
||||
expect(startLoopCalls).toHaveLength(0)
|
||||
expect(output.parts[0]?.text).toContain("ULTRAWORK MODE ENABLED!")
|
||||
expect(output.parts[0]?.text).toContain("hey ulw fix the flaky keyword tests")
|
||||
})
|
||||
|
||||
test("#given ulw mentioned in the middle of a sentence #when chat.message fires #then ultrawork still activates", async () => {
|
||||
test("#given ulw mentioned in the middle of a sentence #when chat.message fires #then ultrawork still activates without starting ralph loop", async () => {
|
||||
// given
|
||||
const toastCalls: string[] = []
|
||||
const startLoopCalls: StartLoopCall[] = []
|
||||
@@ -127,12 +107,11 @@ describe("keyword-detector ultrawork edge trigger", () => {
|
||||
|
||||
// then
|
||||
expect(toastCalls).toContain("Ultrawork Mode Activated")
|
||||
expect(startLoopCalls).toHaveLength(1)
|
||||
expect(startLoopCalls[0]?.prompt).toBe("please fix the flaky keyword tests")
|
||||
expect(startLoopCalls).toHaveLength(0)
|
||||
expect(output.parts[0]?.text).toContain("please ulw fix the flaky keyword tests")
|
||||
})
|
||||
|
||||
test("#given trailing ultrawork reference without punctuation #when chat.message fires #then ultrawork still activates", async () => {
|
||||
test("#given trailing ultrawork reference without punctuation #when chat.message fires #then ultrawork still activates without starting ralph loop", async () => {
|
||||
// given
|
||||
const toastCalls: string[] = []
|
||||
const startLoopCalls: StartLoopCall[] = []
|
||||
@@ -151,8 +130,7 @@ describe("keyword-detector ultrawork edge trigger", () => {
|
||||
|
||||
// then
|
||||
expect(toastCalls).toContain("Ultrawork Mode Activated")
|
||||
expect(startLoopCalls).toHaveLength(1)
|
||||
expect(startLoopCalls[0]?.prompt).toBe("what is")
|
||||
expect(startLoopCalls).toHaveLength(0)
|
||||
expect(output.parts[0]?.text).toContain("what is ultrawork")
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user