feat: Add Google Gemini CLI as experimental agentic engine#16894
feat: Add Google Gemini CLI as experimental agentic engine#16894
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Recreates Gemini engine support from PR #16595: - Add Gemini constants (port 10003, version 0.29.0, env vars) - Update JSON schema to include 'gemini' as valid engine - Create gemini_engine.go with installation and execution steps - Create gemini_logs.go for JSON log parsing - Create gemini_mcp.go for MCP configuration - Add GeminiDefaultDomains and helper function to domains.go - Register Gemini engine in engine registry - Update engine count tests to expect 4 engines - Add comprehensive unit tests Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds Google Gemini CLI as an experimental fourth built-in agentic engine, integrating it into engine registry, schema validation, firewall domain allowlists, and MCP configuration rendering.
Changes:
- Introduces
GeminiEngineimplementation plus MCP config rendering and log-metrics parsing. - Wires
geminiinto engine registration, CLI completion tests, and workflow schema engine enums. - Expands allowed-domain defaults (Gemini domains + adds
ubuntu.comto Claude defaults) and propagates domain list updates into compiled workflow lockfiles.
Reviewed changes
Copilot reviewed 47 out of 47 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/workflow/gemini_engine.go | Implements Gemini engine install/exec steps and firewall wrapping. |
| pkg/workflow/gemini_engine_test.go | Adds unit tests for Gemini engine installation/execution behavior. |
| pkg/workflow/gemini_logs.go | Parses Gemini JSON output to extract token usage and tool-call metrics. |
| pkg/workflow/gemini_mcp.go | Renders MCP server config for Gemini using shared JSON renderer. |
| pkg/workflow/domains.go | Adds Gemini default domains + helper; adds ubuntu.com to Claude defaults. |
| pkg/constants/constants.go | Adds Gemini LLM gateway port, model env vars, and default Gemini CLI version. |
| pkg/workflow/agentic_engine.go | Registers the Gemini engine in the engine registry. |
| pkg/workflow/agentic_engine_test.go | Updates built-in engine count expectation for registry tests. |
| pkg/parser/schemas/main_workflow_schema.json | Adds gemini to engine enums (string + object variants) and updates descriptions. |
| pkg/cli/completions_test.go | Updates engine-name completion tests to include gemini. |
| .github/workflows/typist.lock.yml | Updates allowed domain list to include ubuntu.com. |
| .github/workflows/test-create-pr-error-handling.lock.yml | Updates allowed domain list to include ubuntu.com. |
| .github/workflows/step-name-alignment.lock.yml | Updates allowed domain list to include ubuntu.com. |
| .github/workflows/static-analysis-report.lock.yml | Updates allowed domain list to include ubuntu.com. |
| .github/workflows/smoke-claude.lock.yml | Updates allowed domain list to include ubuntu.com. |
| .github/workflows/sergo.lock.yml | Updates allowed domain list to include ubuntu.com. |
| .github/workflows/semantic-function-refactor.lock.yml | Updates allowed domain list to include ubuntu.com. |
| .github/workflows/scout.lock.yml | Updates allowed domain list to include ubuntu.com. |
| .github/workflows/schema-consistency-checker.lock.yml | Updates allowed domain list to include ubuntu.com. |
| .github/workflows/safe-output-health.lock.yml | Updates allowed domain list to include ubuntu.com. |
| .github/workflows/prompt-clustering-analysis.lock.yml | Updates allowed domain list to include ubuntu.com. |
| .github/workflows/lockfile-stats.lock.yml | Updates allowed domain list to include ubuntu.com. |
| .github/workflows/instructions-janitor.lock.yml | Updates allowed domain list to include ubuntu.com. |
| .github/workflows/go-pattern-detector.lock.yml | Updates allowed domain list to include ubuntu.com. |
| .github/workflows/go-logger.lock.yml | Updates allowed domain list to include ubuntu.com. |
| .github/workflows/go-fan.lock.yml | Updates allowed domain list to include ubuntu.com. |
| .github/workflows/github-mcp-tools-report.lock.yml | Updates allowed domain list to include ubuntu.com. |
| .github/workflows/github-mcp-structural-analysis.lock.yml | Updates allowed domain list to include ubuntu.com. |
| .github/workflows/example-workflow-analyzer.lock.yml | Updates allowed domain list to include ubuntu.com. |
| .github/workflows/developer-docs-consolidator.lock.yml | Updates allowed domain list to include ubuntu.com. |
| .github/workflows/daily-team-evolution-insights.lock.yml | Updates allowed domain list to include ubuntu.com. |
| .github/workflows/daily-security-red-team.lock.yml | Updates allowed domain list to include ubuntu.com. |
| .github/workflows/daily-safe-outputs-conformance.lock.yml | Updates allowed domain list to include ubuntu.com. |
| .github/workflows/daily-safe-output-optimizer.lock.yml | Updates allowed domain list to include ubuntu.com. |
| .github/workflows/daily-doc-updater.lock.yml | Updates allowed domain list to include ubuntu.com. |
| .github/workflows/daily-code-metrics.lock.yml | Updates allowed domain list to include ubuntu.com. |
| .github/workflows/daily-choice-test.lock.yml | Updates allowed domain list to include ubuntu.com. |
| .github/workflows/copilot-session-insights.lock.yml | Updates allowed domain list to include ubuntu.com. |
| .github/workflows/copilot-agent-analysis.lock.yml | Updates allowed domain list to include ubuntu.com. |
| .github/workflows/commit-changes-analyzer.lock.yml | Updates allowed domain list to include ubuntu.com. |
| .github/workflows/cloclo.lock.yml | Updates allowed domain list to include ubuntu.com. |
| .github/workflows/claude-code-user-docs-review.lock.yml | Updates allowed domain list to include ubuntu.com. |
| .github/workflows/blog-auditor.lock.yml | Updates allowed domain list to include ubuntu.com. |
| .github/workflows/audit-workflows.lock.yml | Updates allowed domain list to include ubuntu.com. |
Comments suppressed due to low confidence (1)
pkg/workflow/gemini_logs.go:77
GeminiEngine.ParseLogMetricsintroduces new log-parsing behavior but there are no unit tests validating token extraction and tool-call counting from the Gemini JSON shape ({response, stats}). Add tests similar topkg/workflow/codex_logs_test.goto cover: (1) models/input+output token summing, (2) tools call-count extraction, and (3) handling of non-JSON noise in the log.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| stepContent := strings.Join(steps[0], "\n") | ||
|
|
||
| assert.Contains(t, stepContent, "name: Run Gemini", "Should have correct step name") | ||
| assert.Contains(t, stepContent, "id: agentic_execution", "Should have agentic_execution ID") | ||
| assert.Contains(t, stepContent, "gemini", "Should invoke gemini command") | ||
| assert.Contains(t, stepContent, "--output-format json", "Should use JSON output format") | ||
| assert.Contains(t, stepContent, "--prompt", "Should include prompt argument") | ||
| assert.Contains(t, stepContent, "/tmp/test.log", "Should include log file") |
There was a problem hiding this comment.
The execution-step test only asserts that --prompt is present; it doesn’t validate the exact quoting/shape of the prompt argument. Add an assertion that the rendered command passes the prompt content without introducing extra literal quote characters (to prevent regressions in prompt construction).
pkg/workflow/agentic_engine_test.go
Outdated
| // Test that built-in engines are registered | ||
| supportedEngines := registry.GetSupportedEngines() | ||
| if len(supportedEngines) != 3 { | ||
| t.Errorf("Expected 3 supported engines, got %d", len(supportedEngines)) | ||
| if len(supportedEngines) != 4 { | ||
| t.Errorf("Expected 4 supported engines, got %d", len(supportedEngines)) | ||
| } |
There was a problem hiding this comment.
This test asserts an exact engine count (len(supportedEngines) != 4), which will fail whenever a new built-in engine is added (even if everything else is correct). Prefer asserting that the expected engine IDs are present (and optionally that the count is >= the expected minimum) to make the test less brittle.
…ni-agentic-support
…aultDomains, add gemini to AllEngines test Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Merged main and fixed the build in c023fa2. The failure was caused by adding Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
…dd smoke-gemini workflow, improve tests - Remove ubuntu.com from ClaudeDefaultDomains (was causing CI golden test failures) - Regenerate WASM golden files without ubuntu.com - Add smoke-gemini.md agentic workflow for Gemini engine smoke testing - Fix ParseLogMetrics to use map-based deduplication for tool calls - Make TestEngineRegistry less brittle (check for expected IDs instead of exact count) - Add exact prompt format assertion to gemini execution test Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Added
Fixed in c68f598 — removed |
… add gemini test case Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Fixed in 54ed88f. |
pkg/constants/constants.go(port 10003, version 0.29.0, env vars)pkg/workflow/gemini_engine.go- core engine implementationpkg/workflow/gemini_logs.go- JSON log parsing with deduplicationpkg/workflow/gemini_mcp.go- MCP configuration renderingpkg/workflow/domains.go- add GeminiDefaultDomains and helper functionpkg/workflow/agentic_engine.gopkg/workflow/agentic_engine_test.go- check expected engine IDs (not brittle count)pkg/workflow/gemini_engine_test.go- unit tests with exact prompt format assertionpkg/cli/completions_test.go- include gemini in expected enginessmoke-gemini.mdagentic workflowubuntu.comfromClaudeDefaultDomains(was breaking CI golden tests)TestWasmGolden_AllEnginescmd/gh-aw/main_entry_test.go: add gemini test case, use dynamic error prefix check💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.