Skip to content

Render gateway.log in MCP gateway step summary and stop gateway after execution#9509

Merged
pelikhan merged 5 commits into
mainfrom
copilot/render-gateway-log-file
Jan 10, 2026
Merged

Render gateway.log in MCP gateway step summary and stop gateway after execution#9509
pelikhan merged 5 commits into
mainfrom
copilot/render-gateway-log-file

Conversation

Copilot AI commented Jan 10, 2026

Copy link
Copy Markdown
Contributor

The MCP gateway log parser only rendered stderr.log to the step summary, missing operational logs from gateway.log. Additionally, the gateway process was not being stopped after agent execution.

Changes

  • parse_mcp_gateway_log.cjs: Read both log files, generate separate collapsible sections for each
  • parse_mcp_gateway_log.test.cjs: Updated tests to verify dual-log handling, single-log scenarios, and content preservation
  • stop_mcp_gateway.sh (NEW): Shell script to gracefully stop the MCP gateway process using its PID from step output
  • start_mcp_gateway.sh: Modified to output gateway PID via $GITHUB_OUTPUT instead of writing to file
  • mcp_servers.go: Renamed step from "Setup MCPs" to "Start MCP gateway" and added step ID start-mcp-gateway
  • compiler_yaml_ai_execution.go: Added generateStopMCPGateway() function to generate the stop gateway step
  • compiler_yaml_main_job.go: Inserted stop gateway step after agent execution, before secret redaction
  • Test files: Updated all references from "Setup MCPs" to "Start MCP gateway"

Result

Step summary now displays both:

  • gateway.log - Gateway operational logs (startup, server lifecycle)
  • stderr.log - Debug output and errors

Each section renders only if the log file exists and has content.

Gateway cleanup:

  • Gateway process is stopped after agent execution completes
  • Uses GitHub Actions step output (steps.start-mcp-gateway.outputs.gateway-pid) instead of PID file
  • Graceful shutdown with SIGTERM (5 second timeout), then SIGKILL if needed
  • Runs with continue-on-error: true to prevent workflow failures
  • Positioned before secret redaction step for proper cleanup order
  • Step renamed from "Setup MCPs" to "Start MCP gateway" for clarity
Original prompt

The step that renders the gateway logs to the step summary should also render the gateway log file , not just stderr.

Audit smoke-claude on main to find the filename


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

- Updated parse_mcp_gateway_log.cjs to read both gateway.log and stderr.log files
- Modified generateGatewayLogSummary to handle two log sources with separate sections
- Updated tests to validate both log file rendering
- Each log file gets its own collapsible details section in the step summary

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Render gateway log file to step summary Render gateway.log in MCP gateway step summary Jan 10, 2026
Copilot AI requested a review from pelikhan January 10, 2026 07:58
@pelikhan pelikhan added the smoke label Jan 10, 2026
@github-actions

github-actions Bot commented Jan 10, 2026

Copy link
Copy Markdown
Contributor

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

@github-actions

github-actions Bot commented Jan 10, 2026

Copy link
Copy Markdown
Contributor

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

@github-actions

github-actions Bot commented Jan 10, 2026

Copy link
Copy Markdown
Contributor

💫 TO BE CONTINUED... Smoke Claude failed! Our hero faces unexpected challenges...

@github-actions

github-actions Bot commented Jan 10, 2026

Copy link
Copy Markdown
Contributor

🎉 Yo ho ho! Changeset Generator found the treasure and completed successfully! ⚓💰

@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot use the PID of the gateway to stop the gateway process after the agent engine execution step, before secret redaction step.

- Created stop_mcp_gateway.sh script to stop the gateway using its PID
- Added generateStopMCPGateway() function to compiler_yaml_ai_execution.go
- Inserted stop gateway step after agent execution, before secret redaction
- The step runs with continue-on-error: true to prevent workflow failure if gateway is already stopped
- Gateway PID is read from /tmp/gh-aw/mcp-logs/gateway/gateway.pid

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

Copilot AI commented Jan 10, 2026

Copy link
Copy Markdown
Contributor Author

@copilot use the PID of the gateway to stop the gateway process after the agent engine execution step, before secret redaction step.

Added in 41988fd. The MCP gateway is now stopped after agent execution and before secret redaction.

The stop step:

  • Reads the gateway PID from /tmp/gh-aw/mcp-logs/gateway/gateway.pid
  • Attempts graceful shutdown with SIGTERM (waits up to 5 seconds)
  • Forces termination with SIGKILL if needed
  • Runs with continue-on-error: true to prevent workflow failure
  • Executes via new stop_mcp_gateway.sh script

Copilot AI changed the title Render gateway.log in MCP gateway step summary Render gateway.log in MCP gateway step summary and stop gateway after execution Jan 10, 2026
@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot you do not need a PID file, use a action step output to store the gateway PID

Rename "Setup MCPs" step to "Start MCP gateway"

- Renamed "Setup MCPs" step to "Start MCP gateway" for clarity
- Added step ID "start-mcp-gateway" to capture output
- Modified start_mcp_gateway.sh to output PID via GITHUB_OUTPUT instead of file
- Updated stop_mcp_gateway.sh to read PID from command argument (step output)
- Modified generateStopMCPGateway to pass PID from step output reference
- Updated all test files and comments to use new step name

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

Copilot AI commented Jan 10, 2026

Copy link
Copy Markdown
Contributor Author

@copilot you do not need a PID file, use a action step output to store the gateway PID

Rename "Setup MCPs" step to "Start MCP gateway"

Completed in 4994748:

  1. Step renamed: "Setup MCPs" → "Start MCP gateway"
  2. PID via step output: Gateway PID is now stored using $GITHUB_OUTPUT and accessed via steps.start-mcp-gateway.outputs.gateway-pid
  3. No PID file: Removed file-based PID storage
  4. Updated stop script: Reads PID from command argument instead of file

The stop step now references: ${{ steps.start-mcp-gateway.outputs.gateway-pid }}

@github-actions

github-actions Bot commented Jan 10, 2026

Copy link
Copy Markdown
Contributor

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

@github-actions

github-actions Bot commented Jan 10, 2026

Copy link
Copy Markdown
Contributor

💫 TO BE CONTINUED... Smoke Claude failed! Our hero faces unexpected challenges...

@github-actions

github-actions Bot commented Jan 10, 2026

Copy link
Copy Markdown
Contributor

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

@github-actions

github-actions Bot commented Jan 10, 2026

Copy link
Copy Markdown
Contributor

🎉 Yo ho ho! Changeset Generator found the treasure and completed successfully! ⚓💰

@pelikhan pelikhan added smoke and removed smoke labels Jan 10, 2026
@github-actions

github-actions Bot commented Jan 10, 2026

Copy link
Copy Markdown
Contributor

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

@github-actions

github-actions Bot commented Jan 10, 2026

Copy link
Copy Markdown
Contributor

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

@github-actions

github-actions Bot commented Jan 10, 2026

Copy link
Copy Markdown
Contributor

💫 TO BE CONTINUED... Smoke Claude failed! Our hero faces unexpected challenges...

@github-actions

github-actions Bot commented Jan 10, 2026

Copy link
Copy Markdown
Contributor

🎉 Yo ho ho! Changeset Generator found the treasure and completed successfully! ⚓💰

@pelikhan
pelikhan marked this pull request as ready for review January 10, 2026 16:41
@pelikhan
pelikhan merged commit bd83c89 into main Jan 10, 2026
80 of 81 checks passed
@pelikhan
pelikhan deleted the copilot/render-gateway-log-file branch January 10, 2026 16:41
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.

2 participants