Skip to content

Enable --enable-api-proxy flag for Gemini engine and add parse_gemini_log.cjs#17245

Merged
pelikhan merged 8 commits into
mainfrom
copilot/enable-support-llm-gateway
Feb 20, 2026
Merged

Enable --enable-api-proxy flag for Gemini engine and add parse_gemini_log.cjs#17245
pelikhan merged 8 commits into
mainfrom
copilot/enable-support-llm-gateway

Conversation

Copilot AI commented Feb 20, 2026

Copy link
Copy Markdown
Contributor

Gemini's AWF command was missing --enable-api-proxy despite the engine declaring LLM gateway support (port 10003). Additionally, the "Parse agent logs" step in smoke-gemini was failing because parse_gemini_log.cjs didn't exist.

Changes

  • gemini_engine.go: Use explicit llmGatewayPort/usesAPIProxy variables (matching Claude/Codex pattern) so --enable-api-proxy is correctly included in AWF invocations; switch output format from --output-format json to --output-format stream-json (streaming JSONL, consistent with Claude); fix non-AWF path to use tee -a; set GEMINI_API_BASE_URL=http://host.docker.internal:10003 when the firewall is enabled so the Gemini CLI routes LLM calls through the AWF api-proxy sidecar
  • awf_helpers.go: Add --enable-host-access to AWF args when UsesAPIProxy is true (in addition to when MCP servers are present), ensuring the container can always reach host.docker.internal when the API proxy is in use
  • parse_gemini_log.cjs: Add log parser for Gemini's --output-format stream-json output, extracting response text and token usage from stats.models
  • strict_mode_llm_gateway_test.go: Add Gemini to TestSupportsLLMGateway with constants.GeminiLLMGatewayPort
  • gemini_engine_test.go: Update assertions to check for --output-format stream-json, --enable-api-proxy, and GEMINI_API_BASE_URL when firewall is enabled
  • smoke-gemini.md: Use gemini-2.0-flash-lite model (cheaper/faster equivalent of Claude Haiku) to reduce API costs
  • smoke-gemini.lock.yml: Recompiled to include --enable-api-proxy, --model gemini-2.0-flash-lite, --output-format stream-json, and GEMINI_API_BASE_URL: http://host.docker.internal:10003 in the AWF invocation

🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.



✨ PR Review Safe Output Test - Run 22239107636

💥 [THE END] — Illustrated by Smoke Claude

…_log.cjs

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Enable supportLLMGateway and correct awf flags Enable --enable-api-proxy flag for Gemini engine and add parse_gemini_log.cjs Feb 20, 2026
Copilot AI requested a review from pelikhan February 20, 2026 17:52
Comment thread pkg/workflow/gemini_engine.go
@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot output format should be streaming JSON like claude

…eps and add to TestSupportsLLMGateway

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

Copilot AI commented Feb 20, 2026

Copy link
Copy Markdown
Contributor Author

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

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:

  • https://api.github.com/graphql
    • Triggering command: /usr/bin/gh /usr/bin/gh api graphql -f query=query($owner: String!, $name: String!) { repository(owner: $owner, name: $name) { hasDiscussionsEnabled } } -f owner=github -f name=gh-aw GO111MODULE 64/bin/go git remo�� add origin (http block)
  • https://api.github.com/repos/actions/ai-inference/git/ref/tags/v1
    • Triggering command: /usr/bin/gh gh api /repos/actions/ai-inference/git/ref/tags/v1 --jq .object.sha runs/20260220-195816-27414/test-1466824950/.github/workflows GO111MODULE 6170633/b354/vet.cfg l GOMOD GOMODCACHE o &#34;��� Warning: .github/aw/actions-lock.json does not exist yet&#34;/tmp/file-tracker-test1757617423/test2.lock.yml env -json GO111MODULE 0/x64/bin/node GOINSECURE GOMOD GOMODCACHE 0/x64/bin/node (http block)
  • https://api.github.com/repos/actions/checkout/git/ref/tags/v3
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v3 --jq .object.sha -json GO111MODULE ache/go/1.25.0/x64/bin/go GOINSECURE GOMOD GOMODCACHE go env 5816-27414/test-2553828061/.github/workflows GO111MODULE .cfg GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/actions/checkout/git/ref/tags/v4
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v4 --jq .object.sha auto-triage-issues.md a260263129e254f196e1c435:go.mod /opt/hostedtoolcache/go/1.25.0/x64/bin/go GOINSECURE GOMOD GOMODCACHE go env 5816-27414/test-1467689032 GO111MODULE /opt/hostedtoolcache/go/1.25.0/x64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v4 --jq .object.sha 12 GO111MODULE /opt/hostedtoolcache/go/1.25.0/x64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE /opt/hostedtoolcache/go/1.25.0/x64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v4 --jq .object.sha --show-toplevel go /usr/bin/git -json GO111MODULE 64/bin/go git init�� GOMODCACHE node /usr/bin/git --check **/*.cjs 64/bin/go git (http block)
  • https://api.github.com/repos/actions/checkout/git/ref/tags/v5
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v5 --jq .object.sha -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE ache/go/1.25.0/x64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v5 --jq .object.sha sistency_GoAndJavaScript287229890/001/test-simple-frontmatter.md GOPROXY /usr/bin/git GOSUMDB GOWORK 64/bin/go git rev-�� --show-toplevel (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v5 --jq .object.sha --git-dir 067077/b405/impoconfig /usr/bin/git che/go-build/d7/git GOPROXY 64/bin/go git conf�� user.name Test User /usr/bin/git /tmp/go-build471git -trimpath 64/bin/go /usr/bin/git (http block)
  • https://api.github.com/repos/actions/github-script/git/ref/tags/v8
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v8 --jq .object.sha GOSUMDB GOWORK 64/bin/go GOINSECURE GOMOD GOMODCACHE go m/_n�� -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v8 --jq .object.sha -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v8 --jq .object.sha ck &#39;scripts/**/*GOINSECURE GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/actions/setup-go/git/ref/tags/v4
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-go/git/ref/tags/v4 --jq .object.sha bot-detection.md GO111MODULE 0/x64/bin/node GOINSECURE GOMOD GOMODCACHE go -has�� SameOutput3630847057/001/stability-test.md GO111MODULE /opt/hostedtoolcache/go/1.25.0/x64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/actions/setup-node/git/ref/tags/v4
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v4 --jq .object.sha blog-auditor.md GO111MODULE /opt/hostedtoolcache/go/1.25.0/x64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE /opt/hostedtoolcache/go/1.25.0/x64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/1/artifacts
    • Triggering command: /usr/bin/gh gh run download 1 --dir test-logs/run-1 GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/12345/artifacts
    • Triggering command: /usr/bin/gh gh run download 12345 --dir test-logs/run-12345 GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go estl�� -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/12346/artifacts
    • Triggering command: /usr/bin/gh gh run download 12346 --dir test-logs/run-12346 GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go estl�� -json GO111MODULE 64/bin/go Action pins syngit GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/2/artifacts
    • Triggering command: /usr/bin/gh gh run download 2 --dir test-logs/run-2 GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/3/artifacts
    • Triggering command: /usr/bin/gh gh run download 3 --dir test-logs/run-3 GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/4/artifacts
    • Triggering command: /usr/bin/gh gh run download 4 --dir test-logs/run-4 GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/5/artifacts
    • Triggering command: /usr/bin/gh gh run download 5 --dir test-logs/run-5 GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/github/gh-aw/actions/workflows
    • Triggering command: /usr/bin/gh gh workflow list --json name,state,path om/aymanbagabas/GOINSECURE om/aymanbagabas/GOMOD 64/bin/go GOINSECURE GOMOD GOMODCACHE ache/go/1.25.0/xGO111MODULE env 067077/b386/_pkgGOINSECURE GO111MODULE 64/bin/go GOINSECURE b/gh-aw/pkg/consdescribe GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh run list --json databaseId,number,url,status,conclusion,workflowName,createdAt,startedAt,updatedAt,event,headBranch,headSha,displayTitle --workflow nonexistent-workflow-12345 --limit 100 b/gh-aw/pkg/cons-V=full GOMODCACHE go env aID7/NOAibyV6rb6GOSUMDB GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE 067077/b384/importcfg (http block)
    • Triggering command: /usr/bin/gh gh run list --json databaseId,number,url,status,conclusion,workflowName,createdAt,startedAt,updatedAt,event,headBranch,headSha,displayTitle --workflow nonexistent-workflow-12345 --limit 6 GOMOD GOMODCACHE x_amd64/compile env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/github/gh-aw/git/ref/tags/v1.0.0
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v1.0.0 --jq .object.sha -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/nonexistent/action/git/ref/tags/v999.999.999
    • Triggering command: /usr/bin/gh gh api /repos/nonexistent/action/git/ref/tags/v999.999.999 --jq .object.sha -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env 2553828061/.github/workflows GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/nonexistent/repo/actions/runs/12345
    • Triggering command: /usr/bin/gh gh run view 12345 --repo nonexistent/repo --json status,conclusion GOINSECURE GOMOD GOMODCACHE x_amd64/link env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE Xu/X6R5OoPF4X40d7UERB47/kI2eOA--test@example.com (http block)
  • https://api.github.com/repos/owner/repo/actions/workflows
    • Triggering command: /usr/bin/gh gh workflow list --json name,state,path --repo owner/repo 64/bin/go GOINSECURE GOMOD GOMODCACHE ache/go/1.25.0/xGO111MODULE env 067077/b387/_pkgGOINSECURE GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh workflow list --json name,state,path --repo owner/repo 64/bin/go GOINSECURE GOMOD ode-gyp-bin/node-json ache/go/1.25.0/xGO111MODULE env 067077/b382/_pkgGOINSECURE GO111MODULE 64/bin/go GOINSECURE bagabas/go-udiff-c GOMODCACHE go (http block)
  • https://api.github.com/repos/owner/repo/contents/file.md
    • Triggering command: /tmp/go-build4206170633/b380/cli.test /tmp/go-build4206170633/b380/cli.test -test.testlogfile=/tmp/go-build4206170633/b380/testlog.txt -test.paniconexit0 -test.v=true -test.parallel=4 -test.timeout=10m0s -test.run=^Test -test.short=true GOINSECURE GOMOD GOMODCACHE go env ck &#39;scripts/**/*GOINSECURE GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/test-owner/test-repo/actions/secrets
    • Triggering command: /usr/bin/gh gh api /repos/test-owner/test-repo/actions/secrets --jq .secrets[].name g/mathutil/mathuGOINSECURE GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE ache/go/1.25.0/xGO111MODULE env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)

If you need me to access, download, or install something from one of these locations, you can either:

…ike Claude)

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

Copilot AI commented Feb 20, 2026

Copy link
Copy Markdown
Contributor Author

@copilot output format should be streaming JSON like claude

Done in b9eeee2 — changed --output-format json to --output-format stream-json in gemini_engine.go, updated the parse_gemini_log.cjs comment to reflect JSONL format, and recompiled smoke-gemini.lock.yml.

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:

  • https://api.github.com/graphql
    • Triggering command: /usr/bin/gh /usr/bin/gh api graphql -f query=query($owner: String!, $name: String!) { repository(owner: $owner, name: $name) { hasDiscussionsEnabled } } -f owner=github -f name=gh-aw (http block)
    • Triggering command: /usr/bin/gh /usr/bin/gh api graphql -f query=query($owner: String!, $name: String!) { repository(owner: $owner, name: $name) { hasDiscussionsEnabled } } -f owner=github -f name=gh-aw Qrj1_mY/uhmsciEK-C (http block)
  • https://api.github.com/repos/actions/checkout/git/ref/tags/11bd71901bbe5b1630ceea73d27597364c9af683
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/11bd71901bbe5b1630ceea73d27597364c9af683 --jq .object.sha (http block)
  • https://api.github.com/repos/actions/checkout/git/ref/tags/v6
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v6 --jq .object.sha (http block)
  • https://api.github.com/repos/actions/github-script/git/ref/tags/v7
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v7 --jq .object.sha (http block)
  • https://api.github.com/repos/actions/setup-go/git/ref/tags/4dc6199c7b1a012772edbd06daecab0f50c9053c
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-go/git/ref/tags/4dc6199c7b1a012772edbd06daecab0f50c9053c --jq .object.sha (http block)
  • https://api.github.com/repos/actions/setup-go/git/ref/tags/v5
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-go/git/ref/tags/v5 --jq .object.sha (http block)
  • https://api.github.com/repos/actions/setup-go/git/ref/tags/v6
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-go/git/ref/tags/v6 --jq .object.sha (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-go/git/ref/tags/v6 --jq .object.sha -c=4 -nolocalimports -importcfg /tmp/go-build1180390508/b062/importcfg -pack /home/REDACTED/work/gh-aw/gh-aw/pkg/cli/access_log.go /home/REDACTED/work/gh-aw/gh-aw/pkg/cli/actionlint.go (http block)
  • https://api.github.com/repos/actions/setup-node/git/ref/tags/v6
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v6 --jq .object.sha (http block)
  • https://api.github.com/repos/anchore/sbom-action/git/ref/tags/v0
    • Triggering command: /usr/bin/gh gh api /repos/anchore/sbom-action/git/ref/tags/v0 --jq .object.sha (http block)
  • https://api.github.com/repos/docker/build-push-action/git/ref/tags/v6
    • Triggering command: /usr/bin/gh gh api /repos/docker/build-push-action/git/ref/tags/v6 --jq .object.sha ./cmd/gh-aw (http block)
    • Triggering command: /usr/bin/gh gh api /repos/docker/build-push-action/git/ref/tags/v6 --jq .object.sha (http block)
  • https://api.github.com/repos/docker/login-action/git/ref/tags/v3
    • Triggering command: /usr/bin/gh gh api /repos/docker/login-action/git/ref/tags/v3 --jq .object.sha (http block)
  • https://api.github.com/repos/docker/metadata-action/git/ref/tags/v5
    • Triggering command: /usr/bin/gh gh api /repos/docker/metadata-action/git/ref/tags/v5 --jq .object.sha (http block)
  • https://api.github.com/repos/docker/setup-buildx-action/git/ref/tags/v3
    • Triggering command: /usr/bin/gh gh api /repos/docker/setup-buildx-action/git/ref/tags/v3 --jq .object.sha (http block)
  • https://api.github.com/repos/github/gh-aw/git/ref/tags/a70c5eada06553e3510ac27f2c3bda9d3705bccb
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/a70c5eada06553e3510ac27f2c3bda9d3705bccb --jq .object.sha (http block)
  • https://api.github.com/repos/githubnext/agentics/git/ref/tags/
    • Triggering command: /usr/bin/gh gh api /repos/githubnext/agentics/git/ref/tags/# --jq .object.sha (http block)

If you need me to access, download, or install something from one of these locations, you can either:

@github-actions

github-actions Bot commented Feb 20, 2026

Copy link
Copy Markdown
Contributor

✨ The prophecy is fulfilled... Smoke Codex has completed its mystical journey. The stars align. 🌟

@github-actions

Copy link
Copy Markdown
Contributor

🧪 Smoke Project is now testing project operations...

@github-actions

Copy link
Copy Markdown
Contributor

🧪 Smoke Temporary ID is now testing temporary ID functionality...

@github-actions

Copy link
Copy Markdown
Contributor

📰 BREAKING: Smoke Copilot is now investigating this pull request. Sources say the story is developing...

@github-actions

github-actions Bot commented Feb 20, 2026

Copy link
Copy Markdown
Contributor

🎬 THE ENDSmoke Claude MISSION: ACCOMPLISHED! The hero saves the day! ✨

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

Copilot AI commented Feb 20, 2026

Copy link
Copy Markdown
Contributor Author

@copilot investigate this error, use a smaller cheaper model like haiku for smoke gemini (research proper name)

https://github.com/github/gh-aw/actions/runs/22239642635/job/64339889591#step:28:1

Done in 1d1d9f2. The step 28 "Run Gemini" failure showed an authentication_failed, detail=invalid_api_key error from the LLM gateway API proxy. Added model: gemini-2.0-flash-lite to smoke-gemini.mdgemini-2.0-flash-lite is the Gemini equivalent of Claude Haiku (cheapest/fastest Gemini model). The lock file now invokes gemini --model gemini-2.0-flash-lite --yolo --output-format stream-json ....

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:

  • https://api.github.com/graphql
    • Triggering command: /usr/bin/gh /usr/bin/gh api graphql -f query=query($owner: String!, $name: String!) { repository(owner: $owner, name: $name) { hasDiscussionsEnabled } } -f owner=github -f name=gh-aw /home/REDACTED/work/gh-aw/gh-aw/scratchpad/labels.md /home/REDACTED/work/gh-aw/gh-aw/scratchpad/ubuntulatest.md /home/REDACTED/work/gh-aw/gh-aw/scratchpad/engine-review-summary.md (http block)
    • Triggering command: /usr/bin/gh /usr/bin/gh api graphql -f query=query($owner: String!, $name: String!) { repository(owner: $owner, name: $name) { hasDiscussionsEnabled } } -f owner=github -f name=gh-aw (http block)
    • Triggering command: /usr/bin/gh /usr/bin/gh api graphql -f query=query($owner: String!, $name: String!) { repository(owner: $owner, name: $name) { hasDiscussionsEnabled } } -f owner=github -f name=gh-aw /home/REDACTED/work/gh-aw/gh-aw/docs/public/schemas/safe-inputs-config.schema.json /home/REDACTED/work/gh-aw/gh-aw/docs/public/schemas/mcp-gateway-config.schema.json /home/REDACTED/work/gh-aw/gh-aw/docs/public/editor/autocomplete-data.json (http block)
  • https://api.github.com/repos/actions/checkout/git/ref/tags/11bd71901bbe5b1630ceea73d27597364c9af683
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/11bd71901bbe5b1630ceea73d27597364c9af683 --jq .object.sha (http block)
  • https://api.github.com/repos/actions/checkout/git/ref/tags/v6
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v6 --jq .object.sha (http block)
  • https://api.github.com/repos/actions/github-script/git/ref/tags/v7
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v7 --jq .object.sha (http block)
  • https://api.github.com/repos/actions/setup-go/git/ref/tags/4dc6199c7b1a012772edbd06daecab0f50c9053c
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-go/git/ref/tags/4dc6199c7b1a012772edbd06daecab0f50c9053c --jq .object.sha (http block)
  • https://api.github.com/repos/actions/setup-go/git/ref/tags/v5
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-go/git/ref/tags/v5 --jq .object.sha (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-go/git/ref/tags/v5 --jq .object.sha ACCEPT (http block)
  • https://api.github.com/repos/actions/setup-go/git/ref/tags/v6
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-go/git/ref/tags/v6 --jq .object.sha /home/REDACTED/work/gh-aw/gh-aw/scratchpad/token-budget-guidelines.md /home/REDACTED/work/gh-aw/gh-aw/scratchpad/agent-container-testing.md /home/REDACTED/work/gh-aw/gh-aw/scratchpad/testing.md /home/REDACTED/work/gh-aw/gh-aw/scratchpad/safe-output-environment-variables.md /home/REDACTED/work/gh-aw/gh-aw/scratchpad/labels.md /home/REDACTED/work/gh-aw/gh-aw/scratchpad/ubuntulatest.md /home/REDACTED/work/gh-aw/gh-aw/scratchpad/engine-review-summary.md (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-go/git/ref/tags/v6 --jq .object.sha (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-go/git/ref/tags/v6 --jq .object.sha llector.slice (http block)
  • https://api.github.com/repos/actions/setup-node/git/ref/tags/v6
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v6 --jq .object.sha /home/REDACTED/work/gh-aw/gh-aw/scratchpad/token-budget-guidelines.md /home/REDACTED/work/gh-aw/gh-aw/scratchpad/agent-container-testing.md /home/REDACTED/work/gh-aw/gh-aw/scratchpad/testing.md /home/REDACTED/work/gh-aw/gh-aw/scratchpad/safe-output-environment-variables.md /home/REDACTED/work/gh-aw/gh-aw/scratchpad/labels.md /home/REDACTED/work/gh-aw/gh-aw/scratchpad/ubuntulatest.md /home/REDACTED/work/gh-aw/gh-aw/scratchpad/engine-review-summary.md (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v6 --jq .object.sha (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v6 --jq .object.sha .sh sh git ced successfullygit (http block)
  • https://api.github.com/repos/anchore/sbom-action/git/ref/tags/v0
    • Triggering command: /usr/bin/gh gh api /repos/anchore/sbom-action/git/ref/tags/v0 --jq .object.sha (http block)
  • https://api.github.com/repos/docker/build-push-action/git/ref/tags/v6
    • Triggering command: /usr/bin/gh gh api /repos/docker/build-push-action/git/ref/tags/v6 --jq .object.sha (http block)
    • Triggering command: /usr/bin/gh gh api /repos/docker/build-push-action/git/ref/tags/v6 --jq .object.sha .md .md md .md .md (http block)
  • https://api.github.com/repos/docker/login-action/git/ref/tags/v3
    • Triggering command: /usr/bin/gh gh api /repos/docker/login-action/git/ref/tags/v3 --jq .object.sha (http block)
    • Triggering command: /usr/bin/gh gh api /repos/docker/login-action/git/ref/tags/v3 --jq .object.sha .md .md md .md .md (http block)
  • https://api.github.com/repos/docker/metadata-action/git/ref/tags/v5
    • Triggering command: /usr/bin/gh gh api /repos/docker/metadata-action/git/ref/tags/v5 --jq .object.sha (http block)
    • Triggering command: /usr/bin/gh gh api /repos/docker/metadata-action/git/ref/tags/v5 --jq .object.sha .md .md md .md .md (http block)
  • https://api.github.com/repos/docker/setup-buildx-action/git/ref/tags/v3
    • Triggering command: /usr/bin/gh gh api /repos/docker/setup-buildx-action/git/ref/tags/v3 --jq .object.sha (http block)
    • Triggering command: /usr/bin/gh gh api /repos/docker/setup-buildx-action/git/ref/tags/v3 --jq .object.sha .md .md $name) { hasDiscussionsEnabled } } .md .md (http block)
  • https://api.github.com/repos/github/gh-aw/git/ref/tags/a70c5eada06553e3510ac27f2c3bda9d3705bccb
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/a70c5eada06553e3510ac27f2c3bda9d3705bccb --jq .object.sha (http block)
  • https://api.github.com/repos/githubnext/agentics/git/ref/tags/
    • Triggering command: /usr/bin/gh gh api /repos/githubnext/agentics/git/ref/tags/# --jq .object.sha (http block)

If you need me to access, download, or install something from one of these locations, you can either:

@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot make sure to configure the Gemini base url to point to the gateway url

…bled

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

Copilot AI commented Feb 20, 2026

Copy link
Copy Markdown
Contributor Author

@copilot make sure to configure the Gemini base url to point to the gateway url

Done in 34fca18 — when the firewall is enabled, GEMINI_API_BASE_URL=http://host.docker.internal:10003 is now set in the execution step env, routing Gemini CLI through the LLM gateway proxy. Also updated awf_helpers.go to ensure --enable-host-access is included whenever UsesAPIProxy is true (not just when MCP servers are present).

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:

  • https://api.github.com/graphql
    • Triggering command: /usr/bin/gh /usr/bin/gh api graphql -f query=query($owner: String!, $name: String!) { repository(owner: $owner, name: $name) { hasDiscussionsEnabled } } -f owner=github -f name=gh-aw (http block)
    • Triggering command: /usr/bin/gh /usr/bin/gh api graphql -f query=query($owner: String!, $name: String!) { repository(owner: $owner, name: $name) { hasDiscussionsEnabled } } -f owner=github -f name=gh-aw ithub/workflows/-atomic ithub/workflows/-bool ithub/workflows/-buildtags ithu�� ithub/workflows/-errorsas ithub/workflows/-ifaceassert ndor/bin/bash (http block)
    • Triggering command: /usr/bin/gh /usr/bin/gh api graphql -f query=query($owner: String!, $name: String!) { repository(owner: $owner, name: $name) { hasDiscussionsEnabled } } -f owner=github -f name=gh-aw ithub/workflows/-atomic ithub/workflows/-bool ithub/workflows/-buildtags ithu�� ithub/workflows/-errorsas ithub/workflows/-ifaceassert rgo/bin/grep (http block)
  • https://api.github.com/repos/actions/checkout/git/ref/tags/11bd71901bbe5b1630ceea73d27597364c9af683
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/11bd71901bbe5b1630ceea73d27597364c9af683 --jq .object.sha --noprofile (http block)
  • https://api.github.com/repos/actions/checkout/git/ref/tags/v6
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v6 --jq .object.sha k/gh-aw/gh-aw/scratchpad/validat-errorsas k/gh-aw/gh-aw/scratchpad/error-r-ifaceassert x_amd64/vet k/gh-aw/gh-aw/scgit k/gh-aw/gh-aw/sc-C k/gh-aw/gh-aw/sc/home/REDACTED/work/gh-aw/gh-aw/.github/workflows x_amd64/vet k/gh�� k/gh-aw/gh-aw/scratchpad/ubuntulatest.md k/gh-aw/gh-aw/scratchpad/engine-review-summary.md x_amd64/vet (http block)
  • https://api.github.com/repos/actions/github-script/git/ref/tags/v7
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v7 --jq .object.sha --noprofile (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v7 --jq .object.sha gateway\|base.ur-errorsas /home/REDACTED/wor-ifaceassert bash (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v7 --jq .object.sha k/gh-aw/gh-aw/scratchpad/ubuntul-errorsas k/gh-aw/gh-aw/scratchpad/engine--ifaceassert x_amd64/vet (http block)
  • https://api.github.com/repos/actions/setup-go/git/ref/tags/4dc6199c7b1a012772edbd06daecab0f50c9053c
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-go/git/ref/tags/4dc6199c7b1a012772edbd06daecab0f50c9053c --jq .object.sha k/gh-aw/gh-aw/scratchpad/ubuntulatest.md k/gh-aw/gh-aw/scratchpad/engine-review-summary.md $name) { hasDiscussionsEnabled } } (http block)
  • https://api.github.com/repos/actions/setup-go/git/ref/tags/v5
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-go/git/ref/tags/v5 --jq .object.sha url\|gateway\|AN-errorsas (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-go/git/ref/tags/v5 --jq .object.sha ithub/workflows/-errorsas ithub/workflows/-ifaceassert /snap/bin/bash (http block)
  • https://api.github.com/repos/actions/setup-go/git/ref/tags/v6
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-go/git/ref/tags/v6 --jq .object.sha gateway\|api-proxy\|api_proxy\|10001\|10002\|10003 k/gh-aw/gh-aw/pkg/constants/constants.go ndor/bin/bash (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-go/git/ref/tags/v6 --jq .object.sha ratchpad/ubuntulatest.md ratchpad/engine-review-summary.md cal/bin/grep (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-go/git/ref/tags/v6 --jq .object.sha ratchpad/ubuntulatest.md ratchpad/engine-review-summary.md rgo/bin/grep (http block)
  • https://api.github.com/repos/actions/setup-node/git/ref/tags/v6
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v6 --jq .object.sha |ANTHROPIC_BASE_URL\|GOOGLE_AI_BASE\|GEMINI_BASE\|generativelanguage\|googleapis.com k/gh-aw/gh-aw/.github/workflows/smoke-gemini.lock.yml rgo/bin/bash (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v6 --jq .object.sha ratchpad/ubuntul-errorsas ratchpad/engine--ifaceassert k/_temp/ghcca-no-nilfunc (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v6 --jq .object.sha --noprofile (http block)
  • https://api.github.com/repos/anchore/sbom-action/git/ref/tags/v0
    • Triggering command: /usr/bin/gh gh api /repos/anchore/sbom-action/git/ref/tags/v0 --jq .object.sha .*port\|enable-hremote.origin.url g/workflow/awf_h-c=4 $name) { hasDiscussionsEnabled } } (http block)
    • Triggering command: /usr/bin/gh gh api /repos/anchore/sbom-action/git/ref/tags/v0 --jq .object.sha k/gh-aw/gh-aw/sc-f k/gh-aw/gh-aw/scowner=github x_amd64/vet (http block)
  • https://api.github.com/repos/docker/build-push-action/git/ref/tags/v6
    • Triggering command: /usr/bin/gh gh api /repos/docker/build-push-action/git/ref/tags/v6 --jq .object.sha env\|BASE_URL\|g-c=4 /home/REDACTED/wor-nolocalimports $name) { hasDiscussionsEnabled } } (http block)
    • Triggering command: /usr/bin/gh gh api /repos/docker/build-push-action/git/ref/tags/v6 --jq .object.sha k/gh-aw/gh-aw/scratchpad/ubuntulatest.md k/gh-aw/gh-aw/scratchpad/engine-review-summary.md x_amd64/vet (http block)
  • https://api.github.com/repos/docker/login-action/git/ref/tags/v3
    • Triggering command: /usr/bin/gh gh api /repos/docker/login-action/git/ref/tags/v3 --jq .object.sha --noprofile (http block)
  • https://api.github.com/repos/docker/metadata-action/git/ref/tags/v5
    • Triggering command: /usr/bin/gh gh api /repos/docker/metadata-action/git/ref/tags/v5 --jq .object.sha api.proxy.*port\remote.origin.url g/workflow/ x_amd64/vet (http block)
    • Triggering command: /usr/bin/gh gh api /repos/docker/metadata-action/git/ref/tags/v5 --jq .object.sha k/gh-aw/gh-aw/scratchpad/ubuntulatest.md k/gh-aw/gh-aw/scratchpad/engine-review-summary.md x_amd64/vet (http block)
  • https://api.github.com/repos/docker/setup-buildx-action/git/ref/tags/v3
    • Triggering command: /usr/bin/gh gh api /repos/docker/setup-buildx-action/git/ref/tags/v3 --jq .object.sha --noprofile (http block)
    • Triggering command: /usr/bin/gh gh api /repos/docker/setup-buildx-action/git/ref/tags/v3 --jq .object.sha k/gh-aw/gh-aw/scratchpad/ubuntulatest.md k/gh-aw/gh-aw/scratchpad/engine-review-summary.md x_amd64/vet (http block)
  • https://api.github.com/repos/github/gh-aw/git/ref/tags/a70c5eada06553e3510ac27f2c3bda9d3705bccb
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/a70c5eada06553e3510ac27f2c3bda9d3705bccb --jq .object.sha --noprofile (http block)
  • https://api.github.com/repos/githubnext/agentics/git/ref/tags/
    • Triggering command: /usr/bin/gh gh api /repos/githubnext/agentics/git/ref/tags/# --jq .object.sha ithub/workflows/-errorsas ithub/workflows/-ifaceassert $name) { hasDiscussionsEnabled } } (http block)

If you need me to access, download, or install something from one of these locations, you can either:

@github-actions

Copy link
Copy Markdown
Contributor

🧪 Smoke Project is now testing project operations...

@github-actions

github-actions Bot commented Feb 20, 2026

Copy link
Copy Markdown
Contributor

✨ The prophecy is fulfilled... Smoke Codex has completed its mystical journey. The stars align. 🌟

@github-actions

Copy link
Copy Markdown
Contributor

📰 BREAKING: Smoke Copilot is now investigating this pull request. Sources say the story is developing...

@github-actions

github-actions Bot commented Feb 20, 2026

Copy link
Copy Markdown
Contributor

🎬 THE ENDSmoke Claude MISSION: ACCOMPLISHED! The hero saves the day! ✨

@github-actions

Copy link
Copy Markdown
Contributor

🧪 Smoke Temporary ID is now testing temporary ID functionality...

@github-actions

Copy link
Copy Markdown
Contributor

Smoke Project completed successfully. All project operations validated.

@github-actions

Copy link
Copy Markdown
Contributor

PR titles: #17285 update CentralRepoOps docs; #17280 feat: wildcard support for allowed-repos and standardize target-repo helpers
GitHub MCP: ✅
Serena MCP: ✅
Playwright: ✅
File write+cat: ✅
Build gh-aw: ✅
Overall: PASS

🔮 The oracle has spoken through Smoke Codex for issue #17245

@github-actions

Copy link
Copy Markdown
Contributor

Smoke Test Results [@pelikhan, @Copilot]

Test Status
GitHub MCP
Safe Inputs GH CLI
Serena MCP
Playwright
File Writing
Bash Tool
Discussion Interaction
Build gh-aw
Discussion Creation
Workflow Dispatch
PR Review

Overall: PASS (10/11)

📰 BREAKING: Report filed by Smoke Copilot for issue #17245

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Smoke test review pass. Minor observations: model pinning in smoke-gemini.md is a good practice, and the streaming JSON parser handles non-JSON lines gracefully. Changes look good overall.

📰 BREAKING: Report filed by Smoke Copilot for issue #17245

pull-requests: read
name: Smoke Gemini
engine: gemini
engine:

Copy link
Copy Markdown
Contributor

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.

}
if (typeof modelStats.output_tokens === "number") {
totalOutputTokens += modelStats.output_tokens;
}

Copy link
Copy Markdown
Contributor

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.

@github-actions

Copy link
Copy Markdown
Contributor

📰 VERDICT: Smoke Copilot has concluded. All systems operational. This is a developing story. 🎤

@pelikhan pelikhan marked this pull request as ready for review February 20, 2026 23:17
Copilot AI review requested due to automatic review settings February 20, 2026 23:17
@pelikhan pelikhan merged commit cad0c5d into main Feb 20, 2026
67 of 70 checks passed
@pelikhan pelikhan deleted the copilot/enable-support-llm-gateway branch February 20, 2026 23:17

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enables API proxy support for the Gemini engine and adds the missing log parser to fix smoke test failures. The changes bring Gemini's AWF integration in line with Claude and Codex patterns by properly configuring the LLM gateway proxy.

Changes:

  • Added --enable-api-proxy flag and GEMINI_API_BASE_URL environment variable to Gemini's AWF invocations when firewall is enabled
  • Created parse_gemini_log.cjs to parse Gemini's streaming JSON output format
  • Updated AWF helpers to enable host access for API proxy sidecars (not just MCP gateways)
  • Switched Gemini output format from json to stream-json for consistency with Claude
  • Updated smoke-gemini workflow to use gemini-2.0-flash-lite model

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
smoke_test_push_22239107636.txt Temporary test file for smoke test run validation
pkg/workflow/strict_mode_llm_gateway_test.go Added test case verifying Gemini uses port 10003 for LLM gateway
pkg/workflow/gemini_engine_test.go Updated assertions to verify stream-json output format and API proxy configuration
pkg/workflow/gemini_engine.go Enabled API proxy support with explicit variables, switched to stream-json output, and configured GEMINI_API_BASE_URL for firewall mode
pkg/workflow/enable_api_proxy_test.go Added test case verifying Gemini AWF command includes --enable-api-proxy flag
pkg/workflow/awf_helpers.go Extended --enable-host-access logic to support API proxy in addition to MCP servers
actions/setup/js/parse_gemini_log.cjs New log parser for Gemini's JSONL output format, extracting response text and token usage
.github/workflows/smoke-gemini.md Configured explicit model (gemini-2.0-flash-lite) in engine config
.github/workflows/smoke-gemini.lock.yml Regenerated workflow with API proxy enabled, stream-json output, model configuration, and GEMINI_API_BASE_URL

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

continue;
}

// Try to parse each line as a JSON object (Gemini --output-format json output)

Copilot AI Feb 20, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment incorrectly refers to "Gemini --output-format json output" but the code is actually parsing output from "--output-format stream-json" (as correctly stated in the docstring at line 14). This should be updated to match the actual output format being parsed.

Suggested change
// 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)

Copilot uses AI. Check for mistakes.
// 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")

Copilot AI Feb 20, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The log message "Added --enable-host-access for MCP gateway communication" is now potentially misleading since this block executes both when MCP servers are present AND when UsesAPIProxy is true (line 174). When --enable-host-access is added only for API proxy support (without MCP servers), the message incorrectly suggests it's for MCP gateway communication. Consider updating the message to reflect both use cases, such as "Added --enable-host-access for MCP gateway and/or API proxy communication".

Suggested change
awfHelpersLog.Print("Added --enable-host-access for MCP gateway communication")
awfHelpersLog.Print("Added --enable-host-access for MCP gateway and/or API proxy communication")

Copilot uses AI. Check for mistakes.
Comment on lines +1 to +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
*/
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 {
const parsed = JSON.parse(trimmed);

if (parsed.response) {
lastResponse = parsed.response;
}

// Aggregate token usage from stats
if (parsed.stats && parsed.stats.models) {
for (const modelStats of Object.values(parsed.stats.models)) {
if (modelStats && typeof modelStats === "object") {
if (typeof modelStats.input_tokens === "number") {
totalInputTokens += modelStats.input_tokens;
}
if (typeof modelStats.output_tokens === "number") {
totalOutputTokens += modelStats.output_tokens;
}
}
}
}
} catch (_e) {
// Not JSON - skip non-JSON lines
}
}

// Build markdown output
if (lastResponse) {
markdown += "## 🤖 Reasoning\n\n";
markdown += lastResponse + "\n\n";
}

markdown += "## 📊 Information\n\n";
const totalTokens = totalInputTokens + totalOutputTokens;
if (totalTokens > 0) {
markdown += `**Total Tokens Used:** ${totalTokens.toLocaleString()}\n\n`;
if (totalInputTokens > 0) {
markdown += `**Input Tokens:** ${totalInputTokens.toLocaleString()}\n\n`;
}
if (totalOutputTokens > 0) {
markdown += `**Output Tokens:** ${totalOutputTokens.toLocaleString()}\n\n`;
}
}

return {
markdown,
logEntries: [],
mcpFailures: [],
maxTurnsHit: false,
};
}

// Export for testing
if (typeof module !== "undefined" && module.exports) {
module.exports = {
main,
parseGeminiLog,
};
}

Copilot AI Feb 20, 2026

Copy link

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.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants