diff --git a/apps/web-roo-code/public/logos/amazon.svg b/apps/web-roo-code/public/logos/amazon.svg new file mode 100644 index 00000000000..0c7c30dd62d --- /dev/null +++ b/apps/web-roo-code/public/logos/amazon.svg @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/apps/web-roo-code/public/logos/anthropic.svg b/apps/web-roo-code/public/logos/anthropic.svg new file mode 100644 index 00000000000..5b81844cbdc --- /dev/null +++ b/apps/web-roo-code/public/logos/anthropic.svg @@ -0,0 +1 @@ +Anthropic \ No newline at end of file diff --git a/apps/web-roo-code/public/logos/apple.svg b/apps/web-roo-code/public/logos/apple.svg new file mode 100644 index 00000000000..1b2c0e33d1c --- /dev/null +++ b/apps/web-roo-code/public/logos/apple.svg @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/apps/web-roo-code/public/logos/bytedance.svg b/apps/web-roo-code/public/logos/bytedance.svg new file mode 100644 index 00000000000..96f1bf235c9 --- /dev/null +++ b/apps/web-roo-code/public/logos/bytedance.svg @@ -0,0 +1 @@ +ByteDance \ No newline at end of file diff --git a/apps/web-roo-code/public/logos/carvana.svg b/apps/web-roo-code/public/logos/carvana.svg new file mode 100644 index 00000000000..e43bda0b4e7 --- /dev/null +++ b/apps/web-roo-code/public/logos/carvana.svg @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/apps/web-roo-code/public/logos/deepseek.svg b/apps/web-roo-code/public/logos/deepseek.svg new file mode 100644 index 00000000000..dc224e43a4d --- /dev/null +++ b/apps/web-roo-code/public/logos/deepseek.svg @@ -0,0 +1 @@ +DeepSeek \ No newline at end of file diff --git a/apps/web-roo-code/public/logos/gemini.svg b/apps/web-roo-code/public/logos/gemini.svg new file mode 100644 index 00000000000..87736bbe099 --- /dev/null +++ b/apps/web-roo-code/public/logos/gemini.svg @@ -0,0 +1 @@ +Gemini \ No newline at end of file diff --git a/apps/web-roo-code/public/logos/grok.svg b/apps/web-roo-code/public/logos/grok.svg new file mode 100644 index 00000000000..efb1a6183cb --- /dev/null +++ b/apps/web-roo-code/public/logos/grok.svg @@ -0,0 +1 @@ +Grok \ No newline at end of file diff --git a/apps/web-roo-code/public/logos/kimi.svg b/apps/web-roo-code/public/logos/kimi.svg new file mode 100644 index 00000000000..4355c522a2d --- /dev/null +++ b/apps/web-roo-code/public/logos/kimi.svg @@ -0,0 +1 @@ +Kimi \ No newline at end of file diff --git a/apps/web-roo-code/public/logos/microsoft.svg b/apps/web-roo-code/public/logos/microsoft.svg new file mode 100644 index 00000000000..827f833a98d --- /dev/null +++ b/apps/web-roo-code/public/logos/microsoft.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/apps/web-roo-code/public/logos/mistral.svg b/apps/web-roo-code/public/logos/mistral.svg new file mode 100644 index 00000000000..32c6cbd3fd5 --- /dev/null +++ b/apps/web-roo-code/public/logos/mistral.svg @@ -0,0 +1 @@ +Mistral \ No newline at end of file diff --git a/apps/web-roo-code/public/logos/netflix.svg b/apps/web-roo-code/public/logos/netflix.svg new file mode 100644 index 00000000000..4c635dc232b --- /dev/null +++ b/apps/web-roo-code/public/logos/netflix.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/apps/web-roo-code/public/logos/ollama.svg b/apps/web-roo-code/public/logos/ollama.svg new file mode 100644 index 00000000000..cc887e3dcfd --- /dev/null +++ b/apps/web-roo-code/public/logos/ollama.svg @@ -0,0 +1 @@ +Ollama \ No newline at end of file diff --git a/apps/web-roo-code/public/logos/openai.svg b/apps/web-roo-code/public/logos/openai.svg new file mode 100644 index 00000000000..50d94d6c108 --- /dev/null +++ b/apps/web-roo-code/public/logos/openai.svg @@ -0,0 +1 @@ +OpenAI \ No newline at end of file diff --git a/apps/web-roo-code/public/logos/qwen.svg b/apps/web-roo-code/public/logos/qwen.svg new file mode 100644 index 00000000000..a4bb382a635 --- /dev/null +++ b/apps/web-roo-code/public/logos/qwen.svg @@ -0,0 +1 @@ +Qwen \ No newline at end of file diff --git a/apps/web-roo-code/public/logos/rakuten.svg b/apps/web-roo-code/public/logos/rakuten.svg new file mode 100644 index 00000000000..f237d178815 --- /dev/null +++ b/apps/web-roo-code/public/logos/rakuten.svg @@ -0,0 +1,35 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/apps/web-roo-code/public/logos/red-hat.svg b/apps/web-roo-code/public/logos/red-hat.svg new file mode 100644 index 00000000000..c72c4dc5e20 --- /dev/null +++ b/apps/web-roo-code/public/logos/red-hat.svg @@ -0,0 +1,4 @@ + + + + diff --git a/apps/web-roo-code/src/app/page.tsx b/apps/web-roo-code/src/app/page.tsx index 7a9f62f7793..4ef415a6584 100644 --- a/apps/web-roo-code/src/app/page.tsx +++ b/apps/web-roo-code/src/app/page.tsx @@ -5,11 +5,12 @@ import { getVSCodeDownloads } from "@/lib/stats" import { Button } from "@/components/ui" import { AnimatedBackground, - InstallSection, + CodeExample, + CompanyLogos, + FAQSection, Features, + InstallSection, Testimonials, - FAQSection, - CodeExample, } from "@/components/homepage" import { EXTERNAL_LINKS } from "@/lib/constants" import { ArrowRight } from "lucide-react" @@ -28,12 +29,12 @@ export default async function Home() {
-

- An entire AI-powered dev team. In your editor and beyond. +

+ The AI dev team that gets things done.

-

- Roo's model-agnostic, specialized modes and fine-grained auto-approval controls - give you the tools (and the confidence) to get AI working for you. +

+ Costrict's specialized modes stay on task and ship great code. Open source and + works with any model.

@@ -56,11 +57,12 @@ export default async function Home() { href={EXTERNAL_LINKS.CLOUD_APP_SIGNUP} target="_blank" className="flex w-full items-center justify-center"> - Get started with Cloud + Try Cloud
+
diff --git a/apps/web-roo-code/src/app/terms/page.tsx b/apps/web-roo-code/src/app/terms/page.tsx index 7fd0501d554..c042ab2aa84 100644 --- a/apps/web-roo-code/src/app/terms/page.tsx +++ b/apps/web-roo-code/src/app/terms/page.tsx @@ -52,7 +52,7 @@ export default function Terms() {

These Terms of Service ("TOS") govern access to and use of the - Costrict Code Cloud service (the "Service"). They apply to: + Costrict Cloud service (the "Service"). They apply to:

  • diff --git a/apps/web-roo-code/src/components/homepage/company-logos.tsx b/apps/web-roo-code/src/components/homepage/company-logos.tsx index cedc6817599..a27e8bbc161 100644 --- a/apps/web-roo-code/src/components/homepage/company-logos.tsx +++ b/apps/web-roo-code/src/components/homepage/company-logos.tsx @@ -1,36 +1,33 @@ "use client" import { motion } from "framer-motion" +import Image from "next/image" -export function CompanyLogos() { - const logos = [ - { name: "Company 1", logo: "/placeholder.svg?height=40&width=120" }, - { name: "Company 2", logo: "/placeholder.svg?height=40&width=120" }, - { name: "Company 3", logo: "/placeholder.svg?height=40&width=120" }, - { name: "Company 4", logo: "/placeholder.svg?height=40&width=120" }, - { name: "Company 5", logo: "/placeholder.svg?height=40&width=120" }, - { name: "Company 6", logo: "/placeholder.svg?height=40&width=120" }, - ] +const logos = ["Apple", "Netflix", "Microsoft", "Amazon", "ByteDance", "Rakuten", "Carvana"] +export function CompanyLogos() { return ( -
    -
    - {logos.map((company, index) => ( +
    + + Making devs more productive at + +
    + {logos.map((logo, index) => ( - {/* eslint-disable @next/next/no-img-element */} - {company.name} + {`${logo} ))} diff --git a/apps/web-roo-code/src/components/homepage/features.tsx b/apps/web-roo-code/src/components/homepage/features.tsx index acb1a4eb848..2d23f9903e0 100644 --- a/apps/web-roo-code/src/components/homepage/features.tsx +++ b/apps/web-roo-code/src/components/homepage/features.tsx @@ -1,48 +1,52 @@ "use client" import { motion } from "framer-motion" -import { Brain, Shield, Users2, ReplaceAll, Keyboard, LucideIcon, CheckCheck } from "lucide-react" +import { Shield, Users2, ReplaceAll, Keyboard, LucideIcon, CheckCheck, GitPullRequest } from "lucide-react" +import Image from "next/image" export interface Feature { icon: LucideIcon title: string description: string + logos?: string[] } export const features: Feature[] = [ { icon: Users2, - title: "Specialized Modes", + title: "Specialized modes", description: - "Planning, Architecture, Debugging and beyond: Roo's modes stay on-task and deliver. Create your own modes or download from the marketplace.", + "Planning, Architecture, Debugging and beyond: Costrict's modes stay on-task and deliver. They even know when to hand off work to other modes. Create your own or download from the marketplace.", }, { icon: ReplaceAll, - title: "Model-Agnostic", - description: "Bring your own model key or use local inference — no markup, lock-in, no restrictions.", + title: "Model-agnostic", + description: "Bring your own provider key or even run local inference — no markup, lock-in, no restrictions.", + logos: ["Anthropic", "OpenAI", "Gemini", "Grok", "Qwen", "Kimi", "Mistral", "Ollama"], }, { icon: CheckCheck, title: "Granular auto-approval", - description: "Control each action and make Roo as autonomous as you want as you build confidence. Or go YOLO.", + description: + "Control each action and make Costrict as autonomous as you want as you build confidence. Or go YOLO and let it rip.", }, { - icon: Keyboard, - title: "Highly Customizable", + icon: GitPullRequest, + title: "Proudly open source", description: - "Fine-tune settings for Roo to work for you, like inference context, model properties, slash commands and more.", + "Community-driven and fully auditable: no throttling or surprises about what's happening behind the scenes.", }, { - icon: Brain, - title: "Deep Project-wide Context", + icon: Keyboard, + title: "Highly customizable", description: - "Costrict reads your entire codebase, preserving valid code through diff-based edits for seamless multi-file refactors.", + "Fine-tune settings for Costrict to work for you, like inference context, model properties, slash commands and more.", }, { icon: Shield, - title: "Secure and Private by Design", + title: "Secure and private by design", description: - "Open source and local-first. No code leaves your machine unless you say so. SOC 2 Type II compliant.", + "Client-only architecture means no code leaves your machine unless you say so. SOC 2 Type II compliant.", }, ] @@ -108,7 +112,7 @@ export function Features() { initial="hidden" whileInView="visible" viewport={{ once: true }}> -
      +
        {features.map((feature, index) => { const Icon = feature.icon return ( @@ -120,6 +124,20 @@ export function Features() {

        {feature.description}

        + {feature.logos && ( +
        + {feature.logos.map((logo) => ( + {`${logo} + ))} +
        + )} ) })} diff --git a/apps/web-roo-code/src/components/homepage/install-section.tsx b/apps/web-roo-code/src/components/homepage/install-section.tsx index 41c822e71f2..e716e771727 100644 --- a/apps/web-roo-code/src/components/homepage/install-section.tsx +++ b/apps/web-roo-code/src/components/homepage/install-section.tsx @@ -50,7 +50,8 @@ export function InstallSection({ downloads }: InstallSectionProps) { Install Costrict now

        - Install from the VSCode Marketplace or the CLI in minutes, then bring your own AI model. + Install from the VS Code Marketplace or the CLI in minutes, then bring your own AI + model.
        Costrict is also compatible with all VSCode forks.

        @@ -62,13 +63,15 @@ export function InstallSection({ downloads }: InstallSectionProps) { target="_blank" className="group relative inline-flex w-full items-center justify-center gap-3 rounded-xl bg-gradient-to-r from-blue-600 to-cyan-600 px-6 py-4 text-lg font-medium text-white shadow-lg transition-all duration-300 hover:from-blue-700 hover:to-cyan-700 hover:shadow-xl hover:shadow-blue-500/25 dark:from-blue-500 dark:to-cyan-500 dark:hover:from-blue-600 dark:hover:to-cyan-600 sm:w-auto sm:px-8 sm:text-xl">
        -
        - - - From VSCode Marketplace +
        + + + From VS Code Marketplace {downloads !== null && ( <> - · + + · + {downloads} Downloads )} diff --git a/packages/telemetry/src/TelemetryService.ts b/packages/telemetry/src/TelemetryService.ts index 412f4de3e24..ccaf7d48b7e 100644 --- a/packages/telemetry/src/TelemetryService.ts +++ b/packages/telemetry/src/TelemetryService.ts @@ -1,6 +1,11 @@ import { ZodError } from "zod" -import { type TelemetryClient, type TelemetryPropertiesProvider, TelemetryEventName } from "@roo-code/types" +import { + type TelemetryClient, + type TelemetryPropertiesProvider, + TelemetryEventName, + type TelemetrySetting, +} from "@roo-code/types" /** * TelemetryService wrapper class that defers initialization. @@ -242,6 +247,18 @@ export class TelemetryService { this.captureEvent(TelemetryEventName.ERROR, { error_type: errorType }) } + /** + * Captures when telemetry settings are changed + * @param previousSetting The previous telemetry setting + * @param newSetting The new telemetry setting + */ + public captureTelemetrySettingsChanged(previousSetting: TelemetrySetting, newSetting: TelemetrySetting): void { + this.captureEvent(TelemetryEventName.TELEMETRY_SETTINGS_CHANGED, { + previousSetting, + newSetting, + }) + } + /** * Checks if telemetry is currently enabled * @returns Whether telemetry is enabled diff --git a/packages/types/src/providers/roo.ts b/packages/types/src/providers/roo.ts index 01fae43cd57..63650ac9a1a 100644 --- a/packages/types/src/providers/roo.ts +++ b/packages/types/src/providers/roo.ts @@ -2,7 +2,7 @@ import type { ModelInfo } from "../model.js" export type RooModelId = | "xai/grok-code-fast-1" - | "roo/code-supernova" + | "roo/code-supernova-1-million" | "xai/grok-4-fast" | "deepseek/deepseek-chat-v3.1" @@ -19,15 +19,15 @@ export const rooModels = { description: "A reasoning model that is blazing fast and excels at agentic coding, accessible for free through Roo Code Cloud for a limited time. (Note: the free prompts and completions are logged by xAI and used to improve the model.)", }, - "roo/code-supernova": { - maxTokens: 16_384, - contextWindow: 200_000, + "roo/code-supernova-1-million": { + maxTokens: 30_000, + contextWindow: 1_000_000, supportsImages: true, supportsPromptCache: true, inputPrice: 0, outputPrice: 0, description: - "A versatile agentic coding stealth model that supports image inputs, accessible for free through Roo Code Cloud for a limited time. (Note: the free prompts and completions are logged by the model provider and used to improve the model.)", + "A versatile agentic coding stealth model with a 1M token context window that supports image inputs, accessible for free through Roo Code Cloud for a limited time. (Note: the free prompts and completions are logged by the model provider and used to improve the model.)", }, "xai/grok-4-fast": { maxTokens: 30_000, diff --git a/packages/types/src/telemetry.ts b/packages/types/src/telemetry.ts index 503a4b929ca..bcf832b7403 100644 --- a/packages/types/src/telemetry.ts +++ b/packages/types/src/telemetry.ts @@ -76,6 +76,7 @@ export enum TelemetryEventName { CODE_TAB_COMPLETION = "Code Tab Completion", ERROR = "Error", + TELEMETRY_SETTINGS_CHANGED = "Telemetry Settings Changed", } /** @@ -207,6 +208,14 @@ export const rooCodeTelemetryEventSchema = z.discriminatedUnion("type", [ ]), properties: telemetryPropertiesSchema, }), + z.object({ + type: z.literal(TelemetryEventName.TELEMETRY_SETTINGS_CHANGED), + properties: z.object({ + ...telemetryPropertiesSchema.shape, + previousSetting: telemetrySettingsSchema, + newSetting: telemetrySettingsSchema, + }), + }), z.object({ type: z.literal(TelemetryEventName.TASK_MESSAGE), properties: z.object({ diff --git a/releases/3.28.9-release.png b/releases/3.28.9-release.png new file mode 100644 index 00000000000..a2272430035 Binary files /dev/null and b/releases/3.28.9-release.png differ diff --git a/src/api/providers/__tests__/lite-llm.spec.ts b/src/api/providers/__tests__/lite-llm.spec.ts index 88fa2d313c5..fe62ad3922c 100644 --- a/src/api/providers/__tests__/lite-llm.spec.ts +++ b/src/api/providers/__tests__/lite-llm.spec.ts @@ -9,15 +9,9 @@ import { litellmDefaultModelId, litellmDefaultModelInfo } from "@roo-code/types" vi.mock("vscode", () => ({})) // Mock OpenAI -vi.mock("openai", () => { - const mockStream = { - [Symbol.asyncIterator]: vi.fn(), - } - - const mockCreate = vi.fn().mockReturnValue({ - withResponse: vi.fn().mockResolvedValue({ data: mockStream }), - }) +const mockCreate = vi.fn() +vi.mock("openai", () => { return { default: vi.fn().mockImplementation(() => ({ chat: { @@ -34,6 +28,18 @@ vi.mock("../fetchers/modelCache", () => ({ getModels: vi.fn().mockImplementation(() => { return Promise.resolve({ [litellmDefaultModelId]: litellmDefaultModelInfo, + "gpt-5": { ...litellmDefaultModelInfo, maxTokens: 8192 }, + gpt5: { ...litellmDefaultModelInfo, maxTokens: 8192 }, + "GPT-5": { ...litellmDefaultModelInfo, maxTokens: 8192 }, + "gpt-5-turbo": { ...litellmDefaultModelInfo, maxTokens: 8192 }, + "gpt5-preview": { ...litellmDefaultModelInfo, maxTokens: 8192 }, + "gpt-5o": { ...litellmDefaultModelInfo, maxTokens: 8192 }, + "gpt-5.1": { ...litellmDefaultModelInfo, maxTokens: 8192 }, + "gpt-5-mini": { ...litellmDefaultModelInfo, maxTokens: 8192 }, + "gpt-4": { ...litellmDefaultModelInfo, maxTokens: 8192 }, + "claude-3-opus": { ...litellmDefaultModelInfo, maxTokens: 8192 }, + "llama-3": { ...litellmDefaultModelInfo, maxTokens: 8192 }, + "gpt-4-turbo": { ...litellmDefaultModelInfo, maxTokens: 8192 }, }) }), })) @@ -41,7 +47,6 @@ vi.mock("../fetchers/modelCache", () => ({ describe("LiteLLMHandler", () => { let handler: LiteLLMHandler let mockOptions: ApiHandlerOptions - let mockOpenAIClient: any beforeEach(() => { vi.clearAllMocks() @@ -51,7 +56,6 @@ describe("LiteLLMHandler", () => { litellmModelId: litellmDefaultModelId, } handler = new LiteLLMHandler(mockOptions) - mockOpenAIClient = new OpenAI() }) describe("prompt caching", () => { @@ -84,7 +88,7 @@ describe("LiteLLMHandler", () => { }, } - mockOpenAIClient.chat.completions.create.mockReturnValue({ + mockCreate.mockReturnValue({ withResponse: vi.fn().mockResolvedValue({ data: mockStream }), }) @@ -95,7 +99,7 @@ describe("LiteLLMHandler", () => { } // Verify that create was called with cache control headers - const createCall = mockOpenAIClient.chat.completions.create.mock.calls[0][0] + const createCall = mockCreate.mock.calls[0][0] // Check system message has cache control in the proper format expect(createCall.messages[0]).toMatchObject({ @@ -154,4 +158,233 @@ describe("LiteLLMHandler", () => { }) }) }) + + describe("GPT-5 model handling", () => { + it("should use max_completion_tokens instead of max_tokens for GPT-5 models", async () => { + const optionsWithGPT5: ApiHandlerOptions = { + ...mockOptions, + litellmModelId: "gpt-5", + } + handler = new LiteLLMHandler(optionsWithGPT5) + + const systemPrompt = "You are a helpful assistant" + const messages: Anthropic.Messages.MessageParam[] = [{ role: "user", content: "Hello" }] + + // Mock the stream response + const mockStream = { + async *[Symbol.asyncIterator]() { + yield { + choices: [{ delta: { content: "Hello!" } }], + usage: { + prompt_tokens: 10, + completion_tokens: 5, + }, + } + }, + } + + mockCreate.mockReturnValue({ + withResponse: vi.fn().mockResolvedValue({ data: mockStream }), + }) + + const generator = handler.createMessage(systemPrompt, messages) + const results = [] + for await (const chunk of generator) { + results.push(chunk) + } + + // Verify that create was called with max_completion_tokens instead of max_tokens + const createCall = mockCreate.mock.calls[0][0] + + // Should have max_completion_tokens, not max_tokens + expect(createCall.max_completion_tokens).toBeDefined() + expect(createCall.max_tokens).toBeUndefined() + }) + + it("should use max_completion_tokens for various GPT-5 model variations", async () => { + const gpt5Variations = [ + "gpt-5", + "gpt5", + "GPT-5", + "gpt-5-turbo", + "gpt5-preview", + "gpt-5o", + "gpt-5.1", + "gpt-5-mini", + ] + + for (const modelId of gpt5Variations) { + vi.clearAllMocks() + + const optionsWithGPT5: ApiHandlerOptions = { + ...mockOptions, + litellmModelId: modelId, + } + handler = new LiteLLMHandler(optionsWithGPT5) + + const systemPrompt = "You are a helpful assistant" + const messages: Anthropic.Messages.MessageParam[] = [{ role: "user", content: "Test" }] + + // Mock the stream response + const mockStream = { + async *[Symbol.asyncIterator]() { + yield { + choices: [{ delta: { content: "Response" } }], + usage: { + prompt_tokens: 10, + completion_tokens: 5, + }, + } + }, + } + + mockCreate.mockReturnValue({ + withResponse: vi.fn().mockResolvedValue({ data: mockStream }), + }) + + const generator = handler.createMessage(systemPrompt, messages) + for await (const chunk of generator) { + // Consume the generator + } + + // Verify that create was called with max_completion_tokens for this model variation + const createCall = mockCreate.mock.calls[0][0] + + expect(createCall.max_completion_tokens).toBeDefined() + expect(createCall.max_tokens).toBeUndefined() + } + }) + + it("should still use max_tokens for non-GPT-5 models", async () => { + const nonGPT5Models = ["gpt-4", "claude-3-opus", "llama-3", "gpt-4-turbo"] + + for (const modelId of nonGPT5Models) { + vi.clearAllMocks() + + const options: ApiHandlerOptions = { + ...mockOptions, + litellmModelId: modelId, + } + handler = new LiteLLMHandler(options) + + const systemPrompt = "You are a helpful assistant" + const messages: Anthropic.Messages.MessageParam[] = [{ role: "user", content: "Test" }] + + // Mock the stream response + const mockStream = { + async *[Symbol.asyncIterator]() { + yield { + choices: [{ delta: { content: "Response" } }], + usage: { + prompt_tokens: 10, + completion_tokens: 5, + }, + } + }, + } + + mockCreate.mockReturnValue({ + withResponse: vi.fn().mockResolvedValue({ data: mockStream }), + }) + + const generator = handler.createMessage(systemPrompt, messages) + for await (const chunk of generator) { + // Consume the generator + } + + // Verify that create was called with max_tokens for non-GPT-5 models + const createCall = mockCreate.mock.calls[0][0] + + expect(createCall.max_tokens).toBeDefined() + expect(createCall.max_completion_tokens).toBeUndefined() + } + }) + + it("should use max_completion_tokens in completePrompt for GPT-5 models", async () => { + const optionsWithGPT5: ApiHandlerOptions = { + ...mockOptions, + litellmModelId: "gpt-5", + } + handler = new LiteLLMHandler(optionsWithGPT5) + + mockCreate.mockResolvedValue({ + choices: [{ message: { content: "Test response" } }], + }) + + await handler.completePrompt("Test prompt") + + // Verify that create was called with max_completion_tokens + const createCall = mockCreate.mock.calls[0][0] + + expect(createCall.max_completion_tokens).toBeDefined() + expect(createCall.max_tokens).toBeUndefined() + }) + + it("should not set any max token fields when maxTokens is undefined (GPT-5 streaming)", async () => { + const optionsWithGPT5: ApiHandlerOptions = { + ...mockOptions, + litellmModelId: "gpt-5", + } + handler = new LiteLLMHandler(optionsWithGPT5) + + // Force fetchModel to return undefined maxTokens + vi.spyOn(handler as any, "fetchModel").mockResolvedValue({ + id: "gpt-5", + info: { ...litellmDefaultModelInfo, maxTokens: undefined }, + }) + + // Mock the stream response + const mockStream = { + async *[Symbol.asyncIterator]() { + yield { + choices: [{ delta: { content: "Hello!" } }], + usage: { + prompt_tokens: 10, + completion_tokens: 5, + }, + } + }, + } + + mockCreate.mockReturnValue({ + withResponse: vi.fn().mockResolvedValue({ data: mockStream }), + }) + + const generator = handler.createMessage("You are a helpful assistant", [ + { role: "user", content: "Hello" } as unknown as Anthropic.Messages.MessageParam, + ]) + for await (const _chunk of generator) { + // consume + } + + // Should not include either token field + const createCall = mockCreate.mock.calls[0][0] + expect(createCall.max_tokens).toBeUndefined() + expect(createCall.max_completion_tokens).toBeUndefined() + }) + + it("should not set any max token fields when maxTokens is undefined (GPT-5 completePrompt)", async () => { + const optionsWithGPT5: ApiHandlerOptions = { + ...mockOptions, + litellmModelId: "gpt-5", + } + handler = new LiteLLMHandler(optionsWithGPT5) + + // Force fetchModel to return undefined maxTokens + vi.spyOn(handler as any, "fetchModel").mockResolvedValue({ + id: "gpt-5", + info: { ...litellmDefaultModelInfo, maxTokens: undefined }, + }) + + mockCreate.mockResolvedValue({ + choices: [{ message: { content: "Ok" } }], + }) + + await handler.completePrompt("Test prompt") + + const createCall = mockCreate.mock.calls[0][0] + expect(createCall.max_tokens).toBeUndefined() + expect(createCall.max_completion_tokens).toBeUndefined() + }) + }) }) diff --git a/src/api/providers/lite-llm.ts b/src/api/providers/lite-llm.ts index 7cea7411feb..9f58f092234 100644 --- a/src/api/providers/lite-llm.ts +++ b/src/api/providers/lite-llm.ts @@ -32,6 +32,12 @@ export class LiteLLMHandler extends RouterProvider implements SingleCompletionHa }) } + private isGpt5(modelId: string): boolean { + // Match gpt-5, gpt5, and variants like gpt-5o, gpt-5-turbo, gpt5-preview, gpt-5.1 + // Avoid matching gpt-50, gpt-500, etc. + return /\bgpt-?5(?!\d)/i.test(modelId) + } + override async *createMessage( systemPrompt: string, messages: Anthropic.Messages.MessageParam[], @@ -107,9 +113,11 @@ export class LiteLLMHandler extends RouterProvider implements SingleCompletionHa // Required by some providers; others default to max tokens allowed let maxTokens: number | undefined = info.maxTokens ?? undefined + // Check if this is a GPT-5 model that requires max_completion_tokens instead of max_tokens + const isGPT5Model = this.isGpt5(modelId) + const requestOptions: OpenAI.Chat.Completions.ChatCompletionCreateParamsStreaming = { model: modelId, - max_tokens: maxTokens, messages: [systemMessage, ...enhancedMessages], stream: true, stream_options: { @@ -117,6 +125,13 @@ export class LiteLLMHandler extends RouterProvider implements SingleCompletionHa }, } + // GPT-5 models require max_completion_tokens instead of the deprecated max_tokens parameter + if (isGPT5Model && maxTokens) { + requestOptions.max_completion_tokens = maxTokens + } else if (maxTokens) { + requestOptions.max_tokens = maxTokens + } + if (this.supportsTemperature(modelId)) { requestOptions.temperature = this.options.modelTemperature ?? 0 } @@ -179,6 +194,9 @@ export class LiteLLMHandler extends RouterProvider implements SingleCompletionHa async completePrompt(prompt: string): Promise { const { id: modelId, info } = await this.fetchModel() + // Check if this is a GPT-5 model that requires max_completion_tokens instead of max_tokens + const isGPT5Model = this.isGpt5(modelId) + try { const requestOptions: OpenAI.Chat.Completions.ChatCompletionCreateParamsNonStreaming = { model: modelId, @@ -189,7 +207,12 @@ export class LiteLLMHandler extends RouterProvider implements SingleCompletionHa requestOptions.temperature = this.options.modelTemperature ?? 0 } - requestOptions.max_tokens = info.maxTokens + // GPT-5 models require max_completion_tokens instead of the deprecated max_tokens parameter + if (isGPT5Model && info.maxTokens) { + requestOptions.max_completion_tokens = info.maxTokens + } else if (info.maxTokens) { + requestOptions.max_tokens = info.maxTokens + } const response = await this.client.chat.completions.create(requestOptions) return response.choices[0]?.message.content || "" diff --git a/src/core/config/ProviderSettingsManager.ts b/src/core/config/ProviderSettingsManager.ts index 236976178a2..7094b826634 100644 --- a/src/core/config/ProviderSettingsManager.ts +++ b/src/core/config/ProviderSettingsManager.ts @@ -11,11 +11,24 @@ import { ProviderSettingsEntry, DEFAULT_CONSECUTIVE_MISTAKE_LIMIT, getModelId, + type ProviderName, + type RooModelId, } from "@roo-code/types" import { TelemetryService } from "@roo-code/telemetry" import { Mode, modes } from "../../shared/modes" +// Type-safe model migrations mapping +type ModelMigrations = { + [K in ProviderName]?: Record +} + +const MODEL_MIGRATIONS: ModelMigrations = { + roo: { + "roo/code-supernova": "roo/code-supernova-1-million" as RooModelId, + }, +} as const satisfies ModelMigrations + export interface SyncCloudProfilesResult { hasChanges: boolean activeProfileChanged: boolean @@ -109,6 +122,11 @@ export class ProviderSettingsManager { isDirty = true } + // Apply model migrations for all providers + if (this.applyModelMigrations(providerProfiles)) { + isDirty = true + } + // Ensure all configs have IDs. for (const [_name, apiConfig] of Object.entries(providerProfiles.apiConfigs)) { if (!apiConfig.id) { @@ -276,6 +294,44 @@ export class ProviderSettingsManager { } } + /** + * Apply model migrations for all providers + * Returns true if any migrations were applied + */ + private applyModelMigrations(providerProfiles: ProviderProfiles): boolean { + let migrated = false + + try { + for (const [_name, apiConfig] of Object.entries(providerProfiles.apiConfigs)) { + // Skip configs without provider or model ID + if (!apiConfig.apiProvider || !apiConfig.apiModelId) { + continue + } + + // Check if this provider has migrations (with type safety) + const provider = apiConfig.apiProvider as ProviderName + const providerMigrations = MODEL_MIGRATIONS[provider] + if (!providerMigrations) { + continue + } + + // Check if the current model ID needs migration + const newModelId = providerMigrations[apiConfig.apiModelId] + if (newModelId && newModelId !== apiConfig.apiModelId) { + console.log( + `[ModelMigration] Migrating ${apiConfig.apiProvider} model from ${apiConfig.apiModelId} to ${newModelId}`, + ) + apiConfig.apiModelId = newModelId + migrated = true + } + } + } catch (error) { + console.error(`[ModelMigration] Failed to apply model migrations:`, error) + } + + return migrated + } + /** * Clean model ID by removing prefix before "/" */ diff --git a/src/core/config/__tests__/ProviderSettingsManager.spec.ts b/src/core/config/__tests__/ProviderSettingsManager.spec.ts index e95d2b100ba..b710dc6cca8 100644 --- a/src/core/config/__tests__/ProviderSettingsManager.spec.ts +++ b/src/core/config/__tests__/ProviderSettingsManager.spec.ts @@ -229,6 +229,121 @@ describe("ProviderSettingsManager", () => { expect(storedConfig.migrations.todoListEnabledMigrated).toEqual(true) }) + it("should apply model migrations for all providers", async () => { + mockSecrets.get.mockResolvedValue( + JSON.stringify({ + currentApiConfigName: "default", + apiConfigs: { + default: { + config: {}, + id: "default", + apiProvider: "roo", + apiModelId: "roo/code-supernova", // Old model ID + }, + test: { + apiProvider: "roo", + apiModelId: "roo/code-supernova", // Old model ID + }, + existing: { + apiProvider: "roo", + apiModelId: "roo/code-supernova-1-million", // Already migrated + }, + otherProvider: { + apiProvider: "anthropic", + apiModelId: "roo/code-supernova", // Should not be migrated (different provider) + }, + noProvider: { + id: "no-provider", + apiModelId: "roo/code-supernova", // Should not be migrated (no provider) + }, + }, + migrations: { + rateLimitSecondsMigrated: true, + diffSettingsMigrated: true, + openAiHeadersMigrated: true, + consecutiveMistakeLimitMigrated: true, + todoListEnabledMigrated: true, + }, + }), + ) + + await providerSettingsManager.initialize() + + // Get the last call to store, which should contain the migrated config + const calls = mockSecrets.store.mock.calls + const storedConfig = JSON.parse(calls[calls.length - 1][1]) + + // Roo provider configs should be migrated + expect(storedConfig.apiConfigs.default.apiModelId).toEqual("roo/code-supernova-1-million") + expect(storedConfig.apiConfigs.test.apiModelId).toEqual("roo/code-supernova-1-million") + expect(storedConfig.apiConfigs.existing.apiModelId).toEqual("roo/code-supernova-1-million") + + // Non-roo provider configs should not be migrated + expect(storedConfig.apiConfigs.otherProvider.apiModelId).toEqual("roo/code-supernova") + expect(storedConfig.apiConfigs.noProvider.apiModelId).toEqual("roo/code-supernova") + }) + + it("should apply model migrations every time, not just once", async () => { + // First load with old model + mockSecrets.get.mockResolvedValue( + JSON.stringify({ + currentApiConfigName: "default", + apiConfigs: { + default: { + apiProvider: "roo", + apiModelId: "roo/code-supernova", + id: "default", + }, + }, + migrations: { + rateLimitSecondsMigrated: true, + diffSettingsMigrated: true, + openAiHeadersMigrated: true, + consecutiveMistakeLimitMigrated: true, + todoListEnabledMigrated: true, + }, + }), + ) + + await providerSettingsManager.initialize() + + // Verify migration happened + let calls = mockSecrets.store.mock.calls + let storedConfig = JSON.parse(calls[calls.length - 1][1]) + expect(storedConfig.apiConfigs.default.apiModelId).toEqual("roo/code-supernova-1-million") + + // Create a new instance to simulate another load + const newManager = new ProviderSettingsManager(mockContext) + + // Somehow the model got reverted (e.g., manual edit, sync issue) + mockSecrets.get.mockResolvedValue( + JSON.stringify({ + currentApiConfigName: "default", + apiConfigs: { + default: { + apiProvider: "roo", + apiModelId: "roo/code-supernova", // Old model again + id: "default", + }, + }, + migrations: { + rateLimitSecondsMigrated: true, + diffSettingsMigrated: true, + openAiHeadersMigrated: true, + consecutiveMistakeLimitMigrated: true, + todoListEnabledMigrated: true, + }, + }), + ) + + await newManager.initialize() + + // Verify migration happened again + calls = mockSecrets.store.mock.calls + storedConfig = JSON.parse(calls[calls.length - 1][1]) + expect(storedConfig.apiConfigs.default.apiModelId).toEqual("roo/code-supernova-1-million") + }) + it("should throw error if secrets storage fails", async () => { mockSecrets.get.mockRejectedValue(new Error("Storage failed")) diff --git a/src/core/prompts/__tests__/__snapshots__/add-custom-instructions/architect-mode-prompt.snap b/src/core/prompts/__tests__/__snapshots__/add-custom-instructions/architect-mode-prompt.snap index 14bbfe2ca5f..dafc9251e71 100644 --- a/src/core/prompts/__tests__/__snapshots__/add-custom-instructions/architect-mode-prompt.snap +++ b/src/core/prompts/__tests__/__snapshots__/add-custom-instructions/architect-mode-prompt.snap @@ -290,7 +290,7 @@ Example: ## attempt_completion Description: After each tool use, the user will respond with the result of that tool use, i.e. if it succeeded or failed, along with any reasons for failure. Once you've received the results of tool uses and can confirm that the task is complete, use this tool to present the result of your work to the user. The user may respond with feedback if they are not satisfied with the result, which you can use to make improvements and try again. -IMPORTANT NOTE: This tool CANNOT be used until you've confirmed from the user that any previous tool uses were successful. Failure to do so will result in code corruption and system failure. Before using this tool, you must ask yourself in tags if you've confirmed from the user that any previous tool uses were successful. If not, then DO NOT use this tool. +IMPORTANT NOTE: This tool CANNOT be used until you've confirmed from the user that any previous tool uses were successful. Failure to do so will result in code corruption and system failure. Before using this tool, you must confirm that you've received successful results from the user for any previous tool uses. If not, then DO NOT use this tool. Parameters: - result: (required) The result of the task. Formulate this result in a way that is final and does not require further input from the user. Don't end your result with questions or offers for further assistance. Usage: @@ -416,7 +416,7 @@ Replace the entire TODO list with an updated checklist reflecting the current st # Tool Use Guidelines -1. In tags, assess what information you already have and what information you need to proceed with the task. +1. Assess what information you already have and what information you need to proceed with the task. 2. Choose the most appropriate tool based on the task and the tool descriptions provided. Assess if you need additional information to proceed, and which of the available tools would be most effective for gathering this information. For example using the list_files tool is more effective than running a command like `ls` in the terminal. It's critical that you think about each available tool and use the one that best fits the current step in the task. 3. If multiple actions are needed, use one tool at a time per message to accomplish the task iteratively, with each tool use being informed by the result of the previous tool use. Do not assume the outcome of any tool use. Each step must be informed by the previous step's result. 4. Formulate your tool use using the XML format specified for each tool. @@ -506,7 +506,7 @@ You accomplish a given task iteratively, breaking it down into clear steps and w 1. Analyze the user's task and set clear, achievable goals to accomplish it. Prioritize these goals in a logical order. 2. Work through these goals sequentially, utilizing available tools one at a time as necessary. Each goal should correspond to a distinct step in your problem-solving process. You will be informed on the work completed and what's remaining as you go. -3. Remember, you have extensive capabilities with access to a wide range of tools that can be used in powerful and clever ways as necessary to accomplish each goal. Before calling a tool, do some analysis within tags. First, analyze the file structure provided in environment_details to gain context and insights for proceeding effectively. Next, think about which of the provided tools is the most relevant tool to accomplish the user's task. Go through each of the required parameters of the relevant tool and determine if the user has directly provided or given enough information to infer a value. When deciding if the parameter can be inferred, carefully consider all the context to see if it supports a specific value. If all of the required parameters are present or can be reasonably inferred, close the thinking tag and proceed with the tool use. BUT, if one of the values for a required parameter is missing, DO NOT invoke the tool (not even with fillers for the missing params) and instead, ask the user to provide the missing parameters using the ask_followup_question tool. DO NOT ask for more information on optional parameters if it is not provided. +3. Remember, you have extensive capabilities with access to a wide range of tools that can be used in powerful and clever ways as necessary to accomplish each goal. Before calling a tool, do some analysis. First, analyze the file structure provided in environment_details to gain context and insights for proceeding effectively. Next, think about which of the provided tools is the most relevant tool to accomplish the user's task. Go through each of the required parameters of the relevant tool and determine if the user has directly provided or given enough information to infer a value. When deciding if the parameter can be inferred, carefully consider all the context to see if it supports a specific value. If all of the required parameters are present or can be reasonably inferred, proceed with the tool use. BUT, if one of the values for a required parameter is missing, DO NOT invoke the tool (not even with fillers for the missing params) and instead, ask the user to provide the missing parameters using the ask_followup_question tool. DO NOT ask for more information on optional parameters if it is not provided. 4. Once you've completed the user's task, you must use the attempt_completion tool to present the result of the task to the user. 5. The user may provide feedback, which you can use to make improvements and try again. But DO NOT continue in pointless back and forth conversations, i.e. don't end your responses with questions or offers for further assistance. diff --git a/src/core/prompts/__tests__/__snapshots__/add-custom-instructions/ask-mode-prompt.snap b/src/core/prompts/__tests__/__snapshots__/add-custom-instructions/ask-mode-prompt.snap index 3049a5b31ad..9f8e423c381 100644 --- a/src/core/prompts/__tests__/__snapshots__/add-custom-instructions/ask-mode-prompt.snap +++ b/src/core/prompts/__tests__/__snapshots__/add-custom-instructions/ask-mode-prompt.snap @@ -187,7 +187,7 @@ Example: ## attempt_completion Description: After each tool use, the user will respond with the result of that tool use, i.e. if it succeeded or failed, along with any reasons for failure. Once you've received the results of tool uses and can confirm that the task is complete, use this tool to present the result of your work to the user. The user may respond with feedback if they are not satisfied with the result, which you can use to make improvements and try again. -IMPORTANT NOTE: This tool CANNOT be used until you've confirmed from the user that any previous tool uses were successful. Failure to do so will result in code corruption and system failure. Before using this tool, you must ask yourself in tags if you've confirmed from the user that any previous tool uses were successful. If not, then DO NOT use this tool. +IMPORTANT NOTE: This tool CANNOT be used until you've confirmed from the user that any previous tool uses were successful. Failure to do so will result in code corruption and system failure. Before using this tool, you must confirm that you've received successful results from the user for any previous tool uses. If not, then DO NOT use this tool. Parameters: - result: (required) The result of the task. Formulate this result in a way that is final and does not require further input from the user. Don't end your result with questions or offers for further assistance. Usage: @@ -313,7 +313,7 @@ Replace the entire TODO list with an updated checklist reflecting the current st # Tool Use Guidelines -1. In tags, assess what information you already have and what information you need to proceed with the task. +1. Assess what information you already have and what information you need to proceed with the task. 2. Choose the most appropriate tool based on the task and the tool descriptions provided. Assess if you need additional information to proceed, and which of the available tools would be most effective for gathering this information. For example using the list_files tool is more effective than running a command like `ls` in the terminal. It's critical that you think about each available tool and use the one that best fits the current step in the task. 3. If multiple actions are needed, use one tool at a time per message to accomplish the task iteratively, with each tool use being informed by the result of the previous tool use. Do not assume the outcome of any tool use. Each step must be informed by the previous step's result. 4. Formulate your tool use using the XML format specified for each tool. @@ -403,7 +403,7 @@ You accomplish a given task iteratively, breaking it down into clear steps and w 1. Analyze the user's task and set clear, achievable goals to accomplish it. Prioritize these goals in a logical order. 2. Work through these goals sequentially, utilizing available tools one at a time as necessary. Each goal should correspond to a distinct step in your problem-solving process. You will be informed on the work completed and what's remaining as you go. -3. Remember, you have extensive capabilities with access to a wide range of tools that can be used in powerful and clever ways as necessary to accomplish each goal. Before calling a tool, do some analysis within tags. First, analyze the file structure provided in environment_details to gain context and insights for proceeding effectively. Next, think about which of the provided tools is the most relevant tool to accomplish the user's task. Go through each of the required parameters of the relevant tool and determine if the user has directly provided or given enough information to infer a value. When deciding if the parameter can be inferred, carefully consider all the context to see if it supports a specific value. If all of the required parameters are present or can be reasonably inferred, close the thinking tag and proceed with the tool use. BUT, if one of the values for a required parameter is missing, DO NOT invoke the tool (not even with fillers for the missing params) and instead, ask the user to provide the missing parameters using the ask_followup_question tool. DO NOT ask for more information on optional parameters if it is not provided. +3. Remember, you have extensive capabilities with access to a wide range of tools that can be used in powerful and clever ways as necessary to accomplish each goal. Before calling a tool, do some analysis. First, analyze the file structure provided in environment_details to gain context and insights for proceeding effectively. Next, think about which of the provided tools is the most relevant tool to accomplish the user's task. Go through each of the required parameters of the relevant tool and determine if the user has directly provided or given enough information to infer a value. When deciding if the parameter can be inferred, carefully consider all the context to see if it supports a specific value. If all of the required parameters are present or can be reasonably inferred, proceed with the tool use. BUT, if one of the values for a required parameter is missing, DO NOT invoke the tool (not even with fillers for the missing params) and instead, ask the user to provide the missing parameters using the ask_followup_question tool. DO NOT ask for more information on optional parameters if it is not provided. 4. Once you've completed the user's task, you must use the attempt_completion tool to present the result of the task to the user. 5. The user may provide feedback, which you can use to make improvements and try again. But DO NOT continue in pointless back and forth conversations, i.e. don't end your responses with questions or offers for further assistance. diff --git a/src/core/prompts/__tests__/__snapshots__/add-custom-instructions/mcp-server-creation-disabled.snap b/src/core/prompts/__tests__/__snapshots__/add-custom-instructions/mcp-server-creation-disabled.snap index 60872c9ee93..1bb5bc1dfee 100644 --- a/src/core/prompts/__tests__/__snapshots__/add-custom-instructions/mcp-server-creation-disabled.snap +++ b/src/core/prompts/__tests__/__snapshots__/add-custom-instructions/mcp-server-creation-disabled.snap @@ -333,7 +333,7 @@ Example: ## attempt_completion Description: After each tool use, the user will respond with the result of that tool use, i.e. if it succeeded or failed, along with any reasons for failure. Once you've received the results of tool uses and can confirm that the task is complete, use this tool to present the result of your work to the user. The user may respond with feedback if they are not satisfied with the result, which you can use to make improvements and try again. -IMPORTANT NOTE: This tool CANNOT be used until you've confirmed from the user that any previous tool uses were successful. Failure to do so will result in code corruption and system failure. Before using this tool, you must ask yourself in tags if you've confirmed from the user that any previous tool uses were successful. If not, then DO NOT use this tool. +IMPORTANT NOTE: This tool CANNOT be used until you've confirmed from the user that any previous tool uses were successful. Failure to do so will result in code corruption and system failure. Before using this tool, you must confirm that you've received successful results from the user for any previous tool uses. If not, then DO NOT use this tool. Parameters: - result: (required) The result of the task. Formulate this result in a way that is final and does not require further input from the user. Don't end your result with questions or offers for further assistance. Usage: @@ -459,7 +459,7 @@ Replace the entire TODO list with an updated checklist reflecting the current st # Tool Use Guidelines -1. In tags, assess what information you already have and what information you need to proceed with the task. +1. Assess what information you already have and what information you need to proceed with the task. 2. Choose the most appropriate tool based on the task and the tool descriptions provided. Assess if you need additional information to proceed, and which of the available tools would be most effective for gathering this information. For example using the list_files tool is more effective than running a command like `ls` in the terminal. It's critical that you think about each available tool and use the one that best fits the current step in the task. 3. If multiple actions are needed, use one tool at a time per message to accomplish the task iteratively, with each tool use being informed by the result of the previous tool use. Do not assume the outcome of any tool use. Each step must be informed by the previous step's result. 4. Formulate your tool use using the XML format specified for each tool. @@ -549,7 +549,7 @@ You accomplish a given task iteratively, breaking it down into clear steps and w 1. Analyze the user's task and set clear, achievable goals to accomplish it. Prioritize these goals in a logical order. 2. Work through these goals sequentially, utilizing available tools one at a time as necessary. Each goal should correspond to a distinct step in your problem-solving process. You will be informed on the work completed and what's remaining as you go. -3. Remember, you have extensive capabilities with access to a wide range of tools that can be used in powerful and clever ways as necessary to accomplish each goal. Before calling a tool, do some analysis within tags. First, analyze the file structure provided in environment_details to gain context and insights for proceeding effectively. Next, think about which of the provided tools is the most relevant tool to accomplish the user's task. Go through each of the required parameters of the relevant tool and determine if the user has directly provided or given enough information to infer a value. When deciding if the parameter can be inferred, carefully consider all the context to see if it supports a specific value. If all of the required parameters are present or can be reasonably inferred, close the thinking tag and proceed with the tool use. BUT, if one of the values for a required parameter is missing, DO NOT invoke the tool (not even with fillers for the missing params) and instead, ask the user to provide the missing parameters using the ask_followup_question tool. DO NOT ask for more information on optional parameters if it is not provided. +3. Remember, you have extensive capabilities with access to a wide range of tools that can be used in powerful and clever ways as necessary to accomplish each goal. Before calling a tool, do some analysis. First, analyze the file structure provided in environment_details to gain context and insights for proceeding effectively. Next, think about which of the provided tools is the most relevant tool to accomplish the user's task. Go through each of the required parameters of the relevant tool and determine if the user has directly provided or given enough information to infer a value. When deciding if the parameter can be inferred, carefully consider all the context to see if it supports a specific value. If all of the required parameters are present or can be reasonably inferred, proceed with the tool use. BUT, if one of the values for a required parameter is missing, DO NOT invoke the tool (not even with fillers for the missing params) and instead, ask the user to provide the missing parameters using the ask_followup_question tool. DO NOT ask for more information on optional parameters if it is not provided. 4. Once you've completed the user's task, you must use the attempt_completion tool to present the result of the task to the user. 5. The user may provide feedback, which you can use to make improvements and try again. But DO NOT continue in pointless back and forth conversations, i.e. don't end your responses with questions or offers for further assistance. diff --git a/src/core/prompts/__tests__/__snapshots__/add-custom-instructions/mcp-server-creation-enabled.snap b/src/core/prompts/__tests__/__snapshots__/add-custom-instructions/mcp-server-creation-enabled.snap index d1fc8304fbf..34544de2120 100644 --- a/src/core/prompts/__tests__/__snapshots__/add-custom-instructions/mcp-server-creation-enabled.snap +++ b/src/core/prompts/__tests__/__snapshots__/add-custom-instructions/mcp-server-creation-enabled.snap @@ -383,7 +383,7 @@ Example: ## attempt_completion Description: After each tool use, the user will respond with the result of that tool use, i.e. if it succeeded or failed, along with any reasons for failure. Once you've received the results of tool uses and can confirm that the task is complete, use this tool to present the result of your work to the user. The user may respond with feedback if they are not satisfied with the result, which you can use to make improvements and try again. -IMPORTANT NOTE: This tool CANNOT be used until you've confirmed from the user that any previous tool uses were successful. Failure to do so will result in code corruption and system failure. Before using this tool, you must ask yourself in tags if you've confirmed from the user that any previous tool uses were successful. If not, then DO NOT use this tool. +IMPORTANT NOTE: This tool CANNOT be used until you've confirmed from the user that any previous tool uses were successful. Failure to do so will result in code corruption and system failure. Before using this tool, you must confirm that you've received successful results from the user for any previous tool uses. If not, then DO NOT use this tool. Parameters: - result: (required) The result of the task. Formulate this result in a way that is final and does not require further input from the user. Don't end your result with questions or offers for further assistance. Usage: @@ -509,7 +509,7 @@ Replace the entire TODO list with an updated checklist reflecting the current st # Tool Use Guidelines -1. In tags, assess what information you already have and what information you need to proceed with the task. +1. Assess what information you already have and what information you need to proceed with the task. 2. Choose the most appropriate tool based on the task and the tool descriptions provided. Assess if you need additional information to proceed, and which of the available tools would be most effective for gathering this information. For example using the list_files tool is more effective than running a command like `ls` in the terminal. It's critical that you think about each available tool and use the one that best fits the current step in the task. 3. If multiple actions are needed, use one tool at a time per message to accomplish the task iteratively, with each tool use being informed by the result of the previous tool use. Do not assume the outcome of any tool use. Each step must be informed by the previous step's result. 4. Formulate your tool use using the XML format specified for each tool. @@ -618,7 +618,7 @@ You accomplish a given task iteratively, breaking it down into clear steps and w 1. Analyze the user's task and set clear, achievable goals to accomplish it. Prioritize these goals in a logical order. 2. Work through these goals sequentially, utilizing available tools one at a time as necessary. Each goal should correspond to a distinct step in your problem-solving process. You will be informed on the work completed and what's remaining as you go. -3. Remember, you have extensive capabilities with access to a wide range of tools that can be used in powerful and clever ways as necessary to accomplish each goal. Before calling a tool, do some analysis within tags. First, analyze the file structure provided in environment_details to gain context and insights for proceeding effectively. Next, think about which of the provided tools is the most relevant tool to accomplish the user's task. Go through each of the required parameters of the relevant tool and determine if the user has directly provided or given enough information to infer a value. When deciding if the parameter can be inferred, carefully consider all the context to see if it supports a specific value. If all of the required parameters are present or can be reasonably inferred, close the thinking tag and proceed with the tool use. BUT, if one of the values for a required parameter is missing, DO NOT invoke the tool (not even with fillers for the missing params) and instead, ask the user to provide the missing parameters using the ask_followup_question tool. DO NOT ask for more information on optional parameters if it is not provided. +3. Remember, you have extensive capabilities with access to a wide range of tools that can be used in powerful and clever ways as necessary to accomplish each goal. Before calling a tool, do some analysis. First, analyze the file structure provided in environment_details to gain context and insights for proceeding effectively. Next, think about which of the provided tools is the most relevant tool to accomplish the user's task. Go through each of the required parameters of the relevant tool and determine if the user has directly provided or given enough information to infer a value. When deciding if the parameter can be inferred, carefully consider all the context to see if it supports a specific value. If all of the required parameters are present or can be reasonably inferred, proceed with the tool use. BUT, if one of the values for a required parameter is missing, DO NOT invoke the tool (not even with fillers for the missing params) and instead, ask the user to provide the missing parameters using the ask_followup_question tool. DO NOT ask for more information on optional parameters if it is not provided. 4. Once you've completed the user's task, you must use the attempt_completion tool to present the result of the task to the user. 5. The user may provide feedback, which you can use to make improvements and try again. But DO NOT continue in pointless back and forth conversations, i.e. don't end your responses with questions or offers for further assistance. diff --git a/src/core/prompts/__tests__/__snapshots__/add-custom-instructions/partial-reads-enabled.snap b/src/core/prompts/__tests__/__snapshots__/add-custom-instructions/partial-reads-enabled.snap index 5d862661dd1..c2fac64a8c4 100644 --- a/src/core/prompts/__tests__/__snapshots__/add-custom-instructions/partial-reads-enabled.snap +++ b/src/core/prompts/__tests__/__snapshots__/add-custom-instructions/partial-reads-enabled.snap @@ -339,7 +339,7 @@ Example: ## attempt_completion Description: After each tool use, the user will respond with the result of that tool use, i.e. if it succeeded or failed, along with any reasons for failure. Once you've received the results of tool uses and can confirm that the task is complete, use this tool to present the result of your work to the user. The user may respond with feedback if they are not satisfied with the result, which you can use to make improvements and try again. -IMPORTANT NOTE: This tool CANNOT be used until you've confirmed from the user that any previous tool uses were successful. Failure to do so will result in code corruption and system failure. Before using this tool, you must ask yourself in tags if you've confirmed from the user that any previous tool uses were successful. If not, then DO NOT use this tool. +IMPORTANT NOTE: This tool CANNOT be used until you've confirmed from the user that any previous tool uses were successful. Failure to do so will result in code corruption and system failure. Before using this tool, you must confirm that you've received successful results from the user for any previous tool uses. If not, then DO NOT use this tool. Parameters: - result: (required) The result of the task. Formulate this result in a way that is final and does not require further input from the user. Don't end your result with questions or offers for further assistance. Usage: @@ -465,7 +465,7 @@ Replace the entire TODO list with an updated checklist reflecting the current st # Tool Use Guidelines -1. In tags, assess what information you already have and what information you need to proceed with the task. +1. Assess what information you already have and what information you need to proceed with the task. 2. Choose the most appropriate tool based on the task and the tool descriptions provided. Assess if you need additional information to proceed, and which of the available tools would be most effective for gathering this information. For example using the list_files tool is more effective than running a command like `ls` in the terminal. It's critical that you think about each available tool and use the one that best fits the current step in the task. 3. If multiple actions are needed, use one tool at a time per message to accomplish the task iteratively, with each tool use being informed by the result of the previous tool use. Do not assume the outcome of any tool use. Each step must be informed by the previous step's result. 4. Formulate your tool use using the XML format specified for each tool. @@ -555,7 +555,7 @@ You accomplish a given task iteratively, breaking it down into clear steps and w 1. Analyze the user's task and set clear, achievable goals to accomplish it. Prioritize these goals in a logical order. 2. Work through these goals sequentially, utilizing available tools one at a time as necessary. Each goal should correspond to a distinct step in your problem-solving process. You will be informed on the work completed and what's remaining as you go. -3. Remember, you have extensive capabilities with access to a wide range of tools that can be used in powerful and clever ways as necessary to accomplish each goal. Before calling a tool, do some analysis within tags. First, analyze the file structure provided in environment_details to gain context and insights for proceeding effectively. Next, think about which of the provided tools is the most relevant tool to accomplish the user's task. Go through each of the required parameters of the relevant tool and determine if the user has directly provided or given enough information to infer a value. When deciding if the parameter can be inferred, carefully consider all the context to see if it supports a specific value. If all of the required parameters are present or can be reasonably inferred, close the thinking tag and proceed with the tool use. BUT, if one of the values for a required parameter is missing, DO NOT invoke the tool (not even with fillers for the missing params) and instead, ask the user to provide the missing parameters using the ask_followup_question tool. DO NOT ask for more information on optional parameters if it is not provided. +3. Remember, you have extensive capabilities with access to a wide range of tools that can be used in powerful and clever ways as necessary to accomplish each goal. Before calling a tool, do some analysis. First, analyze the file structure provided in environment_details to gain context and insights for proceeding effectively. Next, think about which of the provided tools is the most relevant tool to accomplish the user's task. Go through each of the required parameters of the relevant tool and determine if the user has directly provided or given enough information to infer a value. When deciding if the parameter can be inferred, carefully consider all the context to see if it supports a specific value. If all of the required parameters are present or can be reasonably inferred, proceed with the tool use. BUT, if one of the values for a required parameter is missing, DO NOT invoke the tool (not even with fillers for the missing params) and instead, ask the user to provide the missing parameters using the ask_followup_question tool. DO NOT ask for more information on optional parameters if it is not provided. 4. Once you've completed the user's task, you must use the attempt_completion tool to present the result of the task to the user. 5. The user may provide feedback, which you can use to make improvements and try again. But DO NOT continue in pointless back and forth conversations, i.e. don't end your responses with questions or offers for further assistance. diff --git a/src/core/prompts/__tests__/__snapshots__/system-prompt/consistent-system-prompt.snap b/src/core/prompts/__tests__/__snapshots__/system-prompt/consistent-system-prompt.snap index 628401a13d3..5d74fe3ea0d 100644 --- a/src/core/prompts/__tests__/__snapshots__/system-prompt/consistent-system-prompt.snap +++ b/src/core/prompts/__tests__/__snapshots__/system-prompt/consistent-system-prompt.snap @@ -334,7 +334,7 @@ Example: ## attempt_completion Description: After each tool use, the user will respond with the result of that tool use, i.e. if it succeeded or failed, along with any reasons for failure. Once you've received the results of tool uses and can confirm that the task is complete, use this tool to present the result of your work to the user. The user may respond with feedback if they are not satisfied with the result, which you can use to make improvements and try again. -IMPORTANT NOTE: This tool CANNOT be used until you've confirmed from the user that any previous tool uses were successful. Failure to do so will result in code corruption and system failure. Before using this tool, you must ask yourself in tags if you've confirmed from the user that any previous tool uses were successful. If not, then DO NOT use this tool. +IMPORTANT NOTE: This tool CANNOT be used until you've confirmed from the user that any previous tool uses were successful. Failure to do so will result in code corruption and system failure. Before using this tool, you must confirm that you've received successful results from the user for any previous tool uses. If not, then DO NOT use this tool. Parameters: - result: (required) The result of the task. Formulate this result in a way that is final and does not require further input from the user. Don't end your result with questions or offers for further assistance. Usage: @@ -460,7 +460,7 @@ Replace the entire TODO list with an updated checklist reflecting the current st # Tool Use Guidelines -1. In tags, assess what information you already have and what information you need to proceed with the task. +1. Assess what information you already have and what information you need to proceed with the task. 2. Choose the most appropriate tool based on the task and the tool descriptions provided. Assess if you need additional information to proceed, and which of the available tools would be most effective for gathering this information. For example using the list_files tool is more effective than running a command like `ls` in the terminal. It's critical that you think about each available tool and use the one that best fits the current step in the task. 3. If multiple actions are needed, use one tool at a time per message to accomplish the task iteratively, with each tool use being informed by the result of the previous tool use. Do not assume the outcome of any tool use. Each step must be informed by the previous step's result. 4. Formulate your tool use using the XML format specified for each tool. @@ -550,7 +550,7 @@ You accomplish a given task iteratively, breaking it down into clear steps and w 1. Analyze the user's task and set clear, achievable goals to accomplish it. Prioritize these goals in a logical order. 2. Work through these goals sequentially, utilizing available tools one at a time as necessary. Each goal should correspond to a distinct step in your problem-solving process. You will be informed on the work completed and what's remaining as you go. -3. Remember, you have extensive capabilities with access to a wide range of tools that can be used in powerful and clever ways as necessary to accomplish each goal. Before calling a tool, do some analysis within tags. First, analyze the file structure provided in environment_details to gain context and insights for proceeding effectively. Next, think about which of the provided tools is the most relevant tool to accomplish the user's task. Go through each of the required parameters of the relevant tool and determine if the user has directly provided or given enough information to infer a value. When deciding if the parameter can be inferred, carefully consider all the context to see if it supports a specific value. If all of the required parameters are present or can be reasonably inferred, close the thinking tag and proceed with the tool use. BUT, if one of the values for a required parameter is missing, DO NOT invoke the tool (not even with fillers for the missing params) and instead, ask the user to provide the missing parameters using the ask_followup_question tool. DO NOT ask for more information on optional parameters if it is not provided. +3. Remember, you have extensive capabilities with access to a wide range of tools that can be used in powerful and clever ways as necessary to accomplish each goal. Before calling a tool, do some analysis. First, analyze the file structure provided in environment_details to gain context and insights for proceeding effectively. Next, think about which of the provided tools is the most relevant tool to accomplish the user's task. Go through each of the required parameters of the relevant tool and determine if the user has directly provided or given enough information to infer a value. When deciding if the parameter can be inferred, carefully consider all the context to see if it supports a specific value. If all of the required parameters are present or can be reasonably inferred, proceed with the tool use. BUT, if one of the values for a required parameter is missing, DO NOT invoke the tool (not even with fillers for the missing params) and instead, ask the user to provide the missing parameters using the ask_followup_question tool. DO NOT ask for more information on optional parameters if it is not provided. 4. Once you've completed the user's task, you must use the attempt_completion tool to present the result of the task to the user. 5. The user may provide feedback, which you can use to make improvements and try again. But DO NOT continue in pointless back and forth conversations, i.e. don't end your responses with questions or offers for further assistance. diff --git a/src/core/prompts/__tests__/__snapshots__/system-prompt/with-computer-use-support.snap b/src/core/prompts/__tests__/__snapshots__/system-prompt/with-computer-use-support.snap index 8062b8053c6..0c00e9d7591 100644 --- a/src/core/prompts/__tests__/__snapshots__/system-prompt/with-computer-use-support.snap +++ b/src/core/prompts/__tests__/__snapshots__/system-prompt/with-computer-use-support.snap @@ -387,7 +387,7 @@ Example: ## attempt_completion Description: After each tool use, the user will respond with the result of that tool use, i.e. if it succeeded or failed, along with any reasons for failure. Once you've received the results of tool uses and can confirm that the task is complete, use this tool to present the result of your work to the user. The user may respond with feedback if they are not satisfied with the result, which you can use to make improvements and try again. -IMPORTANT NOTE: This tool CANNOT be used until you've confirmed from the user that any previous tool uses were successful. Failure to do so will result in code corruption and system failure. Before using this tool, you must ask yourself in tags if you've confirmed from the user that any previous tool uses were successful. If not, then DO NOT use this tool. +IMPORTANT NOTE: This tool CANNOT be used until you've confirmed from the user that any previous tool uses were successful. Failure to do so will result in code corruption and system failure. Before using this tool, you must confirm that you've received successful results from the user for any previous tool uses. If not, then DO NOT use this tool. Parameters: - result: (required) The result of the task. Formulate this result in a way that is final and does not require further input from the user. Don't end your result with questions or offers for further assistance. Usage: @@ -513,7 +513,7 @@ Replace the entire TODO list with an updated checklist reflecting the current st # Tool Use Guidelines -1. In tags, assess what information you already have and what information you need to proceed with the task. +1. Assess what information you already have and what information you need to proceed with the task. 2. Choose the most appropriate tool based on the task and the tool descriptions provided. Assess if you need additional information to proceed, and which of the available tools would be most effective for gathering this information. For example using the list_files tool is more effective than running a command like `ls` in the terminal. It's critical that you think about each available tool and use the one that best fits the current step in the task. 3. If multiple actions are needed, use one tool at a time per message to accomplish the task iteratively, with each tool use being informed by the result of the previous tool use. Do not assume the outcome of any tool use. Each step must be informed by the previous step's result. 4. Formulate your tool use using the XML format specified for each tool. @@ -606,7 +606,7 @@ You accomplish a given task iteratively, breaking it down into clear steps and w 1. Analyze the user's task and set clear, achievable goals to accomplish it. Prioritize these goals in a logical order. 2. Work through these goals sequentially, utilizing available tools one at a time as necessary. Each goal should correspond to a distinct step in your problem-solving process. You will be informed on the work completed and what's remaining as you go. -3. Remember, you have extensive capabilities with access to a wide range of tools that can be used in powerful and clever ways as necessary to accomplish each goal. Before calling a tool, do some analysis within tags. First, analyze the file structure provided in environment_details to gain context and insights for proceeding effectively. Next, think about which of the provided tools is the most relevant tool to accomplish the user's task. Go through each of the required parameters of the relevant tool and determine if the user has directly provided or given enough information to infer a value. When deciding if the parameter can be inferred, carefully consider all the context to see if it supports a specific value. If all of the required parameters are present or can be reasonably inferred, close the thinking tag and proceed with the tool use. BUT, if one of the values for a required parameter is missing, DO NOT invoke the tool (not even with fillers for the missing params) and instead, ask the user to provide the missing parameters using the ask_followup_question tool. DO NOT ask for more information on optional parameters if it is not provided. +3. Remember, you have extensive capabilities with access to a wide range of tools that can be used in powerful and clever ways as necessary to accomplish each goal. Before calling a tool, do some analysis. First, analyze the file structure provided in environment_details to gain context and insights for proceeding effectively. Next, think about which of the provided tools is the most relevant tool to accomplish the user's task. Go through each of the required parameters of the relevant tool and determine if the user has directly provided or given enough information to infer a value. When deciding if the parameter can be inferred, carefully consider all the context to see if it supports a specific value. If all of the required parameters are present or can be reasonably inferred, proceed with the tool use. BUT, if one of the values for a required parameter is missing, DO NOT invoke the tool (not even with fillers for the missing params) and instead, ask the user to provide the missing parameters using the ask_followup_question tool. DO NOT ask for more information on optional parameters if it is not provided. 4. Once you've completed the user's task, you must use the attempt_completion tool to present the result of the task to the user. 5. The user may provide feedback, which you can use to make improvements and try again. But DO NOT continue in pointless back and forth conversations, i.e. don't end your responses with questions or offers for further assistance. diff --git a/src/core/prompts/__tests__/__snapshots__/system-prompt/with-diff-enabled-false.snap b/src/core/prompts/__tests__/__snapshots__/system-prompt/with-diff-enabled-false.snap index 628401a13d3..5d74fe3ea0d 100644 --- a/src/core/prompts/__tests__/__snapshots__/system-prompt/with-diff-enabled-false.snap +++ b/src/core/prompts/__tests__/__snapshots__/system-prompt/with-diff-enabled-false.snap @@ -334,7 +334,7 @@ Example: ## attempt_completion Description: After each tool use, the user will respond with the result of that tool use, i.e. if it succeeded or failed, along with any reasons for failure. Once you've received the results of tool uses and can confirm that the task is complete, use this tool to present the result of your work to the user. The user may respond with feedback if they are not satisfied with the result, which you can use to make improvements and try again. -IMPORTANT NOTE: This tool CANNOT be used until you've confirmed from the user that any previous tool uses were successful. Failure to do so will result in code corruption and system failure. Before using this tool, you must ask yourself in tags if you've confirmed from the user that any previous tool uses were successful. If not, then DO NOT use this tool. +IMPORTANT NOTE: This tool CANNOT be used until you've confirmed from the user that any previous tool uses were successful. Failure to do so will result in code corruption and system failure. Before using this tool, you must confirm that you've received successful results from the user for any previous tool uses. If not, then DO NOT use this tool. Parameters: - result: (required) The result of the task. Formulate this result in a way that is final and does not require further input from the user. Don't end your result with questions or offers for further assistance. Usage: @@ -460,7 +460,7 @@ Replace the entire TODO list with an updated checklist reflecting the current st # Tool Use Guidelines -1. In tags, assess what information you already have and what information you need to proceed with the task. +1. Assess what information you already have and what information you need to proceed with the task. 2. Choose the most appropriate tool based on the task and the tool descriptions provided. Assess if you need additional information to proceed, and which of the available tools would be most effective for gathering this information. For example using the list_files tool is more effective than running a command like `ls` in the terminal. It's critical that you think about each available tool and use the one that best fits the current step in the task. 3. If multiple actions are needed, use one tool at a time per message to accomplish the task iteratively, with each tool use being informed by the result of the previous tool use. Do not assume the outcome of any tool use. Each step must be informed by the previous step's result. 4. Formulate your tool use using the XML format specified for each tool. @@ -550,7 +550,7 @@ You accomplish a given task iteratively, breaking it down into clear steps and w 1. Analyze the user's task and set clear, achievable goals to accomplish it. Prioritize these goals in a logical order. 2. Work through these goals sequentially, utilizing available tools one at a time as necessary. Each goal should correspond to a distinct step in your problem-solving process. You will be informed on the work completed and what's remaining as you go. -3. Remember, you have extensive capabilities with access to a wide range of tools that can be used in powerful and clever ways as necessary to accomplish each goal. Before calling a tool, do some analysis within tags. First, analyze the file structure provided in environment_details to gain context and insights for proceeding effectively. Next, think about which of the provided tools is the most relevant tool to accomplish the user's task. Go through each of the required parameters of the relevant tool and determine if the user has directly provided or given enough information to infer a value. When deciding if the parameter can be inferred, carefully consider all the context to see if it supports a specific value. If all of the required parameters are present or can be reasonably inferred, close the thinking tag and proceed with the tool use. BUT, if one of the values for a required parameter is missing, DO NOT invoke the tool (not even with fillers for the missing params) and instead, ask the user to provide the missing parameters using the ask_followup_question tool. DO NOT ask for more information on optional parameters if it is not provided. +3. Remember, you have extensive capabilities with access to a wide range of tools that can be used in powerful and clever ways as necessary to accomplish each goal. Before calling a tool, do some analysis. First, analyze the file structure provided in environment_details to gain context and insights for proceeding effectively. Next, think about which of the provided tools is the most relevant tool to accomplish the user's task. Go through each of the required parameters of the relevant tool and determine if the user has directly provided or given enough information to infer a value. When deciding if the parameter can be inferred, carefully consider all the context to see if it supports a specific value. If all of the required parameters are present or can be reasonably inferred, proceed with the tool use. BUT, if one of the values for a required parameter is missing, DO NOT invoke the tool (not even with fillers for the missing params) and instead, ask the user to provide the missing parameters using the ask_followup_question tool. DO NOT ask for more information on optional parameters if it is not provided. 4. Once you've completed the user's task, you must use the attempt_completion tool to present the result of the task to the user. 5. The user may provide feedback, which you can use to make improvements and try again. But DO NOT continue in pointless back and forth conversations, i.e. don't end your responses with questions or offers for further assistance. diff --git a/src/core/prompts/__tests__/__snapshots__/system-prompt/with-diff-enabled-true.snap b/src/core/prompts/__tests__/__snapshots__/system-prompt/with-diff-enabled-true.snap index b2428df7a10..590d96b2fdf 100644 --- a/src/core/prompts/__tests__/__snapshots__/system-prompt/with-diff-enabled-true.snap +++ b/src/core/prompts/__tests__/__snapshots__/system-prompt/with-diff-enabled-true.snap @@ -422,7 +422,7 @@ Example: ## attempt_completion Description: After each tool use, the user will respond with the result of that tool use, i.e. if it succeeded or failed, along with any reasons for failure. Once you've received the results of tool uses and can confirm that the task is complete, use this tool to present the result of your work to the user. The user may respond with feedback if they are not satisfied with the result, which you can use to make improvements and try again. -IMPORTANT NOTE: This tool CANNOT be used until you've confirmed from the user that any previous tool uses were successful. Failure to do so will result in code corruption and system failure. Before using this tool, you must ask yourself in tags if you've confirmed from the user that any previous tool uses were successful. If not, then DO NOT use this tool. +IMPORTANT NOTE: This tool CANNOT be used until you've confirmed from the user that any previous tool uses were successful. Failure to do so will result in code corruption and system failure. Before using this tool, you must confirm that you've received successful results from the user for any previous tool uses. If not, then DO NOT use this tool. Parameters: - result: (required) The result of the task. Formulate this result in a way that is final and does not require further input from the user. Don't end your result with questions or offers for further assistance. Usage: @@ -548,7 +548,7 @@ Replace the entire TODO list with an updated checklist reflecting the current st # Tool Use Guidelines -1. In tags, assess what information you already have and what information you need to proceed with the task. +1. Assess what information you already have and what information you need to proceed with the task. 2. Choose the most appropriate tool based on the task and the tool descriptions provided. Assess if you need additional information to proceed, and which of the available tools would be most effective for gathering this information. For example using the list_files tool is more effective than running a command like `ls` in the terminal. It's critical that you think about each available tool and use the one that best fits the current step in the task. 3. If multiple actions are needed, use one tool at a time per message to accomplish the task iteratively, with each tool use being informed by the result of the previous tool use. Do not assume the outcome of any tool use. Each step must be informed by the previous step's result. 4. Formulate your tool use using the XML format specified for each tool. @@ -638,7 +638,7 @@ You accomplish a given task iteratively, breaking it down into clear steps and w 1. Analyze the user's task and set clear, achievable goals to accomplish it. Prioritize these goals in a logical order. 2. Work through these goals sequentially, utilizing available tools one at a time as necessary. Each goal should correspond to a distinct step in your problem-solving process. You will be informed on the work completed and what's remaining as you go. -3. Remember, you have extensive capabilities with access to a wide range of tools that can be used in powerful and clever ways as necessary to accomplish each goal. Before calling a tool, do some analysis within tags. First, analyze the file structure provided in environment_details to gain context and insights for proceeding effectively. Next, think about which of the provided tools is the most relevant tool to accomplish the user's task. Go through each of the required parameters of the relevant tool and determine if the user has directly provided or given enough information to infer a value. When deciding if the parameter can be inferred, carefully consider all the context to see if it supports a specific value. If all of the required parameters are present or can be reasonably inferred, close the thinking tag and proceed with the tool use. BUT, if one of the values for a required parameter is missing, DO NOT invoke the tool (not even with fillers for the missing params) and instead, ask the user to provide the missing parameters using the ask_followup_question tool. DO NOT ask for more information on optional parameters if it is not provided. +3. Remember, you have extensive capabilities with access to a wide range of tools that can be used in powerful and clever ways as necessary to accomplish each goal. Before calling a tool, do some analysis. First, analyze the file structure provided in environment_details to gain context and insights for proceeding effectively. Next, think about which of the provided tools is the most relevant tool to accomplish the user's task. Go through each of the required parameters of the relevant tool and determine if the user has directly provided or given enough information to infer a value. When deciding if the parameter can be inferred, carefully consider all the context to see if it supports a specific value. If all of the required parameters are present or can be reasonably inferred, proceed with the tool use. BUT, if one of the values for a required parameter is missing, DO NOT invoke the tool (not even with fillers for the missing params) and instead, ask the user to provide the missing parameters using the ask_followup_question tool. DO NOT ask for more information on optional parameters if it is not provided. 4. Once you've completed the user's task, you must use the attempt_completion tool to present the result of the task to the user. 5. The user may provide feedback, which you can use to make improvements and try again. But DO NOT continue in pointless back and forth conversations, i.e. don't end your responses with questions or offers for further assistance. diff --git a/src/core/prompts/__tests__/__snapshots__/system-prompt/with-diff-enabled-undefined.snap b/src/core/prompts/__tests__/__snapshots__/system-prompt/with-diff-enabled-undefined.snap index 628401a13d3..5d74fe3ea0d 100644 --- a/src/core/prompts/__tests__/__snapshots__/system-prompt/with-diff-enabled-undefined.snap +++ b/src/core/prompts/__tests__/__snapshots__/system-prompt/with-diff-enabled-undefined.snap @@ -334,7 +334,7 @@ Example: ## attempt_completion Description: After each tool use, the user will respond with the result of that tool use, i.e. if it succeeded or failed, along with any reasons for failure. Once you've received the results of tool uses and can confirm that the task is complete, use this tool to present the result of your work to the user. The user may respond with feedback if they are not satisfied with the result, which you can use to make improvements and try again. -IMPORTANT NOTE: This tool CANNOT be used until you've confirmed from the user that any previous tool uses were successful. Failure to do so will result in code corruption and system failure. Before using this tool, you must ask yourself in tags if you've confirmed from the user that any previous tool uses were successful. If not, then DO NOT use this tool. +IMPORTANT NOTE: This tool CANNOT be used until you've confirmed from the user that any previous tool uses were successful. Failure to do so will result in code corruption and system failure. Before using this tool, you must confirm that you've received successful results from the user for any previous tool uses. If not, then DO NOT use this tool. Parameters: - result: (required) The result of the task. Formulate this result in a way that is final and does not require further input from the user. Don't end your result with questions or offers for further assistance. Usage: @@ -460,7 +460,7 @@ Replace the entire TODO list with an updated checklist reflecting the current st # Tool Use Guidelines -1. In tags, assess what information you already have and what information you need to proceed with the task. +1. Assess what information you already have and what information you need to proceed with the task. 2. Choose the most appropriate tool based on the task and the tool descriptions provided. Assess if you need additional information to proceed, and which of the available tools would be most effective for gathering this information. For example using the list_files tool is more effective than running a command like `ls` in the terminal. It's critical that you think about each available tool and use the one that best fits the current step in the task. 3. If multiple actions are needed, use one tool at a time per message to accomplish the task iteratively, with each tool use being informed by the result of the previous tool use. Do not assume the outcome of any tool use. Each step must be informed by the previous step's result. 4. Formulate your tool use using the XML format specified for each tool. @@ -550,7 +550,7 @@ You accomplish a given task iteratively, breaking it down into clear steps and w 1. Analyze the user's task and set clear, achievable goals to accomplish it. Prioritize these goals in a logical order. 2. Work through these goals sequentially, utilizing available tools one at a time as necessary. Each goal should correspond to a distinct step in your problem-solving process. You will be informed on the work completed and what's remaining as you go. -3. Remember, you have extensive capabilities with access to a wide range of tools that can be used in powerful and clever ways as necessary to accomplish each goal. Before calling a tool, do some analysis within tags. First, analyze the file structure provided in environment_details to gain context and insights for proceeding effectively. Next, think about which of the provided tools is the most relevant tool to accomplish the user's task. Go through each of the required parameters of the relevant tool and determine if the user has directly provided or given enough information to infer a value. When deciding if the parameter can be inferred, carefully consider all the context to see if it supports a specific value. If all of the required parameters are present or can be reasonably inferred, close the thinking tag and proceed with the tool use. BUT, if one of the values for a required parameter is missing, DO NOT invoke the tool (not even with fillers for the missing params) and instead, ask the user to provide the missing parameters using the ask_followup_question tool. DO NOT ask for more information on optional parameters if it is not provided. +3. Remember, you have extensive capabilities with access to a wide range of tools that can be used in powerful and clever ways as necessary to accomplish each goal. Before calling a tool, do some analysis. First, analyze the file structure provided in environment_details to gain context and insights for proceeding effectively. Next, think about which of the provided tools is the most relevant tool to accomplish the user's task. Go through each of the required parameters of the relevant tool and determine if the user has directly provided or given enough information to infer a value. When deciding if the parameter can be inferred, carefully consider all the context to see if it supports a specific value. If all of the required parameters are present or can be reasonably inferred, proceed with the tool use. BUT, if one of the values for a required parameter is missing, DO NOT invoke the tool (not even with fillers for the missing params) and instead, ask the user to provide the missing parameters using the ask_followup_question tool. DO NOT ask for more information on optional parameters if it is not provided. 4. Once you've completed the user's task, you must use the attempt_completion tool to present the result of the task to the user. 5. The user may provide feedback, which you can use to make improvements and try again. But DO NOT continue in pointless back and forth conversations, i.e. don't end your responses with questions or offers for further assistance. diff --git a/src/core/prompts/__tests__/__snapshots__/system-prompt/with-different-viewport-size.snap b/src/core/prompts/__tests__/__snapshots__/system-prompt/with-different-viewport-size.snap index bad042fdb28..987542d5fa2 100644 --- a/src/core/prompts/__tests__/__snapshots__/system-prompt/with-different-viewport-size.snap +++ b/src/core/prompts/__tests__/__snapshots__/system-prompt/with-different-viewport-size.snap @@ -387,7 +387,7 @@ Example: ## attempt_completion Description: After each tool use, the user will respond with the result of that tool use, i.e. if it succeeded or failed, along with any reasons for failure. Once you've received the results of tool uses and can confirm that the task is complete, use this tool to present the result of your work to the user. The user may respond with feedback if they are not satisfied with the result, which you can use to make improvements and try again. -IMPORTANT NOTE: This tool CANNOT be used until you've confirmed from the user that any previous tool uses were successful. Failure to do so will result in code corruption and system failure. Before using this tool, you must ask yourself in tags if you've confirmed from the user that any previous tool uses were successful. If not, then DO NOT use this tool. +IMPORTANT NOTE: This tool CANNOT be used until you've confirmed from the user that any previous tool uses were successful. Failure to do so will result in code corruption and system failure. Before using this tool, you must confirm that you've received successful results from the user for any previous tool uses. If not, then DO NOT use this tool. Parameters: - result: (required) The result of the task. Formulate this result in a way that is final and does not require further input from the user. Don't end your result with questions or offers for further assistance. Usage: @@ -513,7 +513,7 @@ Replace the entire TODO list with an updated checklist reflecting the current st # Tool Use Guidelines -1. In tags, assess what information you already have and what information you need to proceed with the task. +1. Assess what information you already have and what information you need to proceed with the task. 2. Choose the most appropriate tool based on the task and the tool descriptions provided. Assess if you need additional information to proceed, and which of the available tools would be most effective for gathering this information. For example using the list_files tool is more effective than running a command like `ls` in the terminal. It's critical that you think about each available tool and use the one that best fits the current step in the task. 3. If multiple actions are needed, use one tool at a time per message to accomplish the task iteratively, with each tool use being informed by the result of the previous tool use. Do not assume the outcome of any tool use. Each step must be informed by the previous step's result. 4. Formulate your tool use using the XML format specified for each tool. @@ -606,7 +606,7 @@ You accomplish a given task iteratively, breaking it down into clear steps and w 1. Analyze the user's task and set clear, achievable goals to accomplish it. Prioritize these goals in a logical order. 2. Work through these goals sequentially, utilizing available tools one at a time as necessary. Each goal should correspond to a distinct step in your problem-solving process. You will be informed on the work completed and what's remaining as you go. -3. Remember, you have extensive capabilities with access to a wide range of tools that can be used in powerful and clever ways as necessary to accomplish each goal. Before calling a tool, do some analysis within tags. First, analyze the file structure provided in environment_details to gain context and insights for proceeding effectively. Next, think about which of the provided tools is the most relevant tool to accomplish the user's task. Go through each of the required parameters of the relevant tool and determine if the user has directly provided or given enough information to infer a value. When deciding if the parameter can be inferred, carefully consider all the context to see if it supports a specific value. If all of the required parameters are present or can be reasonably inferred, close the thinking tag and proceed with the tool use. BUT, if one of the values for a required parameter is missing, DO NOT invoke the tool (not even with fillers for the missing params) and instead, ask the user to provide the missing parameters using the ask_followup_question tool. DO NOT ask for more information on optional parameters if it is not provided. +3. Remember, you have extensive capabilities with access to a wide range of tools that can be used in powerful and clever ways as necessary to accomplish each goal. Before calling a tool, do some analysis. First, analyze the file structure provided in environment_details to gain context and insights for proceeding effectively. Next, think about which of the provided tools is the most relevant tool to accomplish the user's task. Go through each of the required parameters of the relevant tool and determine if the user has directly provided or given enough information to infer a value. When deciding if the parameter can be inferred, carefully consider all the context to see if it supports a specific value. If all of the required parameters are present or can be reasonably inferred, proceed with the tool use. BUT, if one of the values for a required parameter is missing, DO NOT invoke the tool (not even with fillers for the missing params) and instead, ask the user to provide the missing parameters using the ask_followup_question tool. DO NOT ask for more information on optional parameters if it is not provided. 4. Once you've completed the user's task, you must use the attempt_completion tool to present the result of the task to the user. 5. The user may provide feedback, which you can use to make improvements and try again. But DO NOT continue in pointless back and forth conversations, i.e. don't end your responses with questions or offers for further assistance. diff --git a/src/core/prompts/__tests__/__snapshots__/system-prompt/with-mcp-hub-provided.snap b/src/core/prompts/__tests__/__snapshots__/system-prompt/with-mcp-hub-provided.snap index d1fc8304fbf..34544de2120 100644 --- a/src/core/prompts/__tests__/__snapshots__/system-prompt/with-mcp-hub-provided.snap +++ b/src/core/prompts/__tests__/__snapshots__/system-prompt/with-mcp-hub-provided.snap @@ -383,7 +383,7 @@ Example: ## attempt_completion Description: After each tool use, the user will respond with the result of that tool use, i.e. if it succeeded or failed, along with any reasons for failure. Once you've received the results of tool uses and can confirm that the task is complete, use this tool to present the result of your work to the user. The user may respond with feedback if they are not satisfied with the result, which you can use to make improvements and try again. -IMPORTANT NOTE: This tool CANNOT be used until you've confirmed from the user that any previous tool uses were successful. Failure to do so will result in code corruption and system failure. Before using this tool, you must ask yourself in tags if you've confirmed from the user that any previous tool uses were successful. If not, then DO NOT use this tool. +IMPORTANT NOTE: This tool CANNOT be used until you've confirmed from the user that any previous tool uses were successful. Failure to do so will result in code corruption and system failure. Before using this tool, you must confirm that you've received successful results from the user for any previous tool uses. If not, then DO NOT use this tool. Parameters: - result: (required) The result of the task. Formulate this result in a way that is final and does not require further input from the user. Don't end your result with questions or offers for further assistance. Usage: @@ -509,7 +509,7 @@ Replace the entire TODO list with an updated checklist reflecting the current st # Tool Use Guidelines -1. In tags, assess what information you already have and what information you need to proceed with the task. +1. Assess what information you already have and what information you need to proceed with the task. 2. Choose the most appropriate tool based on the task and the tool descriptions provided. Assess if you need additional information to proceed, and which of the available tools would be most effective for gathering this information. For example using the list_files tool is more effective than running a command like `ls` in the terminal. It's critical that you think about each available tool and use the one that best fits the current step in the task. 3. If multiple actions are needed, use one tool at a time per message to accomplish the task iteratively, with each tool use being informed by the result of the previous tool use. Do not assume the outcome of any tool use. Each step must be informed by the previous step's result. 4. Formulate your tool use using the XML format specified for each tool. @@ -618,7 +618,7 @@ You accomplish a given task iteratively, breaking it down into clear steps and w 1. Analyze the user's task and set clear, achievable goals to accomplish it. Prioritize these goals in a logical order. 2. Work through these goals sequentially, utilizing available tools one at a time as necessary. Each goal should correspond to a distinct step in your problem-solving process. You will be informed on the work completed and what's remaining as you go. -3. Remember, you have extensive capabilities with access to a wide range of tools that can be used in powerful and clever ways as necessary to accomplish each goal. Before calling a tool, do some analysis within tags. First, analyze the file structure provided in environment_details to gain context and insights for proceeding effectively. Next, think about which of the provided tools is the most relevant tool to accomplish the user's task. Go through each of the required parameters of the relevant tool and determine if the user has directly provided or given enough information to infer a value. When deciding if the parameter can be inferred, carefully consider all the context to see if it supports a specific value. If all of the required parameters are present or can be reasonably inferred, close the thinking tag and proceed with the tool use. BUT, if one of the values for a required parameter is missing, DO NOT invoke the tool (not even with fillers for the missing params) and instead, ask the user to provide the missing parameters using the ask_followup_question tool. DO NOT ask for more information on optional parameters if it is not provided. +3. Remember, you have extensive capabilities with access to a wide range of tools that can be used in powerful and clever ways as necessary to accomplish each goal. Before calling a tool, do some analysis. First, analyze the file structure provided in environment_details to gain context and insights for proceeding effectively. Next, think about which of the provided tools is the most relevant tool to accomplish the user's task. Go through each of the required parameters of the relevant tool and determine if the user has directly provided or given enough information to infer a value. When deciding if the parameter can be inferred, carefully consider all the context to see if it supports a specific value. If all of the required parameters are present or can be reasonably inferred, proceed with the tool use. BUT, if one of the values for a required parameter is missing, DO NOT invoke the tool (not even with fillers for the missing params) and instead, ask the user to provide the missing parameters using the ask_followup_question tool. DO NOT ask for more information on optional parameters if it is not provided. 4. Once you've completed the user's task, you must use the attempt_completion tool to present the result of the task to the user. 5. The user may provide feedback, which you can use to make improvements and try again. But DO NOT continue in pointless back and forth conversations, i.e. don't end your responses with questions or offers for further assistance. diff --git a/src/core/prompts/__tests__/__snapshots__/system-prompt/with-undefined-mcp-hub.snap b/src/core/prompts/__tests__/__snapshots__/system-prompt/with-undefined-mcp-hub.snap index 628401a13d3..5d74fe3ea0d 100644 --- a/src/core/prompts/__tests__/__snapshots__/system-prompt/with-undefined-mcp-hub.snap +++ b/src/core/prompts/__tests__/__snapshots__/system-prompt/with-undefined-mcp-hub.snap @@ -334,7 +334,7 @@ Example: ## attempt_completion Description: After each tool use, the user will respond with the result of that tool use, i.e. if it succeeded or failed, along with any reasons for failure. Once you've received the results of tool uses and can confirm that the task is complete, use this tool to present the result of your work to the user. The user may respond with feedback if they are not satisfied with the result, which you can use to make improvements and try again. -IMPORTANT NOTE: This tool CANNOT be used until you've confirmed from the user that any previous tool uses were successful. Failure to do so will result in code corruption and system failure. Before using this tool, you must ask yourself in tags if you've confirmed from the user that any previous tool uses were successful. If not, then DO NOT use this tool. +IMPORTANT NOTE: This tool CANNOT be used until you've confirmed from the user that any previous tool uses were successful. Failure to do so will result in code corruption and system failure. Before using this tool, you must confirm that you've received successful results from the user for any previous tool uses. If not, then DO NOT use this tool. Parameters: - result: (required) The result of the task. Formulate this result in a way that is final and does not require further input from the user. Don't end your result with questions or offers for further assistance. Usage: @@ -460,7 +460,7 @@ Replace the entire TODO list with an updated checklist reflecting the current st # Tool Use Guidelines -1. In tags, assess what information you already have and what information you need to proceed with the task. +1. Assess what information you already have and what information you need to proceed with the task. 2. Choose the most appropriate tool based on the task and the tool descriptions provided. Assess if you need additional information to proceed, and which of the available tools would be most effective for gathering this information. For example using the list_files tool is more effective than running a command like `ls` in the terminal. It's critical that you think about each available tool and use the one that best fits the current step in the task. 3. If multiple actions are needed, use one tool at a time per message to accomplish the task iteratively, with each tool use being informed by the result of the previous tool use. Do not assume the outcome of any tool use. Each step must be informed by the previous step's result. 4. Formulate your tool use using the XML format specified for each tool. @@ -550,7 +550,7 @@ You accomplish a given task iteratively, breaking it down into clear steps and w 1. Analyze the user's task and set clear, achievable goals to accomplish it. Prioritize these goals in a logical order. 2. Work through these goals sequentially, utilizing available tools one at a time as necessary. Each goal should correspond to a distinct step in your problem-solving process. You will be informed on the work completed and what's remaining as you go. -3. Remember, you have extensive capabilities with access to a wide range of tools that can be used in powerful and clever ways as necessary to accomplish each goal. Before calling a tool, do some analysis within tags. First, analyze the file structure provided in environment_details to gain context and insights for proceeding effectively. Next, think about which of the provided tools is the most relevant tool to accomplish the user's task. Go through each of the required parameters of the relevant tool and determine if the user has directly provided or given enough information to infer a value. When deciding if the parameter can be inferred, carefully consider all the context to see if it supports a specific value. If all of the required parameters are present or can be reasonably inferred, close the thinking tag and proceed with the tool use. BUT, if one of the values for a required parameter is missing, DO NOT invoke the tool (not even with fillers for the missing params) and instead, ask the user to provide the missing parameters using the ask_followup_question tool. DO NOT ask for more information on optional parameters if it is not provided. +3. Remember, you have extensive capabilities with access to a wide range of tools that can be used in powerful and clever ways as necessary to accomplish each goal. Before calling a tool, do some analysis. First, analyze the file structure provided in environment_details to gain context and insights for proceeding effectively. Next, think about which of the provided tools is the most relevant tool to accomplish the user's task. Go through each of the required parameters of the relevant tool and determine if the user has directly provided or given enough information to infer a value. When deciding if the parameter can be inferred, carefully consider all the context to see if it supports a specific value. If all of the required parameters are present or can be reasonably inferred, proceed with the tool use. BUT, if one of the values for a required parameter is missing, DO NOT invoke the tool (not even with fillers for the missing params) and instead, ask the user to provide the missing parameters using the ask_followup_question tool. DO NOT ask for more information on optional parameters if it is not provided. 4. Once you've completed the user's task, you must use the attempt_completion tool to present the result of the task to the user. 5. The user may provide feedback, which you can use to make improvements and try again. But DO NOT continue in pointless back and forth conversations, i.e. don't end your responses with questions or offers for further assistance. diff --git a/src/core/prompts/sections/__tests__/objective.spec.ts b/src/core/prompts/sections/__tests__/objective.spec.ts index e1293929255..d27be08e1c7 100644 --- a/src/core/prompts/sections/__tests__/objective.spec.ts +++ b/src/core/prompts/sections/__tests__/objective.spec.ts @@ -53,13 +53,13 @@ describe("getObjectiveSection", () => { } }) - it("should include thinking tags guidance regardless of codebase_search availability", () => { + it("should include analysis guidance regardless of codebase_search availability", () => { const objectiveEnabled = getObjectiveSection(mockCodeIndexManagerEnabled) const objectiveDisabled = getObjectiveSection(mockCodeIndexManagerDisabled) - // Check that thinking tags guidance is included in both cases + // Check that analysis guidance is included in both cases for (const objective of [objectiveEnabled, objectiveDisabled]) { - expect(objective).toContain(" tags") + expect(objective).toContain("Before calling a tool, do some analysis") expect(objective).toContain("analyze the file structure provided in environment_details") expect(objective).toContain("think about which of the provided tools is the most relevant") } diff --git a/src/core/prompts/sections/__tests__/tool-use-guidelines.spec.ts b/src/core/prompts/sections/__tests__/tool-use-guidelines.spec.ts index 98e4da3a731..fd605e1b39c 100644 --- a/src/core/prompts/sections/__tests__/tool-use-guidelines.spec.ts +++ b/src/core/prompts/sections/__tests__/tool-use-guidelines.spec.ts @@ -34,7 +34,7 @@ describe("getToolUseGuidelinesSection", () => { const guidelines = getToolUseGuidelinesSection(mockCodeIndexManagerEnabled) // Check that all numbered items are present - expect(guidelines).toContain("1. In tags") + expect(guidelines).toContain("1. Assess what information") expect(guidelines).toContain("2. **CRITICAL:") expect(guidelines).toContain("3. Choose the most appropriate tool") expect(guidelines).toContain("4. If multiple actions are needed") @@ -59,7 +59,7 @@ describe("getToolUseGuidelinesSection", () => { const guidelines = getToolUseGuidelinesSection(mockCodeIndexManagerDisabled) // Check that all numbered items are present with correct numbering - expect(guidelines).toContain("1. In tags") + expect(guidelines).toContain("1. Assess what information") expect(guidelines).toContain("2. Choose the most appropriate tool") expect(guidelines).toContain("3. If multiple actions are needed") expect(guidelines).toContain("4. Formulate your tool use") diff --git a/src/core/prompts/sections/objective.ts b/src/core/prompts/sections/objective.ts index 3d18a7e2095..d8bfd0b3f91 100644 --- a/src/core/prompts/sections/objective.ts +++ b/src/core/prompts/sections/objective.ts @@ -22,7 +22,7 @@ You accomplish a given task iteratively, breaking it down into clear steps and w 1. Analyze the user's task and set clear, achievable goals to accomplish it. Prioritize these goals in a logical order. 2. Work through these goals sequentially, utilizing available tools one at a time as necessary. Each goal should correspond to a distinct step in your problem-solving process. You will be informed on the work completed and what's remaining as you go. -3. Remember, you have extensive capabilities with access to a wide range of tools that can be used in powerful and clever ways as necessary to accomplish each goal. Before calling a tool, do some analysis within tags. ${codebaseSearchInstruction}analyze the file structure provided in environment_details to gain context and insights for proceeding effectively. Next, think about which of the provided tools is the most relevant tool to accomplish the user's task. Go through each of the required parameters of the relevant tool and determine if the user has directly provided or given enough information to infer a value. When deciding if the parameter can be inferred, carefully consider all the context to see if it supports a specific value. If all of the required parameters are present or can be reasonably inferred, close the thinking tag and proceed with the tool use. BUT, if one of the values for a required parameter is missing, DO NOT invoke the tool (not even with fillers for the missing params) and instead, ask the user to provide the missing parameters using the ask_followup_question tool. DO NOT ask for more information on optional parameters if it is not provided. +3. Remember, you have extensive capabilities with access to a wide range of tools that can be used in powerful and clever ways as necessary to accomplish each goal. Before calling a tool, do some analysis. ${codebaseSearchInstruction}analyze the file structure provided in environment_details to gain context and insights for proceeding effectively. Next, think about which of the provided tools is the most relevant tool to accomplish the user's task. Go through each of the required parameters of the relevant tool and determine if the user has directly provided or given enough information to infer a value. When deciding if the parameter can be inferred, carefully consider all the context to see if it supports a specific value. If all of the required parameters are present or can be reasonably inferred, proceed with the tool use. BUT, if one of the values for a required parameter is missing, DO NOT invoke the tool (not even with fillers for the missing params) and instead, ask the user to provide the missing parameters using the ask_followup_question tool. DO NOT ask for more information on optional parameters if it is not provided. 4. Once you've completed the user's task, you must use the attempt_completion tool to present the result of the task to the user. 5. The user may provide feedback, which you can use to make improvements and try again. But DO NOT continue in pointless back and forth conversations, i.e. don't end your responses with questions or offers for further assistance.` } diff --git a/src/core/prompts/sections/tool-use-guidelines.ts b/src/core/prompts/sections/tool-use-guidelines.ts index a526bbc7112..f6843cf8423 100644 --- a/src/core/prompts/sections/tool-use-guidelines.ts +++ b/src/core/prompts/sections/tool-use-guidelines.ts @@ -13,7 +13,7 @@ export function getToolUseGuidelinesSection(codeIndexManager?: CodeIndexManager) // First guideline is always the same guidelinesList.push( - `${itemNumber++}. In tags, assess what information you already have and what information you need to proceed with the task.`, + `${itemNumber++}. Assess what information you already have and what information you need to proceed with the task.`, ) // Conditional codebase search guideline diff --git a/src/core/prompts/tools/attempt-completion.ts b/src/core/prompts/tools/attempt-completion.ts index 904f9899e6d..62f0827f98e 100644 --- a/src/core/prompts/tools/attempt-completion.ts +++ b/src/core/prompts/tools/attempt-completion.ts @@ -3,7 +3,7 @@ import { ToolArgs } from "./types" export function getAttemptCompletionDescription(args?: ToolArgs): string { return `## attempt_completion Description: After each tool use, the user will respond with the result of that tool use, i.e. if it succeeded or failed, along with any reasons for failure. Once you've received the results of tool uses and can confirm that the task is complete, use this tool to present the result of your work to the user. The user may respond with feedback if they are not satisfied with the result, which you can use to make improvements and try again. -IMPORTANT NOTE: This tool CANNOT be used until you've confirmed from the user that any previous tool uses were successful. Failure to do so will result in code corruption and system failure. Before using this tool, you must ask yourself in tags if you've confirmed from the user that any previous tool uses were successful. If not, then DO NOT use this tool. +IMPORTANT NOTE: This tool CANNOT be used until you've confirmed from the user that any previous tool uses were successful. Failure to do so will result in code corruption and system failure. Before using this tool, you must confirm that you've received successful results from the user for any previous tool uses. If not, then DO NOT use this tool. Parameters: - result: (required) The result of the task. Formulate this result in a way that is final and does not require further input from the user. Don't end your result with questions or offers for further assistance. Usage: diff --git a/src/core/webview/ClineProvider.ts b/src/core/webview/ClineProvider.ts index 60dc86441b0..aa75fc9d893 100644 --- a/src/core/webview/ClineProvider.ts +++ b/src/core/webview/ClineProvider.ts @@ -153,7 +153,7 @@ export class ClineProvider public isViewLaunched = false public settingsImportedAt?: number - public readonly latestAnnouncementId = "sep-2025-code-supernova" // Code Supernova stealth model announcement + public readonly latestAnnouncementId = "sep-2025-code-supernova-1m" // Code Supernova 1M context window announcement public readonly providerSettingsManager: ProviderSettingsManager public readonly customModesManager: CustomModesManager diff --git a/src/core/webview/__tests__/telemetrySettingsTracking.spec.ts b/src/core/webview/__tests__/telemetrySettingsTracking.spec.ts new file mode 100644 index 00000000000..a99c8862a34 --- /dev/null +++ b/src/core/webview/__tests__/telemetrySettingsTracking.spec.ts @@ -0,0 +1,155 @@ +import { describe, it, expect, vi, beforeEach } from "vitest" +import { TelemetryService } from "@roo-code/telemetry" +import { TelemetryEventName, type TelemetrySetting } from "@roo-code/types" + +describe("Telemetry Settings Tracking", () => { + let mockTelemetryService: { + captureTelemetrySettingsChanged: ReturnType + updateTelemetryState: ReturnType + hasInstance: ReturnType + } + + beforeEach(() => { + // Reset mocks + vi.clearAllMocks() + + // Create mock service + mockTelemetryService = { + captureTelemetrySettingsChanged: vi.fn(), + updateTelemetryState: vi.fn(), + hasInstance: vi.fn().mockReturnValue(true), + } + + // Mock the TelemetryService + vi.spyOn(TelemetryService, "hasInstance").mockReturnValue(true) + vi.spyOn(TelemetryService, "instance", "get").mockReturnValue(mockTelemetryService as any) + }) + + describe("when telemetry is turned OFF", () => { + it("should fire event BEFORE disabling telemetry", () => { + const previousSetting = "enabled" as TelemetrySetting + const newSetting = "disabled" as TelemetrySetting + + // Simulate the logic from webviewMessageHandler + const isOptedIn = newSetting !== "disabled" + const wasPreviouslyOptedIn = previousSetting !== "disabled" + + // If turning telemetry OFF, fire event BEFORE disabling + if (wasPreviouslyOptedIn && !isOptedIn && TelemetryService.hasInstance()) { + TelemetryService.instance.captureTelemetrySettingsChanged(previousSetting, newSetting) + } + + // Update the telemetry state + TelemetryService.instance.updateTelemetryState(isOptedIn) + + // Verify the event was captured before updateTelemetryState + expect(mockTelemetryService.captureTelemetrySettingsChanged).toHaveBeenCalledWith("enabled", "disabled") + expect(mockTelemetryService.captureTelemetrySettingsChanged).toHaveBeenCalledBefore( + mockTelemetryService.updateTelemetryState as any, + ) + expect(mockTelemetryService.updateTelemetryState).toHaveBeenCalledWith(false) + }) + + it("should fire event when going from unset to disabled", () => { + const previousSetting = "unset" as TelemetrySetting + const newSetting = "disabled" as TelemetrySetting + + const isOptedIn = newSetting !== "disabled" + const wasPreviouslyOptedIn = previousSetting !== "disabled" + + if (wasPreviouslyOptedIn && !isOptedIn && TelemetryService.hasInstance()) { + TelemetryService.instance.captureTelemetrySettingsChanged(previousSetting, newSetting) + } + + TelemetryService.instance.updateTelemetryState(isOptedIn) + + expect(mockTelemetryService.captureTelemetrySettingsChanged).toHaveBeenCalledWith("unset", "disabled") + }) + }) + + describe("when telemetry is turned ON", () => { + it("should fire event AFTER enabling telemetry", () => { + const previousSetting = "disabled" as TelemetrySetting + const newSetting = "enabled" as TelemetrySetting + + const isOptedIn = newSetting !== "disabled" + const wasPreviouslyOptedIn = previousSetting !== "disabled" + + // Update the telemetry state first + TelemetryService.instance.updateTelemetryState(isOptedIn) + + // If turning telemetry ON, fire event AFTER enabling + if (!wasPreviouslyOptedIn && isOptedIn && TelemetryService.hasInstance()) { + TelemetryService.instance.captureTelemetrySettingsChanged(previousSetting, newSetting) + } + + // Verify the event was captured after updateTelemetryState + expect(mockTelemetryService.updateTelemetryState).toHaveBeenCalledWith(true) + expect(mockTelemetryService.captureTelemetrySettingsChanged).toHaveBeenCalledWith("disabled", "enabled") + expect(mockTelemetryService.updateTelemetryState).toHaveBeenCalledBefore( + mockTelemetryService.captureTelemetrySettingsChanged as any, + ) + }) + + it("should not fire event when going from enabled to enabled", () => { + const previousSetting = "enabled" as TelemetrySetting + const newSetting = "enabled" as TelemetrySetting + + const isOptedIn = newSetting !== "disabled" + const wasPreviouslyOptedIn = previousSetting !== "disabled" + + // Neither condition should be met + if (wasPreviouslyOptedIn && !isOptedIn && TelemetryService.hasInstance()) { + TelemetryService.instance.captureTelemetrySettingsChanged(previousSetting, newSetting) + } + + TelemetryService.instance.updateTelemetryState(isOptedIn) + + if (!wasPreviouslyOptedIn && isOptedIn && TelemetryService.hasInstance()) { + TelemetryService.instance.captureTelemetrySettingsChanged(previousSetting, newSetting) + } + + // Should not fire any telemetry events + expect(mockTelemetryService.captureTelemetrySettingsChanged).not.toHaveBeenCalled() + expect(mockTelemetryService.updateTelemetryState).toHaveBeenCalledWith(true) + }) + + it("should fire event when going from unset to enabled (telemetry banner close)", () => { + const previousSetting = "unset" as TelemetrySetting + const newSetting = "enabled" as TelemetrySetting + + const isOptedIn = newSetting !== "disabled" + const wasPreviouslyOptedIn = previousSetting !== "disabled" + + // For unset -> enabled, both are opted in, so no event should fire + if (wasPreviouslyOptedIn && !isOptedIn && TelemetryService.hasInstance()) { + TelemetryService.instance.captureTelemetrySettingsChanged(previousSetting, newSetting) + } + + TelemetryService.instance.updateTelemetryState(isOptedIn) + + if (!wasPreviouslyOptedIn && isOptedIn && TelemetryService.hasInstance()) { + TelemetryService.instance.captureTelemetrySettingsChanged(previousSetting, newSetting) + } + + // unset is treated as opted-in, so no event should fire + expect(mockTelemetryService.captureTelemetrySettingsChanged).not.toHaveBeenCalled() + }) + }) + + describe("TelemetryService.captureTelemetrySettingsChanged", () => { + it("should call captureEvent with correct parameters", () => { + // Create a real instance to test the method + const mockCaptureEvent = vi.fn() + const service = new (TelemetryService as any)([]) + service.captureEvent = mockCaptureEvent + + service.captureTelemetrySettingsChanged("enabled", "disabled") + + expect(mockCaptureEvent).toHaveBeenCalledWith(TelemetryEventName.TELEMETRY_SETTINGS_CHANGED, { + previousSetting: "enabled", + newSetting: "disabled", + }) + }) + }) +}) diff --git a/src/core/webview/webviewMessageHandler.ts b/src/core/webview/webviewMessageHandler.ts index 51249599d2c..d4aaf51d6d5 100644 --- a/src/core/webview/webviewMessageHandler.ts +++ b/src/core/webview/webviewMessageHandler.ts @@ -2407,9 +2407,25 @@ export const webviewMessageHandler = async ( case "telemetrySetting": { const telemetrySetting = message.text as TelemetrySetting - await updateGlobalState("telemetrySetting", telemetrySetting) + const previousSetting = getGlobalState("telemetrySetting") || "unset" const isOptedIn = telemetrySetting !== "disabled" - TelemetryService.instance.updateTelemetryState(isOptedIn) + const wasPreviouslyOptedIn = previousSetting !== "disabled" + + // If turning telemetry OFF, fire event BEFORE disabling + if (wasPreviouslyOptedIn && !isOptedIn && TelemetryService.hasInstance()) { + TelemetryService.instance.captureTelemetrySettingsChanged(previousSetting, telemetrySetting) + } + // Update the telemetry state + await updateGlobalState("telemetrySetting", telemetrySetting) + if (TelemetryService.hasInstance()) { + TelemetryService.instance.updateTelemetryState(isOptedIn) + } + + // If turning telemetry ON, fire event AFTER enabling + if (!wasPreviouslyOptedIn && isOptedIn && TelemetryService.hasInstance()) { + TelemetryService.instance.captureTelemetrySettingsChanged(previousSetting, telemetrySetting) + } + await provider.postStateToWebview() break } diff --git a/webview-ui/src/components/chat/ChatRow.tsx b/webview-ui/src/components/chat/ChatRow.tsx index cdfdce04eac..6e0a3925966 100644 --- a/webview-ui/src/components/chat/ChatRow.tsx +++ b/webview-ui/src/components/chat/ChatRow.tsx @@ -313,9 +313,9 @@ export const ChatRowContent = ({ ) ) : cost !== null && cost !== undefined ? ( isExpanded ? ( - + ) : ( - + ) ) : apiRequestFailedMessage ? ( getIconSpan("error", errorColor) @@ -350,7 +350,7 @@ export const ChatRowContent = ({ ] case "followup": return [ - , + , {t("chat:questions.hasQuestion")}, ] default: @@ -412,7 +412,7 @@ export const ChatRowContent = ({ return ( <>
        - + {t("chat:fileOperations.wantsToApplyBatchChanges")} @@ -607,7 +607,7 @@ export const ChatRowContent = ({ return ( <>
        - + {t("chat:fileOperations.wantsToReadMultiple")} @@ -627,7 +627,7 @@ export const ChatRowContent = ({ return ( <>
        - + {message.type === "ask" ? tool.isOutsideWorkspace @@ -658,7 +658,7 @@ export const ChatRowContent = ({
        @@ -688,7 +688,7 @@ export const ChatRowContent = ({ return ( <>
        - + {message.type === "ask" ? tool.isOutsideWorkspace @@ -714,7 +714,7 @@ export const ChatRowContent = ({ return ( <>
        - + {message.type === "ask" ? tool.isOutsideWorkspace @@ -806,7 +806,7 @@ export const ChatRowContent = ({ return ( <>
        - + {message.type === "ask" ? ( <> @@ -1191,7 +1191,7 @@ export const ChatRowContent = ({ return (
        - + {t("chat:text.rooSaid")} {message.ts ? format(new Date(message.ts), "yyyy-MM-dd HH:mm:ss") : ""}
        @@ -1226,7 +1226,7 @@ export const ChatRowContent = ({ className="w-6 h-6 rounded-full object-cover" /> ) : ( - + )} {t("chat:feedback.youSaid", { @@ -1308,7 +1308,7 @@ export const ChatRowContent = ({ e.stopPropagation() vscode.postMessage({ type: "deleteMessage", value: message.ts }) }}> - +
        diff --git a/webview-ui/src/i18n/locales/en/chat.json b/webview-ui/src/i18n/locales/en/chat.json index 27fb7bfa7f1..a47114fd9f7 100644 --- a/webview-ui/src/i18n/locales/en/chat.json +++ b/webview-ui/src/i18n/locales/en/chat.json @@ -297,7 +297,7 @@ "announcement": { "title": "🎉 Roo Code {{version}} Released", "stealthModel": { - "feature": "Limited-time FREE stealth model - Code Supernova: A versatile agentic coding model that supports image inputs, accessible through Roo Code Cloud.", + "feature": "Limited-time FREE stealth model - Code Supernova: Now upgraded with a 1M token context window! A versatile agentic coding model that supports image inputs, accessible through Roo Code Cloud.", "note": "(Note: prompts and completions are logged by the model creator and used to improve the model)", "connectButton": "Connect to Roo Code Cloud", "selectModel": "Select roo/code-supernova from the Roo Code Cloud provider in Settings to get started.", diff --git a/webview-ui/src/i18n/locales/zh-CN/chat.json b/webview-ui/src/i18n/locales/zh-CN/chat.json index 16099dd19f4..a335ed16ff2 100644 --- a/webview-ui/src/i18n/locales/zh-CN/chat.json +++ b/webview-ui/src/i18n/locales/zh-CN/chat.json @@ -290,7 +290,7 @@ "announcement": { "title": "🎉 Roo Code {{version}} 已发布", "stealthModel": { - "feature": "限时免费隐形模型 - Code Supernova:一个支持图像输入的多功能代理编程模型,通过 Roo Code Cloud 提供。", + "feature": "限时免费隐形模型 - Code Supernova:现已升级为 1M Token 上下文窗口!一个支持图像输入的多功能代理编程模型,通过 Roo Code Cloud 提供。", "note": "(注意:提示词和补全内容会被模型创建者记录并用于改进模型)", "connectButton": "连接到 Roo Code Cloud", "selectModel": "在设置中从 Roo Code Cloud 提供商选择 roo/code-supernova 开始使用。", diff --git a/webview-ui/src/i18n/locales/zh-TW/chat.json b/webview-ui/src/i18n/locales/zh-TW/chat.json index f1399574c9d..06226479d02 100644 --- a/webview-ui/src/i18n/locales/zh-TW/chat.json +++ b/webview-ui/src/i18n/locales/zh-TW/chat.json @@ -299,7 +299,7 @@ "announcement": { "title": "🎉 Roo Code {{version}} 已發布", "stealthModel": { - "feature": "限時免費隱形模型 - Code Supernova:一個支援圖像輸入的多功能代理程式編程模型,透過 Roo Code Cloud 提供。", + "feature": "限時免費隱形模型 - Code Supernova:現已升級為 1M Token 上下文視窗!一個支援圖像輸入的多功能代理程式編程模型,透過 Roo Code Cloud 提供。", "note": "(注意:提示和完成會被模型創建者記錄並用於改進模型)", "connectButton": "連接到 Roo Code Cloud", "selectModel": "在設定中從 Roo Code Cloud 提供商選擇 roo/code-supernova 開始使用。",