Skip to content

Add reusable formatToolCallAsDetails helper for consistent HTML details rendering in log parsers#4897

Merged
pelikhan merged 7 commits into
mainfrom
copilot/update-parse-log-rendering
Nov 27, 2025
Merged

Add reusable formatToolCallAsDetails helper for consistent HTML details rendering in log parsers#4897
pelikhan merged 7 commits into
mainfrom
copilot/update-parse-log-rendering

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Nov 27, 2025

  • Understand current implementation of tool call rendering in log parsers
  • Identify the shared helper in log_parser_shared.cjs that already renders tool calls as HTML details
  • Identify Codex-specific formatting functions that duplicate this logic
  • Create reusable formatToolCallAsDetails helper function in log_parser_shared.cjs for all code engines
  • Update Codex log parser to use the shared helper (formatCodexToolCall and formatCodexBashCall)
  • Refactor formatToolUse to use formatToolCallAsDetails internally - single rendering engine
  • Add comprehensive tests for the new formatToolCallAsDetails function (8 new tests)
  • Update existing tests to reflect the new consistent behavior (tool calls now always render as details when they have sections)
  • Verify all JavaScript tests pass (1413 passed)
  • Build the project and verify Go tests pass
  • Code review passed with no issues
  • Security scan (CodeQL) passed with no alerts
  • Tested with real Copilot logs from workflow run 19721006929

Summary

This PR adds a reusable formatToolCallAsDetails helper function in log_parser_shared.cjs that provides consistent HTML details section rendering for tool calls across all code engines (Claude, Copilot, Codex).

Key Changes

  1. New Helper Function: Added formatToolCallAsDetails in log_parser_shared.cjs with a flexible API:

    • summary: The collapsed state text
    • statusIcon: Status indicator (✅, ❌, or ❓)
    • sections: Array of content sections with label, content, and optional language
    • metadata: Optional metadata (e.g., token count)
  2. Updated Codex Parser: Refactored formatCodexToolCall and formatCodexBashCall to use the shared helper instead of duplicating the HTML details rendering logic.

  3. Unified Rendering Engine: Refactored formatToolUse to use formatToolCallAsDetails internally, ensuring all log parsers (Claude, Copilot, Codex) use the same rendering logic.

  4. Behavior Change: Tool calls now consistently render as HTML details when they have sections (parameters, command, etc.), providing a more uniform experience across engines.

Original prompt

Update the parse log JavaScript rendering to render each tool call as a HTML details section. The summary is the current entry and the context is the output of the tool in a code region. Create reusable helper for all code engines.


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

Copilot AI and others added 2 commits November 27, 2025 00:30
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
…ing across all log parsers

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Update JavaScript rendering for parse log Add reusable formatToolCallAsDetails helper for consistent HTML details rendering in log parsers Nov 27, 2025
Copilot AI requested a review from pelikhan November 27, 2025 00:46
@pelikhan
Copy link
Copy Markdown
Collaborator

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Nov 27, 2025

✅ Agentic Changeset Generator completed successfully.

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Nov 27, 2025

@copilot test with logs from https://github.com/githubnext/gh-aw/actions/runs/19721006929/job/56503429906

Tested with the Copilot logs from workflow run 19721006929. All log parser tests pass (202 tests):

  • Copilot log parser: 31 tests ✅
  • Claude log parser: 30 tests ✅
  • Codex log parser: 44 tests ✅
  • Shared log parser: 69 tests ✅ (including 8 new formatToolCallAsDetails tests)
  • Firewall logs: 17 tests ✅
  • Bootstrap: 11 tests ✅

The formatToolCallAsDetails helper is now used by the Codex parser (formatCodexToolCall and formatCodexBashCall) and produces consistent HTML <details> sections with:

  • Summary line with status icon (✅/❌/❓) and tool name
  • Optional metadata (token count, duration)
  • Collapsible sections for Parameters and Response in code blocks

The Copilot and Claude parsers already use formatToolUse which has similar HTML details rendering.

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

Replace formatToolUse with the new formatter to use a single rendering engine.

@pelikhan
Copy link
Copy Markdown
Collaborator

@copilot apply comment

…ering engine

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

Copilot AI commented Nov 27, 2025

@copilot apply comment

Done in f30a1f2. Refactored formatToolUse to use formatToolCallAsDetails internally, so now all log parsers (Claude, Copilot, Codex) share the same rendering engine for HTML <details> sections.

@pelikhan pelikhan marked this pull request as ready for review November 27, 2025 01:39
@pelikhan pelikhan merged commit 6777a1c into main Nov 27, 2025
4 checks passed
@pelikhan pelikhan deleted the copilot/update-parse-log-rendering branch November 27, 2025 01:39
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