Skip to content

Commit cbb52d9

Browse files
authored
Merge branch 'main' into fix/rename-roo-to-zoo-user-strings
2 parents 7309b6c + d27153a commit cbb52d9

13 files changed

Lines changed: 422 additions & 157 deletions

File tree

src/core/environment/__tests__/getEnvironmentDetails.spec.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,4 +446,22 @@ describe("getEnvironmentDetails", () => {
446446

447447
expect(getGitStatus).toHaveBeenCalledWith(mockCwd, 5)
448448
})
449+
450+
// Regression test for https://github.com/Zoo-Code-Org/Zoo-Code/issues/1024
451+
// When ripgrep cannot be found (e.g. @vscode/ripgrep >=1.18 platform layout on
452+
// Windows), listFiles throws "Could not find ripgrep binary". getEnvironmentDetails
453+
// must not propagate this — the task should proceed to the API call, not hang at 0%.
454+
it("should degrade gracefully when listFiles rejects with an Error", async () => {
455+
;(listFiles as Mock).mockRejectedValue(new Error("Could not find ripgrep binary"))
456+
457+
const result = await getEnvironmentDetails(mockCline as Task, true)
458+
expect(result).toContain("File listing unavailable: Could not find ripgrep binary")
459+
})
460+
461+
it("should degrade gracefully when listFiles rejects with a non-Error value", async () => {
462+
;(listFiles as Mock).mockRejectedValue("unexpected string rejection")
463+
464+
const result = await getEnvironmentDetails(mockCline as Task, true)
465+
expect(result).toContain("File listing unavailable: unexpected string rejection")
466+
})
449467
})

src/core/environment/getEnvironmentDetails.ts

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -241,18 +241,22 @@ export async function getEnvironmentDetails(cline: Task, includeFileDetails: boo
241241
if (maxFiles === 0) {
242242
details += "(Workspace files context disabled. Use list_files to explore if needed.)"
243243
} else {
244-
const [files, didHitLimit] = await listFiles(cline.cwd, true, maxFiles)
245-
const { showRooIgnoredFiles = false } = state ?? {}
246-
247-
const result = formatResponse.formatFilesList(
248-
cline.cwd,
249-
files,
250-
didHitLimit,
251-
cline.rooIgnoreController,
252-
showRooIgnoredFiles,
253-
)
254-
255-
details += result
244+
try {
245+
const [files, didHitLimit] = await listFiles(cline.cwd, true, maxFiles)
246+
const { showRooIgnoredFiles = false } = state ?? {}
247+
248+
const result = formatResponse.formatFilesList(
249+
cline.cwd,
250+
files,
251+
didHitLimit,
252+
cline.rooIgnoreController,
253+
showRooIgnoredFiles,
254+
)
255+
256+
details += result
257+
} catch (error) {
258+
details += `(File listing unavailable: ${error instanceof Error ? error.message : String(error)})`
259+
}
256260
}
257261
}
258262
}

src/core/task/Task.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ import {
5454
ConsecutiveMistakeError,
5555
MAX_MCP_TOOLS_THRESHOLD,
5656
countEnabledMcpTools,
57+
providerIdentifiers,
5758
} from "@roo-code/types"
5859
import { TelemetryService } from "@roo-code/telemetry"
5960
import { CloudService } from "@roo-code/cloud"
@@ -4224,7 +4225,7 @@ export class Task extends EventEmitter<TaskEvents> implements TaskLike {
42244225
// but uses allowedFunctionNames to restrict which tools can be called.
42254226
// Other providers (Anthropic, OpenAI, etc.) don't support this feature yet,
42264227
// so they continue to receive only the filtered tools for the current mode.
4227-
const supportsAllowedFunctionNames = apiConfiguration?.apiProvider === "gemini"
4228+
const supportsAllowedFunctionNames = apiConfiguration?.apiProvider === providerIdentifiers.gemini
42284229

42294230
{
42304231
const provider = this.providerRef.deref()

0 commit comments

Comments
 (0)