Conversation
… server The safe outputs MCP server generates URLs for uploaded assets using GITHUB_REPOSITORY and GITHUB_SERVER_URL environment variables. However, these standard GitHub Actions environment variables were not being passed through to the MCP server environment, causing URLs to use the fallback placeholder 'owner/repo' instead of the actual repository. This fix adds GITHUB_REPOSITORY and GITHUB_SERVER_URL to the MCP server environment configuration in renderSafeOutputsMCPConfigWithOptions for all engines (Copilot, Claude/Custom, and Codex). Changes: - Added GITHUB_REPOSITORY passthrough in JSON format (Copilot/Claude) - Added GITHUB_SERVER_URL passthrough in JSON format (Copilot/Claude) - Added both variables to TOML format (Codex) Impact: - Image URLs will now correctly reference the actual repository - URLs will point to valid raw GitHub content locations - No breaking changes - these are standard GitHub Actions vars Fixes: githubnext/gh-aw#2913
🔍 Smoke Test Investigation - Run #18988214642SummaryThe Smoke Codex workflow is failing with a TOML parse error caused by JSON-escaped quotes in the MCP configuration. This is a known recurring pattern (CODEX_TOML_JSON_ESCAPING) that has affected multiple runs. Failure Details
Root Cause AnalysisPrimary Error (line 1007 in smoke-codex.lock.yml): env = { "GH_AW_SAFE_OUTPUTS" = "/tmp/gh-aw/safeoutputs/outputs.jsonl", "GH_AW_SAFE_OUTPUTS_CONFIG" = "{\"create_issue\":{\"max\":1},\"missing_tool\":{}}", "GH_AW_ASSETS_BRANCH" = "", "GH_AW_ASSETS_MAX_SIZE_KB" = "", "GH_AW_ASSETS_ALLOWED_EXTS" = "" }
^
missing comma between key-value pairs, expected `,`The Problem: When
The outer quotes from the TOML value + inner escaped quotes from JSON = invalid TOML syntax. The TOML parser sees conflicting quotes and fails at column 109. Investigation FindingsThis is a KNOWN PATTERN: From cache Pattern: CODEX_TOML_JSON_ESCAPING
Root Cause:
TOML inline table syntax + JSON string values + shell substitution =
Quote escaping complexity that creates invalid TOML syntax.
Occurrences:
- Run 18975512058 (2025-10-31 (redacted)) - toJSON() double-escaping
- Run 18977321431 (2025-10-31 (redacted)) - Shell variable double-quoting
- Run 18988214642 (2025-11-01 (redacted)) - THIS FAILUREWhy This Happens After This PR: The workflow compiler generates TOML inline tables with GitHub Actions expressions like Failed Jobs and Errors
Error Location: `/tmp/gh-aw/agent-stdio.(redacted) Recommended ActionsCritical Priority - Permanent Fix
Alternative Workaround (if file-based not feasible immediately):
Prevention Strategies
Historical ContextThis pattern was previously documented and posted to PR #2871 (Fix template injection vulnerabilities). The security fix in that PR moved from GitHub expressions to shell variables, which uncovered this TOML escaping issue. Related Issues/PRs:
Technical DetailsCurrent Generated TOML (broken): [mcp_servers.safeoutputs]
command = "node"
args = ["/tmp/gh-aw/safeoutputs/mcp-server.cjs"]
env = { "GH_AW_SAFE_OUTPUTS" = "/tmp/gh-aw/safeoutputs/outputs.jsonl", "GH_AW_SAFE_OUTPUTS_CONFIG" = "{\"create_issue\":{\"max\":1},\"missing_tool\":{}}", ... }Proposed File-Based Approach (fix): # Setup step writes config file
- name: Write MCP Config
run: |
cat > /tmp/gh-aw/mcp-config/config.toml << 'EOF'
[mcp_servers.safeoutputs]
command = "node"
args = ["/tmp/gh-aw/safeoutputs/mcp-server.cjs"]
[mcp_servers.safeoutputs.env]
GH_AW_SAFE_OUTPUTS = "/tmp/gh-aw/safeoutputs/outputs.jsonl"
GH_AW_SAFE_OUTPUTS_CONFIG = '{"create_issue":{"max":1},"missing_tool":{}}'
EOF
# Agent step references file
- name: Run Codex
run: codex --config /tmp/gh-aw/mcp-config/config.toml ...Investigation Pattern ID: CODEX_TOML_JSON_ESCAPING Status: ⏳ Awaiting permanent fix implementation (file-based config approach)
|
Q Workflow Optimization Report
Issue Found (from investigation)
Safe Outputs MCP Server - Image URL Generation
@pelikhanvia /q command in discussion 📊 Data Visualization Report - Random Sample Data #2913pkg/workflow/js/safe_outputs_mcp_server.cjs(lines 419-420)Problem Identified
Image URLs generated by the safe outputs MCP server for uploaded assets were using "owner/repo" as a placeholder instead of the actual repository "githubnext/gh-aw".
Root Cause:
The safe outputs MCP server code correctly falls back to "owner/repo" when
GITHUB_REPOSITORYenvironment variable is not set:However, the MCP server environment configuration in
renderSafeOutputsMCPConfigWithOptions(pkg/workflow/mcp-config.go) was not passing through these standard GitHub Actions environment variables.Variables Missing from MCP Environment:
GITHUB_REPOSITORY- The repository in "owner/repo" formatGITHUB_SERVER_URL- The GitHub server URL (defaults to https://github.com)Changes Made
Modified File:
pkg/workflow/mcp-config.goChange 1: Added environment variables to renderSafeOutputsMCPConfigWithOptions (lines 107-124)
Added
GITHUB_REPOSITORYandGITHUB_SERVER_URLto the MCP server environment configuration:For Copilot (with passthrough syntax):
For Claude/Custom (direct env var reference):
Change 2: Added environment variables to TOML format (line 215)
Updated
renderSafeOutputsMCPConfigTOMLfor Codex engine:Expected Improvements
✅ Fixed Placeholder URLs: Image URLs will correctly use the actual repository instead of "owner/repo" placeholder
✅ Valid Content Links: URLs will point to valid raw GitHub content locations
✅ No Breaking Changes: These are standard GitHub Actions environment variables automatically available in all workflows
✅ Cross-Engine Support: Fix applies to all engines (Copilot, Claude/Custom, and Codex)
Technical Details
Why This Fix Works:
GITHUB_REPOSITORYandGITHUB_SERVER_URLare standard GitHub Actions environment variables\\${VAR}for Copilot,$VARfor Claude) correctly references these from the shell environmentTesting Strategy:
upload_assetssafe output will test URL generationReferences
/tmp/gh-aw/cache-memory/q-image-url-investigation.mdpkg/workflow/js/safe_outputs_mcp_server.cjspkg/workflow/mcp-config.goRelated Issue: #2913