Skip to content

Refactor engine log parsing to canonical Copilot event format#38781

Open
Copilot wants to merge 5 commits into
mainfrom
copilot/refactor-log-parser-js
Open

Refactor engine log parsing to canonical Copilot event format#38781
Copilot wants to merge 5 commits into
mainfrom
copilot/refactor-log-parser-js

Conversation

Copilot AI commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

This change makes the Copilot event log schema the canonical parser output across engine parsers and aligns rendering on that schema. Copilot session events.jsonl inputs now pass through without conversion, while legacy Claude/Codex/Gemini/Pi/Antigravity shapes are normalized to Copilot events.

  • Canonical event schema adoption

    • Added shared helpers to detect Copilot event logs and convert between legacy trace entries and Copilot event entries.
    • Standardized parser outputs on event types like session.init, assistant.message, tool.execution_start, tool.execution_complete, and session.result.
  • Renderer compatibility via normalization

    • Updated shared formatter/render paths to normalize event logs into renderer-friendly structures internally.
    • Preserved existing summary/markdown output behavior while changing upstream parser output contracts.
  • Parser refactors by engine

    • Updated Claude, Codex, Gemini, Pi, and Antigravity parsers to emit canonical Copilot event entries.
    • Updated Copilot parser to retain event-format inputs as-is and only synthesize missing session.result metadata when absent.
  • Bootstrap/model metadata alignment

    • Updated bootstrap summary model extraction to support both legacy init entries and canonical session.init entries.
  • Test updates

    • Updated parser tests to assert event-format logEntries and event-based metadata access patterns.
const canonicalLogEntries = isEventFormat
  ? logEntries
  : convertLegacyLogEntriesToCopilotEvents(logEntries, { sourceEngine: "claude" });

const conversationResult = generateConversationMarkdown(canonicalLogEntries, {
  formatToolCallback: (toolUse, toolResult) => formatToolUse(toolUse, toolResult, { includeDetailedParameters: false }),
  formatInitCallback: initEntry => formatInitializationSummary(initEntry, { includeSlashCommands: true }),
});

Copilot AI and others added 4 commits June 12, 2026 04:44
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>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title Refactor log parsing to Copilot event format and renderer normalization Refactor engine log parsing to canonical Copilot event format Jun 12, 2026
Copilot AI requested a review from pelikhan June 12, 2026 05:08
@pelikhan pelikhan marked this pull request as ready for review June 12, 2026 14:03
Copilot AI review requested due to automatic review settings June 12, 2026 14:03

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This pull request standardizes engine log parser outputs on a canonical Copilot “event” schema, and updates shared rendering/summary code paths to accept those canonical entries (normalizing internally as needed). It also adjusts the compiled Copilot smoke workflow to use $HOME-based Copilot config paths.

Changes:

  • Introduces shared helpers to detect Copilot event logs and convert between legacy trace entries and canonical Copilot event entries.
  • Refactors multiple engine parsers/tests to emit and assert against canonical event entries (e.g., session.init, assistant.message, tool.execution_*, session.result).
  • Updates the compiled Copilot smoke workflow to avoid hardcoded /home/runner paths and to set Copilot config env paths via $HOME.
Show a summary per file
File Description
pkg/workflow/action_resolver.go Fixes/cleans up error handling when resolving gh-aw refs via gh api.
actions/setup/js/parse_pi_log.cjs Converts Pi legacy entries to canonical Copilot event entries before rendering/returning.
actions/setup/js/parse_gemini_log.cjs Converts Gemini legacy entries to canonical Copilot event entries before rendering/returning.
actions/setup/js/parse_custom_log.test.cjs Loosens assertions to match updated “Custom Engine Log” rendering expectations.
actions/setup/js/parse_copilot_log.test.cjs Updates tests to validate canonical session.result data shape (numTurns, etc.).
actions/setup/js/parse_copilot_log.cjs Treats event-format inputs as canonical, converts legacy to events, and normalizes for rendering/information sections.
actions/setup/js/parse_codex_log.test.cjs Updates Codex tests to assert tool.execution_* and session.init events.
actions/setup/js/parse_codex_log.cjs Converts Codex legacy entries to canonical Copilot event entries for logEntries output.
actions/setup/js/parse_claude_log.cjs Converts Claude legacy entries to canonical Copilot event entries for logEntries output and rendering.
actions/setup/js/parse_antigravity_log.test.cjs Updates Antigravity tests to assert presence of assistant.message events.
actions/setup/js/parse_antigravity_log.cjs Converts Antigravity legacy entries to canonical Copilot event entries before returning.
actions/setup/js/log_parser_shared.cjs Adds event-format detection + bidirectional legacy↔event conversion helpers and exports them.
actions/setup/js/log_parser_format.cjs Normalizes event entries to legacy trace shape internally for rendering and summaries.
actions/setup/js/log_parser_bootstrap.cjs Allows model extraction from either legacy init or canonical session.init.
.github/workflows/smoke-copilot-aoai-entra.lock.yml Switches Copilot config paths to $HOME and adjusts env exports accordingly.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 14/15 changed files
  • Comments generated: 1

Comment on lines 200 to 203
// Add Information section
const lastEntry = logEntries[logEntries.length - 1];
const initEntry = logEntries.find(entry => entry.type === "system" && entry.subtype === "init");
const lastEntry = legacyRenderEntries[legacyRenderEntries.length - 1];
const initEntry = legacyRenderEntries.find(entry => entry.type === "system" && entry.subtype === "init");

@github-actions

github-actions Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Test Quality Sentinel failed to deliver outputs during test quality analysis.

@github-actions

github-actions Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Design Decision Gate 🏗️ completed the design decision gate check.

No ADR enforcement needed: PR #38781 does not have the implementation label (has_implementation_label=false) and has only 8 new lines of code in business logic directories, below the 100-line threshold (requires_adr_by_default_volume=false).

@github-actions github-actions Bot mentioned this pull request Jun 12, 2026
@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot run pr-finisher skill

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ Test Quality Sentinel: 73/100. Test quality is acceptable — 15.8% of modified tests are implementation tests (threshold: 30%). The 3 flagged tests are false positives where only the test accessor was refactored; all behavioral assertions remain intact. No coding-guideline violations detected.

…ver.go

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

Copilot AI commented Jun 12, 2026

Copy link
Copy Markdown
Contributor Author

@copilot run pr-finisher skill

Done. Removed the unused initEntry variable from parse_copilot_log.cjs and also fixed a pre-existing perfsprint lint error in pkg/workflow/action_resolver.go (needed for make agent-report-progress to pass). Commit: Remove unused initEntry variable; fix perfsprint lint in action_resolver.go.

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.

3 participants