From cc2cb361a965b15b7af8c6572f23e337ab3353fe Mon Sep 17 00:00:00 2001 From: myk1yt Date: Sat, 31 Oct 2026 01:43:32 +0900 Subject: [PATCH 1/2] chore(test): drop test-only tool-use interfaces from shared/tools What: remove the AttemptCompletionToolUse and WriteToFileToolUse interface declarations from src/shared/tools.ts and retype their three spec consumers to the generic ToolUse<"attempt_completion"> / ToolUse<"write_to_file">. Why: both interfaces had zero production references at origin/main; the only importers were three specs. ToolUse already resolves nativeArgs through NativeToolArgs, so the named aliases added no type information over the generic form. knip could not report them because knip.json exempts src/shared/*.ts with a "!" suffix, so the deadness was proven by importer grep instead. Impact: no behavior change. Type-level only: params widens from a Pick of one or two keys to Partial>, which accepts a superset, and nativeArgs keeps its exact shape. src and webview-ui typecheck, knip dev and production stay clean, and the affected suites (1246 tests across core/tools and core/task) pass. The TOOL_DISPLAY_NAMES row from the same plan was already removed upstream by 1cbc0f4d6 (#527), and the directoryExists dedup was stopped because the two copies enforce different error contracts (the roo-config copy re-throws on EACCES and is test-locked; the custom-instructions copy swallows all errors). --- .../task/__tests__/Task.persistence.spec.ts | 4 +- .../truncated-native-tool-args.spec.ts | 8 +-- .../__tests__/attemptCompletionTool.spec.ts | 64 +++++++++---------- src/shared/tools.ts | 14 ---- 4 files changed, 38 insertions(+), 52 deletions(-) diff --git a/src/core/task/__tests__/Task.persistence.spec.ts b/src/core/task/__tests__/Task.persistence.spec.ts index 109eee8dc0..fb7a4e8cc6 100644 --- a/src/core/task/__tests__/Task.persistence.spec.ts +++ b/src/core/task/__tests__/Task.persistence.spec.ts @@ -20,7 +20,7 @@ import { ClineProvider } from "../../webview/ClineProvider" import { ContextProxy } from "../../config/ContextProxy" import { providerIdentifiers } from "@roo-code/types/provider-identifiers" import { attemptCompletionTool, type AttemptCompletionCallbacks } from "../../tools/AttemptCompletionTool" -import type { AttemptCompletionToolUse } from "../../../shared/tools" +import type { ToolUse } from "../../../shared/tools" type TaskPersistenceAccess = { addToApiConversationHistory: (message: Anthropic.MessageParam) => Promise @@ -533,7 +533,7 @@ describe("Task persistence", () => { completionEmitted = true }) - const block: AttemptCompletionToolUse = { + const block: ToolUse<"attempt_completion"> = { type: "tool_use", id: completionCallId, name: "attempt_completion", diff --git a/src/core/task/__tests__/truncated-native-tool-args.spec.ts b/src/core/task/__tests__/truncated-native-tool-args.spec.ts index 4cc6f313e6..898e1a7426 100644 --- a/src/core/task/__tests__/truncated-native-tool-args.spec.ts +++ b/src/core/task/__tests__/truncated-native-tool-args.spec.ts @@ -21,7 +21,7 @@ */ import { isValidToolName } from "../../tools/validateToolUse" -import type { ToolUse, WriteToFileToolUse } from "../../../shared/tools" +import type { ToolUse } from "../../../shared/tools" describe("Truncated native tool-call args on finalize failure (issue #1221)", () => { /** @@ -60,7 +60,7 @@ describe("Truncated native tool-call args on finalize failure (issue #1221)", () // A write_to_file call whose `content` was cut off mid-stream - exactly // the scenario in #1221. The streaming phase already populated nativeArgs // from the incomplete partial-json parse before finalize failed. - const truncated: WriteToFileToolUse = { + const truncated: ToolUse<"write_to_file"> = { type: "tool_use", name: "write_to_file", params: {}, @@ -76,7 +76,7 @@ describe("Truncated native tool-call args on finalize failure (issue #1221)", () }) it("companion: without the fix, the same truncated call would NOT have been blocked", () => { - const truncated: WriteToFileToolUse = { + const truncated: ToolUse<"write_to_file"> = { type: "tool_use", name: "write_to_file", params: {}, @@ -100,7 +100,7 @@ describe("Truncated native tool-call args on finalize failure (issue #1221)", () // with the freshly-finalized one instead of taking this branch at all - // this test just confirms a complete, valid nativeArgs is never touched // by wouldBeBlocked's guard simulation. - const complete: WriteToFileToolUse = { + const complete: ToolUse<"write_to_file"> = { type: "tool_use", name: "write_to_file", params: {}, diff --git a/src/core/tools/__tests__/attemptCompletionTool.spec.ts b/src/core/tools/__tests__/attemptCompletionTool.spec.ts index c1c235fe7f..29580ef203 100644 --- a/src/core/tools/__tests__/attemptCompletionTool.spec.ts +++ b/src/core/tools/__tests__/attemptCompletionTool.spec.ts @@ -1,6 +1,6 @@ import { RooCodeEventName, TodoItem } from "@roo-code/types" -import { AttemptCompletionToolUse } from "../../../shared/tools" +import { ToolUse } from "../../../shared/tools" // Mock the formatResponse module before importing the tool vi.mock("../../prompts/responses", () => ({ @@ -82,7 +82,7 @@ describe("attemptCompletionTool", () => { describe("todo list validation", () => { it("should allow completion when there is no todo list", async () => { - const block: AttemptCompletionToolUse = { + const block: ToolUse<"attempt_completion"> = { type: "tool_use", name: "attempt_completion", params: { result: "Task completed successfully" }, @@ -108,7 +108,7 @@ describe("attemptCompletionTool", () => { }) it("should allow completion when todo list is empty", async () => { - const block: AttemptCompletionToolUse = { + const block: ToolUse<"attempt_completion"> = { type: "tool_use", name: "attempt_completion", params: { result: "Task completed successfully" }, @@ -133,7 +133,7 @@ describe("attemptCompletionTool", () => { }) it("should allow completion when all todos are completed", async () => { - const block: AttemptCompletionToolUse = { + const block: ToolUse<"attempt_completion"> = { type: "tool_use", name: "attempt_completion", params: { result: "Task completed successfully" }, @@ -163,7 +163,7 @@ describe("attemptCompletionTool", () => { }) it("should prevent completion when there are pending todos", async () => { - const block: AttemptCompletionToolUse = { + const block: ToolUse<"attempt_completion"> = { type: "tool_use", name: "attempt_completion", params: { result: "Task completed successfully" }, @@ -206,7 +206,7 @@ describe("attemptCompletionTool", () => { }) it("should prevent completion when there are in-progress todos", async () => { - const block: AttemptCompletionToolUse = { + const block: ToolUse<"attempt_completion"> = { type: "tool_use", name: "attempt_completion", params: { result: "Task completed successfully" }, @@ -249,7 +249,7 @@ describe("attemptCompletionTool", () => { }) it("should prevent completion when there are mixed incomplete todos", async () => { - const block: AttemptCompletionToolUse = { + const block: ToolUse<"attempt_completion"> = { type: "tool_use", name: "attempt_completion", params: { result: "Task completed successfully" }, @@ -293,7 +293,7 @@ describe("attemptCompletionTool", () => { }) it("should allow completion when setting is disabled even with incomplete todos", async () => { - const block: AttemptCompletionToolUse = { + const block: ToolUse<"attempt_completion"> = { type: "tool_use", name: "attempt_completion", params: { result: "Task completed successfully" }, @@ -337,7 +337,7 @@ describe("attemptCompletionTool", () => { }) it("should prevent completion when setting is enabled with incomplete todos", async () => { - const block: AttemptCompletionToolUse = { + const block: ToolUse<"attempt_completion"> = { type: "tool_use", name: "attempt_completion", params: { result: "Task completed successfully" }, @@ -381,7 +381,7 @@ describe("attemptCompletionTool", () => { }) it("should allow completion when setting is enabled but all todos are completed", async () => { - const block: AttemptCompletionToolUse = { + const block: ToolUse<"attempt_completion"> = { type: "tool_use", name: "attempt_completion", params: { result: "Task completed successfully" }, @@ -426,7 +426,7 @@ describe("attemptCompletionTool", () => { describe("tool failure guardrail", () => { it("should prevent completion when a previous tool failed in the current turn", async () => { - const block: AttemptCompletionToolUse = { + const block: ToolUse<"attempt_completion"> = { type: "tool_use", name: "attempt_completion", params: { result: "Task completed successfully" }, @@ -461,7 +461,7 @@ describe("attemptCompletionTool", () => { }) it("should allow completion when no tools failed", async () => { - const block: AttemptCompletionToolUse = { + const block: ToolUse<"attempt_completion"> = { type: "tool_use", name: "attempt_completion", params: { result: "Task completed successfully" }, @@ -494,7 +494,7 @@ describe("attemptCompletionTool", () => { const persistenceReady = new Promise((resolve) => { markPersistenceReady = () => resolve(true) }) - const block: AttemptCompletionToolUse = { + const block: ToolUse<"attempt_completion"> = { type: "tool_use", name: "attempt_completion", params: { result: "9" }, @@ -572,7 +572,7 @@ describe("attemptCompletionTool", () => { it("does not delegate or emit completion when child history persistence fails", async () => { const persistenceError = new Error("history unavailable") - const block: AttemptCompletionToolUse = { + const block: ToolUse<"attempt_completion"> = { type: "tool_use", name: "attempt_completion", params: { result: "9" }, @@ -621,7 +621,7 @@ describe("attemptCompletionTool", () => { }) it("does not delegate or report an error when child history persistence is cancelled", async () => { - const block: AttemptCompletionToolUse = { + const block: ToolUse<"attempt_completion"> = { type: "tool_use", name: "attempt_completion", params: { result: "9" }, @@ -670,7 +670,7 @@ describe("attemptCompletionTool", () => { }) it("does not reopen the parent when persistence is cancelled during approval", async () => { - const block: AttemptCompletionToolUse = { + const block: ToolUse<"attempt_completion"> = { type: "tool_use", name: "attempt_completion", params: { result: "9" }, @@ -722,7 +722,7 @@ describe("attemptCompletionTool", () => { }) it("falls through to standalone completion when parent delegation becomes stale after approval", async () => { - const block: AttemptCompletionToolUse = { + const block: ToolUse<"attempt_completion"> = { type: "tool_use", name: "attempt_completion", params: { result: "9" }, @@ -782,7 +782,7 @@ describe("attemptCompletionTool", () => { }) it("does not resume the parent when the parent is no longer awaiting this child", async () => { - const block: AttemptCompletionToolUse = { + const block: ToolUse<"attempt_completion"> = { type: "tool_use", name: "attempt_completion", params: { result: "9" }, @@ -832,7 +832,7 @@ describe("attemptCompletionTool", () => { }) it("delegates an interrupted subtask completion when the parent is still delegated and awaiting that child", async () => { - const block: AttemptCompletionToolUse = { + const block: ToolUse<"attempt_completion"> = { type: "tool_use", name: "attempt_completion", params: { result: "9" }, @@ -886,7 +886,7 @@ describe("attemptCompletionTool", () => { }) it("does not resume the parent when the parent is active but awaiting a different child", async () => { - const block: AttemptCompletionToolUse = { + const block: ToolUse<"attempt_completion"> = { type: "tool_use", name: "attempt_completion", params: { result: "9" }, @@ -936,7 +936,7 @@ describe("attemptCompletionTool", () => { }) it("emits TaskCompleted only when completion is accepted", async () => { - const block: AttemptCompletionToolUse = { + const block: ToolUse<"attempt_completion"> = { type: "tool_use", name: "attempt_completion", params: { result: "2" }, @@ -973,7 +973,7 @@ describe("attemptCompletionTool", () => { }) it("does not emit TaskCompleted when persistence is cancelled", async () => { - const block: AttemptCompletionToolUse = { + const block: ToolUse<"attempt_completion"> = { type: "tool_use", name: "attempt_completion", params: { result: "2" }, @@ -1003,7 +1003,7 @@ describe("attemptCompletionTool", () => { it("reports accepted-completion persistence failures with persistence context", async () => { const persistenceError = new Error("history write failed") - const block: AttemptCompletionToolUse = { + const block: ToolUse<"attempt_completion"> = { type: "tool_use", name: "attempt_completion", params: { result: "2" }, @@ -1032,7 +1032,7 @@ describe("attemptCompletionTool", () => { }) it("reports telemetry but does not emit the public TaskCompleted event when user provides follow-up feedback", async () => { - const block: AttemptCompletionToolUse = { + const block: ToolUse<"attempt_completion"> = { type: "tool_use", name: "attempt_completion", params: { result: "2" }, @@ -1074,7 +1074,7 @@ describe("attemptCompletionTool", () => { }) it("durably persists queued completion feedback before continuing", async () => { - const block: AttemptCompletionToolUse = { + const block: ToolUse<"attempt_completion"> = { type: "tool_use", name: "attempt_completion", params: { result: "Done" }, @@ -1105,7 +1105,7 @@ describe("attemptCompletionTool", () => { }) it("does not continue when queued completion feedback persistence fails", async () => { - const block: AttemptCompletionToolUse = { + const block: ToolUse<"attempt_completion"> = { type: "tool_use", name: "attempt_completion", params: { result: "Done" }, @@ -1136,7 +1136,7 @@ describe("attemptCompletionTool", () => { }) it("records image-only completion feedback before continuing", async () => { - const block: AttemptCompletionToolUse = { + const block: ToolUse<"attempt_completion"> = { type: "tool_use", name: "attempt_completion", params: { result: "Done" }, @@ -1162,7 +1162,7 @@ describe("attemptCompletionTool", () => { }) it("does not clear pending metadata when stale delegation continues without an action id", async () => { - const block: AttemptCompletionToolUse = { + const block: ToolUse<"attempt_completion"> = { type: "tool_use", name: "attempt_completion", params: { result: "Done" }, @@ -1232,7 +1232,7 @@ describe("attemptCompletionTool telemetry invariants", () => { } it("does not emit a duplicate telemetry installment when replaying an already-completed subtask from history", async () => { - const block: AttemptCompletionToolUse = { + const block: ToolUse<"attempt_completion"> = { type: "tool_use", name: "attempt_completion", params: { result: "done" }, @@ -1269,7 +1269,7 @@ describe("attemptCompletionTool telemetry invariants", () => { }) it("does not emit the public TaskCompleted event when replaying an already-completed subtask from history", async () => { - const block: AttemptCompletionToolUse = { + const block: ToolUse<"attempt_completion"> = { type: "tool_use", name: "attempt_completion", params: { result: "done" }, @@ -1310,7 +1310,7 @@ describe("attemptCompletionTool telemetry invariants", () => { }) it("emits the public TaskCompleted API event only when completion is accepted, but reports telemetry either way", async () => { - const block: AttemptCompletionToolUse = { + const block: ToolUse<"attempt_completion"> = { type: "tool_use", name: "attempt_completion", params: { result: "done" }, @@ -1342,7 +1342,7 @@ describe("attemptCompletionTool telemetry invariants", () => { }) it("still reports telemetry for a model-initiated completion even when the user provides follow-up feedback instead of accepting", async () => { - const block: AttemptCompletionToolUse = { + const block: ToolUse<"attempt_completion"> = { type: "tool_use", name: "attempt_completion", params: { result: "done" }, diff --git a/src/shared/tools.ts b/src/shared/tools.ts index 8730fd4446..4185380341 100644 --- a/src/shared/tools.ts +++ b/src/shared/tools.ts @@ -182,20 +182,6 @@ export interface McpToolUse { partial: boolean } -/** - * @public - */ -export interface AttemptCompletionToolUse extends ToolUse<"attempt_completion"> { - name: "attempt_completion" - params: Partial, "result">> -} - -/** @internal Type used by tool-argument regression tests. */ -export interface WriteToFileToolUse extends ToolUse<"write_to_file"> { - name: "write_to_file" - params: Partial, "path" | "content">> -} - // Define tool group configuration export type ToolGroupConfig = { tools: readonly string[] From d10ee7c485a94280abd55d5a86abf708b62dae3c Mon Sep 17 00:00:00 2001 From: myk1yt Date: Sat, 31 Oct 2026 02:08:00 +0900 Subject: [PATCH 2/2] =?UTF-8?q?ci:=20retrigger=20workflow=20=E2=80=94=20th?= =?UTF-8?q?eme-fixtures=20infra-flake?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit What: empty retrigger commit, no content change. Why: theme-fixtures died in @vscode/test-electron 'Resolving version...' download (recorded infra signature; no fixture diff emitted). Same base is green on #2254/#2256/#2257 minutes apart; diff is type-declaration-only with no causal path. No admin rerun rights on the org repo; push-retrigger is the documented recovery. Impact: all CI legs re-run on identical trees (cc2cb361a content == this commit's tree).