Skip to content

Commit e0912e8

Browse files
Copilotgh-aw-bot
andauthored
Fix Gemini deprecation review feedback
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
1 parent 0cca98f commit e0912e8

3 files changed

Lines changed: 21 additions & 4 deletions

File tree

‎pkg/constants/constants_test.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ func TestGetEngineOption_AllBuiltInEngines(t *testing.T) {
405405
{string(CopilotEngine), "GitHub Copilot", CopilotGitHubToken, nil},
406406
{string(ClaudeEngine), "Claude", AnthropicAPIKey, []string{}},
407407
{string(CodexEngine), "Codex", OpenAIAPIKey, []string{CodexAPIKey}},
408-
{string(GeminiEngine), "Gemini", GeminiAPIKey, nil},
408+
{string(GeminiEngine), "Gemini (Deprecated)", GeminiAPIKey, nil},
409409
{string(PiEngine), "Pi", CopilotGitHubToken, []string{AnthropicAPIKey, OpenAIAPIKey, CodexAPIKey, GeminiAPIKey}},
410410
}
411411

‎pkg/workflow/compiler_orchestrator_engine.go‎

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,7 @@ func (c *Compiler) setupEngineAndImports(result *parser.FrontmatterResult, clean
8585
if err := c.runPostEngineValidations(result.Frontmatter, engineSetting, engineConfig, networkPermissions, sandboxConfig, agenticEngine, importsResult); err != nil {
8686
return nil, err
8787
}
88-
if agenticEngine.GetID() == string(constants.GeminiEngine) {
89-
fmt.Fprintln(os.Stderr, console.FormatInfoMessage("The gemini engine is deprecated in favor of the experimental agy engine. Use engine: agy where supported; retain engine: gemini for Google WIF or features Agy does not support. See https://github.github.com/gh-aw/engines/agy/"))
90-
}
88+
c.emitGeminiDeprecationNotice(agenticEngine)
9189
return &engineSetupResult{
9290
engineSetting: engineSetting,
9391
model: model,
@@ -100,6 +98,17 @@ func (c *Compiler) setupEngineAndImports(result *parser.FrontmatterResult, clean
10098
}, nil
10199
}
102100

101+
func (c *Compiler) emitGeminiDeprecationNotice(engine CodingAgentEngine) {
102+
if engine.GetID() != string(constants.GeminiEngine) {
103+
return
104+
}
105+
if c.batchMode {
106+
c.featureUsage["gemini deprecation"]++
107+
} else if !c.quiet {
108+
fmt.Fprintln(os.Stderr, console.FormatInfoMessageStderr("The gemini engine is deprecated in favor of the experimental agy engine. Use engine: agy where supported; retain engine: gemini for Google WIF or features Agy does not support. See https://github.github.com/gh-aw/engines/agy/"))
109+
}
110+
}
111+
103112
// Import defaults can still change the engine config after this typo check.
104113
// Imported definitions are registered later and must skip early resolution.
105114
func (c *Compiler) validateEarlyEngineSetting(frontmatter map[string]any, engineSetting string, engineConfig *EngineConfig) error {

‎pkg/workflow/compiler_orchestrator_engine_test.go‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,20 @@ func TestSetupEngineAndImports_GeminiDeprecation(t *testing.T) {
2121
engine string
2222
imported bool
2323
override string
24+
batchMode bool
25+
quiet bool
2426
wantEngine string
2527
wantNotices int
28+
wantBatchUse int
2629
wantWarnings int
2730
}{
2831
{name: "string form", engine: "engine: gemini\n", wantEngine: "gemini", wantNotices: 1},
2932
{name: "object form with pin", engine: "engine:\n id: gemini\n version: \"0.39.1\"\n", wantEngine: "gemini", wantNotices: 1},
3033
{name: "imported engine", imported: true, wantEngine: "gemini", wantNotices: 1},
3134
{name: "override to Gemini", engine: "engine: copilot\n", override: "gemini", wantEngine: "gemini", wantNotices: 1, wantWarnings: 1},
3235
{name: "override away from Gemini", engine: "engine: gemini\n", override: "copilot", wantEngine: "copilot", wantWarnings: 1},
36+
{name: "batch mode aggregates notice", engine: "engine: gemini\n", batchMode: true, wantEngine: "gemini", wantBatchUse: 1},
37+
{name: "quiet mode suppresses notice", engine: "engine: gemini\n", quiet: true, wantEngine: "gemini"},
3338
{name: "default engine", wantEngine: "copilot"},
3439
{name: "experimental replacement", engine: "engine: agy\n", wantEngine: "agy"},
3540
{
@@ -60,6 +65,8 @@ func TestSetupEngineAndImports_GeminiDeprecation(t *testing.T) {
6065
require.NoError(t, err)
6166
compiler := NewCompiler(WithEngineOverride(tt.override))
6267
compiler.SetStrictMode(true)
68+
compiler.SetBatchMode(tt.batchMode)
69+
compiler.SetQuiet(tt.quiet)
6370
output := testutil.CaptureStderr(t, func() {
6471
result, err := compiler.setupEngineAndImports(frontmatter, filepath.Join(tmpDir, "test.md"), []byte(content), tmpDir)
6572
require.NoError(t, err)
@@ -76,6 +83,7 @@ func TestSetupEngineAndImports_GeminiDeprecation(t *testing.T) {
7683
}
7784
})
7885
assert.Equal(t, tt.wantNotices, strings.Count(output, "The gemini engine is deprecated"))
86+
assert.Equal(t, tt.wantBatchUse, compiler.GetExperimentalFeatureUsage()["gemini deprecation"])
7987
assert.Equal(t, tt.wantWarnings, compiler.GetWarningCount())
8088
if tt.wantNotices > 0 {
8189
assert.Contains(t, output, "Use engine: agy where supported")

0 commit comments

Comments
 (0)