From 5038ad78554eeea63d8d1b0bb2debed0745571b3 Mon Sep 17 00:00:00 2001 From: can1357 Date: Thu, 4 Jun 2026 17:46:00 +0200 Subject: [PATCH] tests: delete/adjust brittle tests --- packages/agent/test/handoff.test.ts | 6 +-- .../ai/test/duplicate-tool-results.test.ts | 1 - .../agent-session-empty-stop-guard.test.ts | 5 +-- .../custom-commands/review.test.ts | 40 ------------------- .../test/interactive-mode-plan-review.test.ts | 1 - ...selector-controller-session-delete.test.ts | 1 - .../task/executor-subagent-reminders.test.ts | 2 - 7 files changed, 3 insertions(+), 53 deletions(-) diff --git a/packages/agent/test/handoff.test.ts b/packages/agent/test/handoff.test.ts index 58510a2cb..2f0affc81 100644 --- a/packages/agent/test/handoff.test.ts +++ b/packages/agent/test/handoff.test.ts @@ -41,8 +41,7 @@ afterEach(() => { describe("handoff helpers", () => { test("renders custom focus into the handoff prompt", () => { const rendered = renderHandoffPrompt("preserve failing test name"); - expect(rendered).toContain("Write handoff doc for another instance."); - expect(rendered).toContain("Additional focus: preserve failing test name"); + expect(rendered).toContain("preserve failing test name"); }); test("exports the threshold focus text used by auto-handoff", () => { @@ -108,7 +107,6 @@ describe("handoff helpers", () => { if (promptBlock?.type !== "text") { throw new Error("Expected text handoff prompt block"); } - expect(promptBlock.text).toContain("Write handoff doc for another instance."); - expect(promptBlock.text).toContain("Additional focus: preserve failing test name"); + expect(promptBlock.text).toContain("preserve failing test name"); }); }); diff --git a/packages/ai/test/duplicate-tool-results.test.ts b/packages/ai/test/duplicate-tool-results.test.ts index 988817e66..1be33d66b 100644 --- a/packages/ai/test/duplicate-tool-results.test.ts +++ b/packages/ai/test/duplicate-tool-results.test.ts @@ -918,7 +918,6 @@ describe("Codex-style Abort Handling", () => { const guidanceMsg = transformed[3] as DeveloperMessage; expect(guidanceMsg.role).toBe("developer"); expect(guidanceMsg.content).toContain(""); - expect(guidanceMsg.content).toContain("verify state before retry"); }); it("should inject synthetic 'aborted' tool results with isError true", () => { diff --git a/packages/coding-agent/test/agent-session-empty-stop-guard.test.ts b/packages/coding-agent/test/agent-session-empty-stop-guard.test.ts index 8399e6e90..16cd9ecb1 100644 --- a/packages/coding-agent/test/agent-session-empty-stop-guard.test.ts +++ b/packages/coding-agent/test/agent-session-empty-stop-guard.test.ts @@ -118,10 +118,7 @@ function emptyAssistantStops(messages: AgentMessage[]): AgentMessage[] { } function reminderMessages(messages: AgentMessage[]): AgentMessage[] { - const isEmptyStopRetryReminder = (text: string): boolean => - text.includes("") && - text.includes("Previous assistant turn ended with no text, reasoning, or tool call.") && - text.includes("(Empty response retry "); + const isEmptyStopRetryReminder = (text: string): boolean => text.includes(""); return messages.filter(message => { if (message.role !== "developer") return false; diff --git a/packages/coding-agent/test/extensibility/custom-commands/review.test.ts b/packages/coding-agent/test/extensibility/custom-commands/review.test.ts index d3f79b56e..8ff664bc7 100644 --- a/packages/coding-agent/test/extensibility/custom-commands/review.test.ts +++ b/packages/coding-agent/test/extensibility/custom-commands/review.test.ts @@ -8,8 +8,6 @@ import type { HookCommandContext } from "../../../src/extensibility/hooks/types" import * as git from "../../../src/utils/git"; import * as jj from "../../../src/utils/jj"; -const LEGACY_TASK_INSTRUCTION = 'Use the Task tool with `agent: "reviewer"` to execute this review.'; -const REVIEWER_TASK_INSTRUCTION = 'Use `task` tool with `agent: "reviewer"` and `tasks` array.'; const SAMPLE_JJ_DIFF = `diff --git a/src/workspace.ts b/src/workspace.ts --- a/src/workspace.ts @@ -96,10 +94,7 @@ describe("ReviewCommand", () => { expect(result).toBeDefined(); const promptText = result!; - expect(promptText).toContain("Custom review instructions"); - expect(promptText).toContain(REVIEWER_TASK_INSTRUCTION); expect(promptText).toContain("Check authentication boundaries"); - expect(promptText).not.toContain(LEGACY_TASK_INSTRUCTION); }); it("does not submit empty custom review instructions", async () => { @@ -134,7 +129,6 @@ describe("ReviewCommand", () => { expect(result).toBeDefined(); const promptText = result!; - expect(promptText).toContain("Reviewing JJ working-copy changes"); expect(promptText).toContain("src/workspace.ts"); expect(promptText).toContain("+1/-1"); expect(jjDiffSpy).toHaveBeenCalledWith(dir); @@ -148,36 +142,6 @@ describe("ReviewCommand", () => { } }); - it("includes reviewer task orchestration for single-agent diff reviews", async () => { - const dir = await createTempDir(); - const jjRepoSpy = spyOn(jj.repo, "is").mockResolvedValue(false); - const gitStatusSpy = spyOn(git, "status").mockResolvedValue(" M review-target.ts\n"); - const gitDiffSpy = spyOn(git, "diff").mockResolvedValue(`diff --git a/review-target.ts b/review-target.ts ---- a/review-target.ts -+++ b/review-target.ts -@@ -1 +1 @@ --export const value = 1; -+export const value = 2; -`); - try { - const command = new ReviewCommand({ cwd: dir } as unknown as CustomCommandAPI); - const ctx = createContext({ - selectedMode: "2. Review uncommitted changes", - }); - - const result = await command.execute([], ctx); - - expect(result).toBeDefined(); - const promptText = result!; - expect(promptText).toContain(REVIEWER_TASK_INSTRUCTION); - expect(promptText).toContain("Create exactly **1 reviewer task**"); - expect(promptText).not.toContain(LEGACY_TASK_INSTRUCTION); - } finally { - jjRepoSpy.mockRestore(); - gitStatusSpy.mockRestore(); - gitDiffSpy.mockRestore(); - } - }); it("includes JJ diff context for custom review prompts", async () => { const dir = await createTempDir(); @@ -195,7 +159,6 @@ describe("ReviewCommand", () => { expect(result).toBeDefined(); const promptText = result!; - expect(promptText).toContain("Custom review: Check workspace state transitions…"); expect(promptText).toContain("Check workspace state transitions"); expect(promptText).toContain("src/workspace.ts"); expect(gitStatusSpy).not.toHaveBeenCalled(); @@ -216,9 +179,6 @@ describe("ReviewCommand", () => { expect(result).toBeDefined(); const promptText = result!; - expect(promptText).toContain("Headless review request"); - expect(promptText).toContain(REVIEWER_TASK_INSTRUCTION); expect(promptText).toContain("focus auth"); - expect(promptText).not.toContain(LEGACY_TASK_INSTRUCTION); }); }); diff --git a/packages/coding-agent/test/interactive-mode-plan-review.test.ts b/packages/coding-agent/test/interactive-mode-plan-review.test.ts index 7b92b33c3..6fb7b28eb 100644 --- a/packages/coding-agent/test/interactive-mode-plan-review.test.ts +++ b/packages/coding-agent/test/interactive-mode-plan-review.test.ts @@ -531,7 +531,6 @@ describe("InteractiveMode plan review rendering", () => { expect(compactSpy).toHaveBeenCalledTimes(1); const [compactInstruction] = compactSpy.mock.calls[0]!; expect(typeof compactInstruction).toBe("string"); - expect(compactInstruction as string).toContain("We'll execute approved plan."); expect(compactInstruction as string).toContain(finalPlanFilePath); // Plan-approved synthetic prompt was dispatched. diff --git a/packages/coding-agent/test/modes/controllers/selector-controller-session-delete.test.ts b/packages/coding-agent/test/modes/controllers/selector-controller-session-delete.test.ts index ea938f3f4..90990791e 100644 --- a/packages/coding-agent/test/modes/controllers/selector-controller-session-delete.test.ts +++ b/packages/coding-agent/test/modes/controllers/selector-controller-session-delete.test.ts @@ -229,7 +229,6 @@ describe("SelectorController session deletion", () => { expect(ctx.showError).not.toHaveBeenCalled(); expect(ctx.sessionManager.getSessionFile()).toBe("/tmp/project/sessions/detached.jsonl"); expect(renderText(selector)).toContain("Error: Failed to delete session: disk failed"); - expect(renderText(selector)).toContain("Active session"); }); it("creates a fresh session before deleting via slash command and then shows the selector", async () => { diff --git a/packages/coding-agent/test/task/executor-subagent-reminders.test.ts b/packages/coding-agent/test/task/executor-subagent-reminders.test.ts index cf0184ef6..6d346a074 100644 --- a/packages/coding-agent/test/task/executor-subagent-reminders.test.ts +++ b/packages/coding-agent/test/task/executor-subagent-reminders.test.ts @@ -265,8 +265,6 @@ describe("runSubprocess yield reminders", () => { expect(promptOptions).toHaveLength(2); expect(promptOptions[0]?.attribution).toBe("agent"); expect(promptOptions[1]?.attribution).toBe("agent"); - expect(prompts[1]).toContain("Last turn ended without tool call; session idle."); - expect(prompts[1]).toContain("Every turn MUST end with tool call."); expect(result.output).toContain('"done": true'); expect(result.output.includes("SYSTEM WARNING")).toBe(false); });