fix(gemini): drop Agent dispatcher tool (#3349)
This commit is contained in:
5
.changeset/fix-3344-gemini-agent-tool.md
Normal file
5
.changeset/fix-3344-gemini-agent-tool.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
type: Fixed
|
||||||
|
pr: 3349
|
||||||
|
---
|
||||||
|
Gemini and Antigravity agent conversion now drops Claude-only agent dispatcher tools instead of emitting invalid `agent` permissions.
|
||||||
@@ -1240,7 +1240,7 @@ function convertToolName(claudeTool) {
|
|||||||
* Convert a Claude Code tool name to Gemini CLI format
|
* Convert a Claude Code tool name to Gemini CLI format
|
||||||
* - Applies Claude→Gemini mapping (Read→read_file, Bash→run_shell_command, etc.)
|
* - Applies Claude→Gemini mapping (Read→read_file, Bash→run_shell_command, etc.)
|
||||||
* - Filters out MCP tools (mcp__*) — they are auto-discovered at runtime in Gemini
|
* - Filters out MCP tools (mcp__*) — they are auto-discovered at runtime in Gemini
|
||||||
* - Filters out Task — agents are auto-registered as tools in Gemini
|
* - Filters out Task/Agent — agents are auto-registered as tools in Gemini
|
||||||
* @returns {string|null} Gemini tool name, or null if tool should be excluded
|
* @returns {string|null} Gemini tool name, or null if tool should be excluded
|
||||||
*/
|
*/
|
||||||
function convertGeminiToolName(claudeTool) {
|
function convertGeminiToolName(claudeTool) {
|
||||||
@@ -1248,8 +1248,8 @@ function convertGeminiToolName(claudeTool) {
|
|||||||
if (claudeTool.startsWith('mcp__')) {
|
if (claudeTool.startsWith('mcp__')) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
// Task: exclude — agents are auto-registered as callable tools
|
// Task/Agent: exclude — agents are auto-registered as callable tools
|
||||||
if (claudeTool === 'Task') {
|
if (claudeTool === 'Task' || claudeTool === 'Agent') {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
// Check for explicit mapping
|
// Check for explicit mapping
|
||||||
|
|||||||
@@ -264,6 +264,28 @@ Use \${PHASE} in shell examples.
|
|||||||
assert.ok(result.includes('$PHASE'), 'escapes ${PHASE} shell variable for Gemini');
|
assert.ok(result.includes('$PHASE'), 'escapes ${PHASE} shell variable for Gemini');
|
||||||
assert.ok(!result.includes('${PHASE}'), 'removes Gemini template-string pattern');
|
assert.ok(!result.includes('${PHASE}'), 'removes Gemini template-string pattern');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('excludes Claude agent dispatcher tools from Gemini frontmatter', () => {
|
||||||
|
const input = `---
|
||||||
|
name: gsd-debug-session-manager
|
||||||
|
description: Manages debug sessions.
|
||||||
|
tools: Read, Task, Agent, AskUserQuestion
|
||||||
|
---
|
||||||
|
|
||||||
|
<role>
|
||||||
|
Coordinate debugger agents.
|
||||||
|
</role>`;
|
||||||
|
|
||||||
|
const result = convertClaudeToGeminiAgent(input);
|
||||||
|
const frontmatter = result.split('---')[1] || '';
|
||||||
|
|
||||||
|
assert.ok(frontmatter.includes(' - read_file'), 'maps Read -> read_file');
|
||||||
|
assert.ok(frontmatter.includes(' - ask_user'), 'maps AskUserQuestion -> ask_user');
|
||||||
|
assert.ok(!frontmatter.includes(' - task'), 'does not emit invalid Gemini task tool');
|
||||||
|
assert.ok(!frontmatter.includes(' - agent'), 'does not emit invalid Gemini agent tool');
|
||||||
|
assert.ok(!frontmatter.includes('Task'), 'does not preserve Claude-only Task tool');
|
||||||
|
assert.ok(!frontmatter.includes('Agent'), 'does not preserve Claude-only Agent tool');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// ─── neutralizeAgentReferences (#766) ─────────────────────────────────────────
|
// ─── neutralizeAgentReferences (#766) ─────────────────────────────────────────
|
||||||
|
|||||||
Reference in New Issue
Block a user