Skip to content

Remove GH_TOKEN from agentic-workflows MCP server config#14044

Merged
pelikhan merged 5 commits intomainfrom
copilot/debug-daily-firewall-logs
Feb 6, 2026
Merged

Remove GH_TOKEN from agentic-workflows MCP server config#14044
pelikhan merged 5 commits intomainfrom
copilot/debug-daily-firewall-logs

Conversation

Copy link
Contributor

Copilot AI commented Feb 6, 2026

The "Daily Firewall Logs Collector and Reporter" workflow was failing with "undefined environment variable referenced: GH_TOKEN" because the agentic-workflows MCP server configuration referenced ${GH_TOKEN}, but this variable wasn't being passed to the MCP gateway container.

Changes

Removed GH_TOKEN from agentic-workflows MCP config (mcp_config_builtin.go):

  • Removed GH_TOKEN environment variable reference from JSON config (line 169)
  • Removed GH_TOKEN from TOML config env_vars array (line 333)
  • Added clarifying comment that gh CLI auto-sets GH_TOKEN from GITHUB_TOKEN when needed

Recompiled all workflows:

  • All 145 workflow .lock.yml files updated to reflect the configuration change

Technical Context

The agentic-workflows MCP server's ExecGH() helper function (in pkg/workflow/github_cli.go) automatically handles the GH_TOKEN fallback:

ghToken := os.Getenv("GH_TOKEN")
githubToken := os.Getenv("GITHUB_TOKEN")
if ghToken == "" && githubToken != "" {
    cmd.Env = append(os.Environ(), "GH_TOKEN="+githubToken)
}

This means the MCP server only needs GITHUB_TOKEN in its configuration - it will automatically create GH_TOKEN from GITHUB_TOKEN when running gh CLI commands.

Before:

"env": {
  "DEBUG": "*",
  "GH_TOKEN": "\${GH_TOKEN}",
  "GITHUB_TOKEN": "\${GITHUB_TOKEN}"
}

After:

"env": {
  "DEBUG": "*",
  "GITHUB_TOKEN": "\${GITHUB_TOKEN}"
}

This is a minimal fix that removes the redundant environment variable reference, eliminating the "undefined environment variable" error without adding unnecessary complexity to the environment passing infrastructure.

Original prompt

This section details on the original issue you should resolve

<issue_title>[agentics] Daily Firewall Logs Collector and Reporter failed</issue_title>
<issue_description>### Workflow Failure

Workflow: Daily Firewall Logs Collector and Reporter
Branch: main
Run URL: https://github.com/github/gh-aw/actions/runs/21738341195

Action Required

Debug this workflow failure using the agentic-workflows agent:

/agent agentic-workflows

When prompted, instruct the agent to debug this workflow failure.

Generated from Daily Firewall Logs Collector and Reporter

  • expires on Feb 13, 2026, 4:11 AM UTC

Comments on the Issue (you are @copilot in this section)


💡 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.

…ironment

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

pelikhan commented Feb 6, 2026

@copilot remove GH_TOKEN frombtbe config

Copilot AI and others added 2 commits February 6, 2026 05:09
Add GH_TOKEN to MCP gateway environment variables to fix "undefined environment variable referenced: GH_TOKEN" error in workflows using agentic-workflows MCP server.

Changes:
- Add GH_TOKEN to mcp_environment.go with token cascading (GH_AW_GITHUB_MCP_SERVER_TOKEN || GH_AW_GITHUB_TOKEN || GITHUB_TOKEN)
- Add GH_TOKEN to standardEnvVars list in mcp_setup_generator.go to prevent duplicate addition
- Add GH_TOKEN to Docker container environment variables list with -e GH_TOKEN flag
- Rebuild binary and recompile all workflows to apply the fix

Fixes: Daily Firewall Logs Collector and Reporter workflow failure (run 21738341195)

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Update GH_TOKEN to use getEffectiveGitHubToken() which respects custom token and top-level github-token from frontmatter, ensuring proper token cascading and fixing TestAgenticWorkflowsInstallStepWithCustomToken test failure.

Changes:
- Use getEffectiveGitHubToken("", workflowData.GitHubToken) to get the effective token for GH_TOKEN
- This ensures custom tokens are respected when specified in workflow config
- Maintains backward compatibility with default token fallback

All tests pass, including TestAgenticWorkflowsInstallStepWithCustomToken.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Debug workflow failure for daily firewall logs collector Add GH_TOKEN environment variable for agentic-workflows MCP server Feb 6, 2026
Copilot AI requested a review from pelikhan February 6, 2026 05:23
Remove GH_TOKEN environment variable reference from agentic-workflows MCP server configuration. The MCP server's ExecGH() helper automatically sets GH_TOKEN from GITHUB_TOKEN when needed, so explicit GH_TOKEN reference is unnecessary.

This is a simpler fix than adding GH_TOKEN to the environment passing infrastructure - just remove the redundant reference from the config.

Addresses feedback from @pelikhan to remove GH_TOKEN from the config.

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

Copilot AI commented Feb 6, 2026

@copilot remove GH_TOKEN frombtbe config

Removed GH_TOKEN from the agentic-workflows MCP config in commit 2b094c0. The MCP server's ExecGH() helper automatically sets GH_TOKEN from GITHUB_TOKEN when needed, making the explicit reference unnecessary.

@pelikhan pelikhan added the smoke label Feb 6, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Feb 6, 2026

Changeset Generator failed. Please review the logs for details.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 6, 2026

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

@github-actions
Copy link
Contributor

github-actions bot commented Feb 6, 2026

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

@github-actions
Copy link
Contributor

github-actions bot commented Feb 6, 2026

🌑 The shadows whisper... Smoke Codex failed. The oracle requires further meditation...

Copilot AI changed the title Add GH_TOKEN environment variable for agentic-workflows MCP server Remove GH_TOKEN from agentic-workflows MCP server config Feb 6, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Feb 6, 2026

Agent Container Tool Check

Smoke test completed for PR #14044

Tool Status Version
bash 5.2.21
sh available
git 2.52.0
jq 1.7
yq 4.50.1
curl 8.5.0
gh 2.86.0
node 20.20.0
python3 3.12.3
go 1.24.12
java Cannot execute (container environment issue)
dotnet Cannot execute (container environment issue)

Result: 10/12 tools available ⚠️

Issues Found

Java & .NET Execution Problems:

  • Both Java and .NET binaries fail to execute properly in the container environment
  • Java: Missing shared library (libjli.so) despite being present in filesystem
  • .NET: "Cannot execute dotnet when renamed to bash" error
  • Both tools exist and are valid ELF executables but cannot run

This appears to be a container configuration issue rather than missing installations. All other development tools are working correctly.

AI generated by Agent Container Smoke Test

@github-actions
Copy link
Contributor

github-actions bot commented Feb 6, 2026

Smoke Test Results

PRs Tested:

Results:

  • ✅ GitHub MCP Testing
  • ✅ Safe Inputs GH CLI Testing
  • ❌ Serena MCP Testing (EOF error)
  • ✅ Playwright Testing
  • ✅ File Writing Testing
  • ✅ Bash Tool Testing
  • ✅ Discussion Interaction Testing
  • ✅ Build gh-aw
  • ✅ Workflow Dispatch Testing

Status: ⚠️ PARTIAL PASS (8/9 tests)

@pelikhan

AI generated by Smoke Copilot

@github-actions
Copy link
Contributor

github-actions bot commented Feb 6, 2026

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

@pelikhan pelikhan marked this pull request as ready for review February 6, 2026 05:40
Copilot AI review requested due to automatic review settings February 6, 2026 05:40
@pelikhan pelikhan merged commit d456834 into main Feb 6, 2026
165 of 168 checks passed
@pelikhan pelikhan deleted the copilot/debug-daily-firewall-logs branch February 6, 2026 05:42
Copy link
Contributor

Copilot AI left a comment

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 removes the redundant GH_TOKEN environment variable reference from the agentic-workflows MCP server configuration, resolving workflow failures caused by undefined environment variables. The fix leverages the existing automatic fallback mechanism in the ExecGH() helper function that sets GH_TOKEN from GITHUB_TOKEN when needed.

Changes:

  • Removed redundant GH_TOKEN environment variable from agentic-workflows MCP server config
  • Added clarifying comment explaining the automatic GH_TOKEN fallback behavior
  • Recompiled all 145 workflow lock files to reflect the configuration change

Reviewed changes

Copilot reviewed 146 out of 146 changed files in this pull request and generated no comments.

File Description
pkg/workflow/mcp_config_builtin.go Removed GH_TOKEN from environment variables array (line 169) and TOML env_vars array (line 333), added explanatory comment about automatic fallback
.github/workflows/*.lock.yml All 145 workflow lock files recompiled to reflect the configuration change, including addition of MCP_GATEWAY_PAYLOAD_DIR setup and payloadDir in gateway config

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[agentics] Daily Firewall Logs Collector and Reporter failed

2 participants