Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/fix-code-index-and-metadata-stability.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"roo-code-continue": patch
---

Fix: code-index incremental updates now batch embeddings by the configured `codeIndex.embeddingBatchSize`, so a single large file no longer floods the embedder with oversized requests (SCNet gateway rejects batches over 20/25 items with 400 errors). Also serializes task-metadata read-modify-write cycles to eliminate concurrent lock contention on `task_metadata.json` (`Lock file is already being held`).
7 changes: 7 additions & 0 deletions .changeset/fix-nightly-display-name.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"roo-code-continue": patch
---

Fix nightly publish failing on the VS Code Marketplace.

- Rename the nightly build display name from "Roo Code Nightly" to "Roo Code Continue Nightly" (in `apps/vscode-nightly/package.nls.nightly.json`). The Marketplace requires display names to be globally unique across all publishers; "Roo Code Nightly" was already taken by another extension, causing `vsce publish` to fail with "This extension display name is taken".
5 changes: 5 additions & 0 deletions .changeset/fix-unbound-models-api-shape.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"roo-code-continue": patch
---

Fix Unbound model fetching: the `/models` endpoint now returns a dictionary keyed by model id with camelCase fields (e.g. `maxTokens`, `contextWindow`, `inputTokenPrice`), while the fetcher still expected an array with snake_case fields. This caused "response did not contain an array of models" errors and an empty model list. The fetcher now accepts both dictionary and array shapes, reads both camelCase and snake_case fields, and coerces numeric strings.
5 changes: 5 additions & 0 deletions .changeset/fix-vercel-ai-gateway-non-language-models.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"roo-code-continue": patch
---

Fix Vercel AI Gateway model fetching: speech/transcription models (e.g. fish-audio, openai/tts, openai/whisper) omit `context_window`/`max_tokens`, which failed the whole `/models` schema validation and dropped all language models. The schema now treats those fields as optional and the non-language filter handles exclusion.
15 changes: 15 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,21 @@

This file provides guidance to agents when working with code in this repository.

## Repository Background: Roo Code → Roo Code Continue

This repository is a **fork of [Roo Code](https://github.com/RooVetGit/Roo-Code)**, whose original upstream repository has been **archived and is no longer maintained**. In order to keep publishing to the VS Code Marketplace under this fork, the extension was renamed:

- **Extension identity** (`package.json` `name`): `roo-code-continue` (Nightly: `roo-code-continue-nightly`)
- **Display name** (via `package.nls.*.json` → `extension.displayName`): **"Roo Code Continue"** (Nightly: "Roo Code Continue Nightly")

When making changes, keep the following naming rules in mind:

- **User-facing / Marketplace-facing names** (display name, command titles, activity bar titles, README, i18n strings) should reference the new "Roo Code Continue" branding. Do NOT revert these to "Roo Code".
- **Internal identifiers that affect settings/import compatibility MUST keep the original `roo-cline` prefix.** This includes: VS Code `configuration` setting keys (e.g. `roo-cline.allowedCommands`, `roo-cline.customStoragePath`, `roo-cline.apiRequestTimeout`), commands (`roo-cline.plusButtonClicked`, ...), view/webview IDs (`roo-cline.SidebarProvider`), submenus, and keybindings. Renaming these would break existing user settings, keybindings, and the ability to import settings from the original Roo Code — so they must stay exactly as-is.
- The Nightly variant (in `apps/vscode-nightly/`) is generated at build time via `generatePackageJson()` which substitutes `roo-cline → roo-code-continue-nightly` for `contributes` keys only; settings `properties` keep the `roo-cline.` prefix for the same compatibility reason.
- `src/utils/migrateSettings.ts` handles legacy file-name migration (`cline_custom_modes.json`, `cline_mcp_settings.json`) and default-command cleanup; do not change the migrated file names.
- The VS Code Marketplace requires a **globally unique display name**. Before introducing a new display name, verify it is not already taken, otherwise `vsce publish` fails with "This extension display name is taken".

- Settings View Pattern: When working on `SettingsView`, inputs must bind to the local `cachedState`, NOT the live `useExtensionState()`. The `cachedState` acts as a buffer for user edits, isolating them from the `ContextProxy` source-of-truth until the user explicitly clicks "Save". Wiring inputs directly to the live state causes race conditions.

## Version Management & Release Workflow
Expand Down
10 changes: 5 additions & 5 deletions apps/vscode-nightly/package.nls.nightly.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"extension.displayName": "Roo Code Nightly",
"views.contextMenu.label": "Roo Code Nightly",
"views.terminalMenu.label": "Roo Code Nightly",
"views.activitybar.title": "Roo Code Nightly",
"configuration.title": "Roo Code Nightly"
"extension.displayName": "Roo Code Continue Nightly",
"views.contextMenu.label": "Roo Code Continue Nightly",
"views.terminalMenu.label": "Roo Code Continue Nightly",
"views.activitybar.title": "Roo Code Continue Nightly",
"configuration.title": "Roo Code Continue Nightly"
}
160 changes: 160 additions & 0 deletions src/api/providers/fetchers/__tests__/unbound.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
import axios from "axios"

import { getUnboundModels } from "../unbound"

vitest.mock("axios")
const mockedAxios = axios as any

describe("getUnboundModels", () => {
beforeEach(() => {
vitest.clearAllMocks()
})

it("parses a dictionary response (current API shape) with camelCase fields", async () => {
mockedAxios.get.mockResolvedValueOnce({
data: {
"anthropic/claude-haiku-4-5": {
// The live API returns these as numeric strings.
maxTokens: "32000",
contextWindow: "200000",
supportsImages: true,
supportsPromptCaching: true,
inputTokenPrice: "1.000000",
outputTokenPrice: "5.000000",
cacheReadPrice: "0.500000",
cacheWritePrice: "6.250000",
description: "Claude Haiku 4.5",
},
"openai/gpt-4o-mini": {
maxTokens: 16384,
contextWindow: 128000,
supportsImages: false,
supportsPromptCaching: false,
inputTokenPrice: "0.15",
outputTokenPrice: "0.60",
},
},
})

const models = await getUnboundModels("test-key")

expect(mockedAxios.get).toHaveBeenCalledWith(
"https://api.getunbound.ai/models",
expect.objectContaining({ headers: { Authorization: "Bearer test-key" } }),
)

expect(Object.keys(models)).toEqual(["anthropic/claude-haiku-4-5", "openai/gpt-4o-mini"])

const haiku = models["anthropic/claude-haiku-4-5"]
expect(haiku.maxTokens).toBe(32000)
expect(haiku.contextWindow).toBe(200000)
expect(haiku.supportsImages).toBe(true)
expect(haiku.supportsPromptCache).toBe(true)
// parseApiPrice converts $/M tokens to micro-units
expect(haiku.inputPrice).toBe(1_000_000)
expect(haiku.outputPrice).toBe(5_000_000)
expect(haiku.cacheReadsPrice).toBe(500_000)
expect(haiku.cacheWritesPrice).toBe(6_250_000)
expect(haiku.description).toBe("Claude Haiku 4.5")

const mini = models["openai/gpt-4o-mini"]
expect(mini.supportsImages).toBe(false)
expect(mini.supportsPromptCache).toBe(false)
expect(mini.inputPrice).toBe(150_000)
expect(mini.outputPrice).toBe(600_000)
})

it("parses a legacy array response with snake_case fields", async () => {
mockedAxios.get.mockResolvedValueOnce({
data: [
{
id: "anthropic/claude-sonnet-4",
max_output_tokens: 64000,
context_window: 200000,
supports_vision: true,
supports_caching: true,
input_price: "3.00",
output_price: "15.00",
caching_price: "3.75",
cached_price: "0.30",
description: "Claude Sonnet 4",
},
],
})

const models = await getUnboundModels()

expect(Object.keys(models)).toEqual(["anthropic/claude-sonnet-4"])

const model = models["anthropic/claude-sonnet-4"]
expect(model.maxTokens).toBe(64000)
expect(model.contextWindow).toBe(200000)
expect(model.supportsImages).toBe(true)
expect(model.supportsPromptCache).toBe(true)
expect(model.inputPrice).toBe(3_000_000)
expect(model.outputPrice).toBe(15_000_000)
expect(model.cacheWritesPrice).toBe(3_750_000)
expect(model.cacheReadsPrice).toBe(300_000)
})

it("handles a response wrapped in a data property", async () => {
mockedAxios.get.mockResolvedValueOnce({
data: {
data: {
"test/model": {
maxTokens: 8192,
contextWindow: 200000,
},
},
},
})

const models = await getUnboundModels()

expect(models["test/model"]).toBeDefined()
expect(models["test/model"].maxTokens).toBe(8192)
})

it("applies defaults when fields are missing", async () => {
mockedAxios.get.mockResolvedValueOnce({
data: {
"test/model": {
// No fields provided
},
},
})

const models = await getUnboundModels()

expect(models["test/model"].maxTokens).toBe(8192)
expect(models["test/model"].contextWindow).toBe(200_000)
expect(models["test/model"].supportsPromptCache).toBe(false)
expect(models["test/model"].supportsImages).toBe(false)
expect(models["test/model"].inputPrice).toBeUndefined()
expect(models["test/model"].description).toBeUndefined()
})

it("returns empty object and logs an error when response is not an object or array", async () => {
const consoleErrorSpy = vitest.spyOn(console, "error").mockImplementation(() => {})
mockedAxios.get.mockResolvedValueOnce({ data: "not-an-object" })

const models = await getUnboundModels()

expect(models).toEqual({})
expect(consoleErrorSpy).toHaveBeenCalledWith(
expect.stringContaining("response did not contain a models object or array"),
)
consoleErrorSpy.mockRestore()
})

it("handles API errors gracefully", async () => {
const consoleErrorSpy = vitest.spyOn(console, "error").mockImplementation(() => {})
mockedAxios.get.mockRejectedValueOnce(new Error("Network error"))

const models = await getUnboundModels()

expect(models).toEqual({})
expect(consoleErrorSpy).toHaveBeenCalledWith(expect.stringContaining("Error fetching Unbound models"))
consoleErrorSpy.mockRestore()
})
})
46 changes: 46 additions & 0 deletions src/api/providers/fetchers/__tests__/vercel-ai-gateway.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,52 @@ describe("Vercel AI Gateway Fetchers", () => {
consoleErrorSpy.mockRestore()
})

it("does not fail the whole list when speech/transcription models omit context_window/max_tokens", async () => {
const consoleErrorSpy = vitest.spyOn(console, "error").mockImplementation(() => {})
// Mirrors the real /models response: fish-audio/s1 is index 107 in
// the live API and has no context_window/max_tokens fields.
const response = {
data: {
object: "list",
data: [
{
id: "anthropic/claude-sonnet-4",
object: "model",
created: 1640995200,
owned_by: "anthropic",
name: "Claude Sonnet 4",
description: "Claude Sonnet 4",
context_window: 200000,
max_tokens: 64000,
type: "language",
pricing: { input: "3.00", output: "15.00" },
},
{
id: "fish-audio/s1",
object: "model",
created: 1755815280,
owned_by: "fish-audio",
name: "S1",
description: "Fish Audio S1 TTS",
type: "speech",
pricing: { input: "0.000015", speech_input_character_cost: "0.000015" },
},
],
},
}
mockedAxios.get.mockResolvedValueOnce(response)

const models = await getVercelAiGatewayModels()

// No schema error should be logged - the list validates fine.
expect(consoleErrorSpy).not.toHaveBeenCalled()

// The language model is still parsed; the speech model is filtered out.
expect(models["anthropic/claude-sonnet-4"]).toBeDefined()
expect(models["fish-audio/s1"]).toBeUndefined()
consoleErrorSpy.mockRestore()
})

it("continues processing with partially valid schema", async () => {
const consoleErrorSpy = vitest.spyOn(console, "error").mockImplementation(() => {})
const invalidResponse = {
Expand Down
98 changes: 83 additions & 15 deletions src/api/providers/fetchers/unbound.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,81 @@ import type { ModelInfo } from "@roo-code/types"

import { parseApiPrice } from "../../../shared/cost"

// The Unbound /models endpoint has historically returned different shapes:
// 1. An array of model objects (with snake_case fields like `max_output_tokens`)
// 2. A dictionary keyed by model id, with camelCase fields (e.g. `maxTokens`,
// `contextWindow`, `inputTokenPrice`) - this is what the API returns today.
// We normalize both shapes into a Record<modelId, ModelInfo>.
type UnboundRawModel = Record<string, unknown> & { id?: string }

function toEntries(rawModels: unknown): Array<[string, UnboundRawModel]> {
if (Array.isArray(rawModels)) {
const entries: Array<[string, UnboundRawModel]> = []

for (const item of rawModels) {
if (item && typeof item === "object") {
const rawModel = item as UnboundRawModel
const id = rawModel.id
if (typeof id === "string" && id.length > 0) {
entries.push([id, rawModel])
}
}
}

return entries
}

if (rawModels && typeof rawModels === "object") {
return Object.entries(rawModels as Record<string, unknown>).map(([id, value]) => [
id,
(value && typeof value === "object" ? value : {}) as UnboundRawModel,
])
}

return []
}

function pick(rawModel: UnboundRawModel, camelCase: string, snakeCase: string): unknown {
return rawModel[camelCase] ?? rawModel[snakeCase]
}

function toFiniteNumber(value: unknown): number | undefined {
if (typeof value === "number" && Number.isFinite(value)) {
return value
}

if (typeof value === "string" && value.trim().length > 0) {
const parsed = Number(value)
return Number.isFinite(parsed) ? parsed : undefined
}

return undefined
}

function parseUnboundModel(id: string, rawModel: UnboundRawModel): ModelInfo {
const maxTokens = toFiniteNumber(pick(rawModel, "maxTokens", "max_output_tokens"))
const contextWindow = toFiniteNumber(pick(rawModel, "contextWindow", "context_window"))
const supportsPromptCache = pick(rawModel, "supportsPromptCaching", "supports_caching")
const supportsImages = pick(rawModel, "supportsImages", "supports_vision")
const inputTokenPrice = pick(rawModel, "inputTokenPrice", "input_price")
const outputTokenPrice = pick(rawModel, "outputTokenPrice", "output_price")
const cacheReadPrice = pick(rawModel, "cacheReadPrice", "cached_price")
const cacheWritePrice = pick(rawModel, "cacheWritePrice", "caching_price")
const description = pick(rawModel, "description", "description")

return {
maxTokens: maxTokens ?? 8192,
contextWindow: contextWindow ?? 200_000,
supportsPromptCache: supportsPromptCache === true,
supportsImages: supportsImages === true,
inputPrice: parseApiPrice(inputTokenPrice),
outputPrice: parseApiPrice(outputTokenPrice),
cacheReadsPrice: parseApiPrice(cacheReadPrice),
cacheWritesPrice: parseApiPrice(cacheWritePrice),
...(typeof description === "string" && description.length > 0 ? { description } : {}),
}
}

export async function getUnboundModels(apiKey?: string | null): Promise<Record<string, ModelInfo>> {
const models: Record<string, ModelInfo> = {}

Expand All @@ -15,22 +90,15 @@ export async function getUnboundModels(apiKey?: string | null): Promise<Record<s
}

const response = await axios.get("https://api.getunbound.ai/models", { headers })
const rawModels = response.data?.data ?? response.data

for (const rawModel of rawModels) {
const modelInfo: ModelInfo = {
maxTokens: rawModel.max_output_tokens ?? 8192,
contextWindow: rawModel.context_window ?? 200_000,
supportsPromptCache: rawModel.supports_caching ?? false,
supportsImages: rawModel.supports_vision ?? false,
inputPrice: parseApiPrice(rawModel.input_price),
outputPrice: parseApiPrice(rawModel.output_price),
description: rawModel.description,
cacheWritesPrice: parseApiPrice(rawModel.caching_price),
cacheReadsPrice: parseApiPrice(rawModel.cached_price),
}
const rawModels: unknown = response.data?.data ?? response.data

if (rawModels === null || rawModels === undefined || typeof rawModels !== "object") {
console.error("Error fetching Unbound models: response did not contain a models object or array")
return models
}

models[rawModel.id] = modelInfo
for (const [id, rawModel] of toEntries(rawModels)) {
models[id] = parseUnboundModel(id, rawModel)
}
} catch (error) {
console.error(`Error fetching Unbound models: ${JSON.stringify(error, Object.getOwnPropertyNames(error), 2)}`)
Expand Down
Loading
Loading