-
Notifications
You must be signed in to change notification settings - Fork 433
Enable --enable-api-proxy flag for Gemini engine and add parse_gemini_log.cjs #17245
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
680f098
898ad5b
d8bf423
e0db320
604cb00
b9eeee2
1d1d9f2
34fca18
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,98 @@ | ||||||
| // @ts-check | ||||||
| /// <reference types="@actions/github-script" /> | ||||||
|
|
||||||
| const { createEngineLogParser } = require("./log_parser_shared.cjs"); | ||||||
|
|
||||||
| const main = createEngineLogParser({ | ||||||
| parserName: "Gemini", | ||||||
| parseFunction: parseGeminiLog, | ||||||
| supportsDirectories: false, | ||||||
| }); | ||||||
|
|
||||||
| /** | ||||||
| * Parse Gemini CLI streaming JSON log output and format as markdown. | ||||||
| * Gemini CLI outputs one JSON object per line when using --output-format stream-json (JSONL). | ||||||
| * @param {string} logContent - The raw log content to parse | ||||||
| * @returns {{markdown: string, logEntries: Array, mcpFailures: Array<string>, maxTurnsHit: boolean}} Parsed log data | ||||||
| */ | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The JSDoc return type could be more precise - |
||||||
| function parseGeminiLog(logContent) { | ||||||
| if (!logContent) { | ||||||
| return { | ||||||
| markdown: "## 🤖 Gemini\n\nNo log content provided.\n\n", | ||||||
| logEntries: [], | ||||||
| mcpFailures: [], | ||||||
| maxTurnsHit: false, | ||||||
| }; | ||||||
| } | ||||||
|
|
||||||
| let markdown = ""; | ||||||
| let totalInputTokens = 0; | ||||||
| let totalOutputTokens = 0; | ||||||
| let lastResponse = ""; | ||||||
|
|
||||||
| const lines = logContent.split("\n"); | ||||||
| for (const line of lines) { | ||||||
| const trimmed = line.trim(); | ||||||
| if (!trimmed) { | ||||||
| continue; | ||||||
| } | ||||||
|
|
||||||
| // Try to parse each line as a JSON object (Gemini --output-format json output) | ||||||
|
||||||
| // Try to parse each line as a JSON object (Gemini --output-format json output) | |
| // Try to parse each line as a JSON object from Gemini --output-format stream-json output (JSONL) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment says "Gemini --output-format json output" but the PR changes the format to stream-json (JSONL). The comment on line 50 should be updated to reference stream-json instead of json to match the actual format being used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Silently skipping non-JSON lines is the right approach here since Gemini CLI may mix JSON with other output. The _e naming convention for ignored errors is consistent with the codebase style.
Copilot
AI
Feb 20, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The newly added parse_gemini_log.cjs is missing a corresponding test file. All other log parsers in this directory have associated test files (e.g., parse_claude_log.test.cjs, parse_codex_log.test.cjs, parse_copilot_log.test.cjs). A parse_gemini_log.test.cjs file should be added to maintain consistency with the established testing pattern for log parsers.
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -170,7 +170,8 @@ func BuildAWFArgs(config AWFCommandConfig) []string { | |||||
| awfArgs = append(awfArgs, "--proxy-logs-dir", string(constants.AWFProxyLogsDir)) | ||||||
|
|
||||||
| // Add --enable-host-access when MCP servers are configured (gateway is used) | ||||||
| if HasMCPServers(config.WorkflowData) { | ||||||
| // OR when the API proxy sidecar is enabled (needs to reach host.docker.internal:<port>) | ||||||
| if HasMCPServers(config.WorkflowData) || config.UsesAPIProxy { | ||||||
| awfArgs = append(awfArgs, "--enable-host-access") | ||||||
| awfHelpersLog.Print("Added --enable-host-access for MCP gateway communication") | ||||||
|
||||||
| awfHelpersLog.Print("Added --enable-host-access for MCP gateway communication") | |
| awfHelpersLog.Print("Added --enable-host-access for MCP gateway and/or API proxy communication") |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Test file for PR push - smoke test run 22239107636 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pinning to a specific model (
gemini-2.0-flash-lite) is a good practice for reproducibility. This ensures consistent behavior across runs rather than relying on whatever "latest" model is available.