Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 13, 2026

The MCP gateway log parser was only printing file existence and size metadata without showing actual file contents, making it difficult to diagnose gateway startup issues and errors.

Changes

  • Added printAllGatewayFiles() function that scans /tmp/gh-aw/mcp-logs, printing file contents (limited to 10KB per file) to core.info with clear delimiters
  • Updated main() to call printAllGatewayFiles() at start before processing gateway.md/gateway.log
  • Added proper TypeScript error handling using unknown type annotations for catch blocks
  • Added test coverage for missing directories, empty directories, multiple files with content, and file truncation behavior
  • File size limit: Files larger than 10KB are truncated with "..." and show a truncation message indicating bytes displayed and total size

Output Format

Small files (under 10KB):

=== Listing All Gateway-Related Files ===

Directory: /tmp/gh-aw/mcp-logs
  gateway.log (57 bytes)
    --- Content of gateway.log ---
    Gateway started on port 8080
    --- End of gateway.log ---
  gateway.md (42 bytes)
    --- Content of gateway.md ---
    # Gateway Summary
    
    All systems operational
    --- End of gateway.md ---
  stderr.log (37 bytes)
    --- Content of stderr.log ---
    Debug: Server initialization complete
    --- End of stderr.log ---

=== End of Gateway-Related Files ===

Large files (over 10KB):

  large.log (15001 bytes)
    --- Content of large.log ---
    [first 10240 bytes of content]
    ...
    (truncated, showing first 10240 bytes of 15001 total)
    --- End of large.log ---

This provides visibility into gateway logs for debugging workflow failures while:

  • Excluding sensitive configuration data (/tmp/gh-aw/mcp-config is not scanned)
  • Preventing excessive log output by limiting content to 10KB per file
Original prompt

Reference: https://github.com/githubnext/gh-aw/actions/runs/20956944415/job/60229334495#step:39:1

Print all the gateway related files to core.info in the print MCP gateway script


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

- Added printAllGatewayFiles() function to list and print all files in /tmp/gh-aw/mcp-logs and /tmp/gh-aw/mcp-config
- Function prints directory structure, file sizes, and file contents (up to 1MB)
- Updated main() to call printAllGatewayFiles() at the start for comprehensive debugging
- Added comprehensive tests for the new function
- Properly handles TypeScript error types with unknown type annotations
- All tests passing and code formatted

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Print all gateway related files in MCP gateway script Print all gateway files to core.info in parse_mcp_gateway_log.cjs Jan 13, 2026
Copilot AI requested a review from pelikhan January 13, 2026 13:58
Copy link
Contributor

@pelikhan pelikhan left a comment

Choose a reason for hiding this comment

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

@copilot do not render config folder

@pelikhan
Copy link
Contributor

@copilot

  • do not scan tmp/gh-aw/mcp-config
  • limit text to 10kb per file then ...

- Modified printAllGatewayFiles() to only scan /tmp/gh-aw/mcp-logs
- Removed /tmp/gh-aw/mcp-config from scanned directories
- Updated tests to reflect that only logs directory is rendered
- All 19 tests passing

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

Copilot AI commented Jan 13, 2026

@copilot do not render config folder

Done. The config directory is now excluded from the output. Only /tmp/gh-aw/mcp-logs is scanned and printed to core.info.

Fixed in commit 804c8fd.

Updated output now shows only the logs directory:

=== Listing All Gateway-Related Files ===

Directory: /tmp/gh-aw/mcp-logs
  gateway.log (57 bytes)
    --- Content of gateway.log ---
    Gateway started on port 8080
    Request handled: GET /health
    --- End of gateway.log ---
  ...

=== End of Gateway-Related Files ===

The /tmp/gh-aw/mcp-config directory and its files (gateway-output.json, config.toml, etc.) are no longer included in the output.

Copilot AI changed the title Print all gateway files to core.info in parse_mcp_gateway_log.cjs Print gateway log files to core.info in parse_mcp_gateway_log.cjs Jan 13, 2026
Copilot AI requested a review from pelikhan January 13, 2026 14:06
@pelikhan pelikhan added the smoke label Jan 13, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Jan 13, 2026

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

@github-actions
Copy link
Contributor

github-actions bot commented Jan 13, 2026

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

@github-actions
Copy link
Contributor

github-actions bot commented Jan 13, 2026

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

@github-actions
Copy link
Contributor

github-actions bot commented Jan 13, 2026

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

@pelikhan
Copy link
Contributor

Keep the output style simple; filename and content. No indentation, no headers...

- Modified printAllGatewayFiles() to truncate file content at 10KB
- Files larger than 10KB now show first 10KB followed by "..." and truncation message
- Added test for truncation behavior with 15KB file
- Config directory already excluded (no change needed)
- All 20 tests passing

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

Copilot AI commented Jan 13, 2026

@copilot

  • do not scan tmp/gh-aw/mcp-config...

Done. Both requirements implemented:

  1. Config directory not scanned - /tmp/gh-aw/mcp-config is excluded (already done in previous commit)
  2. 10KB limit per file - Files are now truncated at 10KB with "..." indicator

Fixed in commit 5e7ce3b.

Example output for large file:

  large.log (15001 bytes)
    --- Content of large.log ---
    [first 10240 bytes of content...]
    ...
    (truncated, showing first 10240 bytes of 15001 total)
    --- End of large.log ---

Example output for small file:

  gateway.log (57 bytes)
    --- Content of gateway.log ---
    Gateway started on port 8080
    Request handled: GET /health
    --- End of gateway.log ---

Files under 10KB are shown in full. Files over 10KB show the first 10KB followed by "..." and a truncation message indicating the total size.

@github-actions
Copy link
Contributor

Smoke Test Results (Run #20959774089)

Last 2 Merged PRs:

  • docs: add org-owned repository instructions for COPILOT_GITHUB_TOKEN
  • Track timeout events in gateway log metrics

Test Results:

  • ✅ GitHub MCP (PR retrieval)
  • ✅ Bash tool (file creation/read)
  • ✅ Playwright (GitHub.com navigation - title: "GitHub · Change is constant. GitHub keeps you ahead. · GitHub")
  • ✅ File writing (/tmp/gh-aw/agent/smoke-test-copilot-20959774089.txt)

Overall Status: PASS

cc @pelikhan

AI generated by Smoke Copilot

@github-actions
Copy link
Contributor

Smoke Test Results

Last 2 Merged PRs:

Test Results:

  • ✅ GitHub MCP (fetched PRs successfully)
  • ✅ Serena Go (initialized project)
  • ✅ Playwright (navigated to GitHub, title verified)
  • ✅ Web Search (10 results for "GitHub Agentic Workflows")
  • ✅ File Write (created test file)
  • ✅ Bash (verified file content)

Overall: PASS

AI generated by Smoke Claude

@pelikhan pelikhan marked this pull request as ready for review January 13, 2026 14:35
@pelikhan pelikhan merged commit f5a16a1 into main Jan 13, 2026
@pelikhan pelikhan deleted the copilot/print-gateway-related-files branch January 13, 2026 14:36
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.

2 participants