Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 18, 2025

Problem

The Copilot CLI log parser was not extracting tool information from the new debug log format introduced in v0.0.343. This resulted in an empty "Available Tools" section in workflow step summaries, even though tools were being used successfully.

Example from workflow run 18608814247:

**Available Tools:**



## 🤖 Reasoning

The tools section was empty despite 54 tools being available and used during execution.

Root Cause

The new Copilot CLI uses a different debug log format where tools are logged in a [DEBUG] Tools: section with OpenAI function format:

2025-10-18T01:34:55.407Z [DEBUG] Tools:
2025-10-18T01:34:55.412Z [DEBUG] [
  {
    "type": "function",
    "function": {
      "name": "bash",
      "description": "Runs a Bash command..."
    }
  },
  {
    "type": "function",
    "function": {
      "name": "github-create_issue",
      "description": "Creates a GitHub issue"
    }
  }
]

The existing parseDebugLogFormat function was creating an empty tools array as a placeholder instead of extracting the actual tool definitions.

Solution

Updated pkg/workflow/js/parse_copilot_log.cjs to:

  1. Locate the tools section: Find the [DEBUG] Tools: marker and parse the subsequent JSON array
  2. Parse OpenAI function format: Extract tool names from { "type": "function", "function": { "name": "..." } } objects
  3. Normalize tool names: Convert github-* names to mcp__github__* format for consistency, while preserving safe_outputs-* names
  4. Display tools: Pass extracted tools to the init entry so they're displayed in the summary

Changes

pkg/workflow/js/parse_copilot_log.cjs

  • Added tools extraction logic in parseDebugLogFormat function
  • Handles multi-line JSON arrays with [DEBUG] prefixes
  • Converts tool names to internal MCP format
  • Updated init entry to use extracted tools instead of empty array

pkg/workflow/js/parse_copilot_log.test.cjs

  • Added comprehensive test for debug log format with tools extraction
  • Validates tool extraction, name conversion, and display formatting
  • Confirms tool categorization works correctly

Results

Before:

**Available Tools:**

After:

**Available Tools:**
- **Git/GitHub:** 47 tools
  - github::download_workflow_run_artifact, github::get_code_scanning_alert, github::get_commit, and 44 more
- **Other:** 7 tools
  - bash, write_bash, read_bash, and 4 more

Testing

  • ✅ All 535 JavaScript tests pass
  • ✅ All Go unit tests pass
  • ✅ Validated with actual workflow run logs showing 54 tools extracted correctly
  • ✅ Code review completed with no issues in modified files
Original prompt

Analyze the new copilot log format and update the JavaScript parser as needed

Here is a run https://github.com/githubnext/gh-aw/actions/runs/18608814247/job/53063216260


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Copilot AI and others added 3 commits October 18, 2025 01:49
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Update JavaScript parser for new copilot log format Fix Copilot CLI log parser to extract and display tools from new debug format Oct 18, 2025
Copilot AI requested a review from pelikhan October 18, 2025 01:58
@pelikhan pelikhan marked this pull request as ready for review October 18, 2025 03:37
@github-actions
Copy link
Contributor

Agentic Changeset Generator triggered by this pull request.

@pelikhan pelikhan merged commit 2881a33 into main Oct 18, 2025
4 checks passed
@pelikhan pelikhan deleted the copilot/update-js-parser-log-format branch October 18, 2025 03:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants