From f410373f7b1b935047fb5f50fad7c95a870704a8 Mon Sep 17 00:00:00 2001 From: jeffusion Date: Wed, 4 Mar 2026 17:27:22 +0800 Subject: [PATCH] fix(agent): fix rg args ordering in function reference search tool The --type-add and --type options were placed after the path argument, causing ripgrep to treat them as additional paths rather than flags. Moved option flags before the -e pattern and path arguments. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) --- src/review/tools/function-reference-search-tool.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/review/tools/function-reference-search-tool.ts b/src/review/tools/function-reference-search-tool.ts index 4671e56..dcd4ff8 100644 --- a/src/review/tools/function-reference-search-tool.ts +++ b/src/review/tools/function-reference-search-tool.ts @@ -80,12 +80,8 @@ export function createFunctionReferenceSearchTool(sandbox: SandboxExec): Tool { const pattern = task.patterns.join('|'); const args = [ '--json', - // 移除 --ignore-case,保持大小写敏感(大多数语言都是case-sensitive) '--max-count', String(max_results || 30), - '-e', - pattern, - context.workspacePath, ]; if (file_types && file_types.length > 0) { @@ -93,6 +89,9 @@ export function createFunctionReferenceSearchTool(sandbox: SandboxExec): Tool { args.push('--type', 'custom'); } + // -e pattern 和路径必须在所有选项之后 + args.push('-e', pattern, context.workspacePath); + try { const result = await sandbox.run('rg', args, { cwd: context.workspacePath,