Skip to content

fix(tests): clear GITHUB_RUN_ID/GH_AW_WORKFLOW_ID in messages.test.cjs beforeEach#17857

Merged
pelikhan merged 2 commits intomainfrom
copilot/fix-ci-failure-messages-test
Feb 23, 2026
Merged

fix(tests): clear GITHUB_RUN_ID/GH_AW_WORKFLOW_ID in messages.test.cjs beforeEach#17857
pelikhan merged 2 commits intomainfrom
copilot/fix-ci-failure-messages-test

Conversation

Copy link
Contributor

Copilot AI commented Feb 23, 2026

generateXMLMarker now appends id: <GITHUB_RUN_ID> (and workflow_id: <GH_AW_WORKFLOW_ID> when set) to the XML marker. The messages.test.cjs beforeEach didn't clear these env vars, so every strict toBe assertion on marker strings failed in CI where GITHUB_RUN_ID is always present.

Changes

  • messages.test.cjs: Add delete process.env.GITHUB_RUN_ID and delete process.env.GH_AW_WORKFLOW_ID to beforeEach — matching the pattern already established in generate_footer.test.cjs.

Before the fix, CI produced:

AssertionError: expected
  '<!-- gh-aw-agentic-workflow: Test Workflow, id: 22296273341, run: ... -->'
to be
  '<!-- gh-aw-agentic-workflow: Test Workflow, run: ... -->'
Original prompt

This section details on the original issue you should resolve

<issue_title>[CI Failure Doctor] CI Failure Investigation - Run #37485</issue_title>
<issue_description>### CI Failure Investigation - Run github/gh-aw#37485

Summary

The js job in run 22296273341 fails because actions/setup/js/messages.test.cjs still asserts XML markers without the id metadata that generateXMLMarker now appends from GITHUB_RUN_ID.

Failure Details

Root Cause Analysis

generateXMLMarker reads GITHUB_RUN_ID and always inserts an id: (run-id) segment (plus workflow_id when that env var is present). The unit tests in messages.test.cjs still expect strings that omit that extra field, so every AssertionError compares the literal string without id: against the actual string that contains id: 22296273341 (and variants that also include engine metadata/ tracker ids).

Failed Jobs and Errors

  • js (cd actions/setup/js && npm test) fails while executing messages.test.cjs.
    • Matching error: AssertionError: expected '' to be ''.
    • The same mismatch recurs for the four additional XML marker tests that add engine metadata or tracker IDs.
Investigation Findings
  • Five generateXMLMarker assertions now fail because the runtime output gained an id: attribute sourced from GITHUB_RUN_ID.
  • The job is run with GITHUB_RUN_ID, so the generated marker now always contains id: 22296273341 regardless of other metadata.
  • Reproduce locally by running cd actions/setup/js && npm ci && npm test (same commands executed in the CI job).

Recommended Actions

  • Update generateXMLMarker’s unit tests (and any literal footer fixtures) to expect the id metadata, or adjust the implementation so tests can opt out of including id in the marker string.

Prevention Strategies

Always refresh literal string expectations (messages.test.cjs, generate_footer.test.cjs, etc.) whenever new GH_AW_* or GITHUB_* metadata fields are added to generateXMLMarker so the test harness matches production behavior.

AI Team Self-Improvement

Note in future instructions that adding new metadata to generateXMLMarker requires revisiting the XML marker tests to include the new fields.

Historical Context

No existing [CI Failure Doctor] issue targets run github/gh-aw#37485; previous investigations have covered other build or validation regressions but not this JS test mismatch.

🩺 Diagnosis provided by CI Failure Doctor

To install this workflow, run gh aw add githubnext/agentics/workflows/ci-doctor.md@ea350161ad5dcc9624cf510f134c6a9e39a6f94d. View source at https://github.com/githubnext/agentics/tree/ea350161ad5dcc9624cf510f134c6a9e39a6f94d/workflows/ci-doctor.md.

  • expires on Feb 24, 2026, 7:19 AM UTC

Comments on the Issue (you are @copilot in this section)


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

…eforeEach

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix CI failure in messages.test.cjs unit tests fix(tests): clear GITHUB_RUN_ID/GH_AW_WORKFLOW_ID in messages.test.cjs beforeEach Feb 23, 2026
@pelikhan pelikhan marked this pull request as ready for review February 23, 2026 07:32
Copilot AI review requested due to automatic review settings February 23, 2026 07:32
@pelikhan pelikhan merged commit d06df78 into main Feb 23, 2026
1 check passed
@pelikhan pelikhan deleted the copilot/fix-ci-failure-messages-test branch February 23, 2026 07:32
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes CI-only test failures caused by GITHUB_RUN_ID (and optionally GH_AW_WORKFLOW_ID) being present in GitHub Actions, which changes the output of generateXMLMarker and breaks strict string assertions in messages.test.cjs.

Changes:

  • Clear process.env.GITHUB_RUN_ID and process.env.GH_AW_WORKFLOW_ID in messages.test.cjs beforeEach to keep XML marker expectations stable across local and CI runs.

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

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.

[CI Failure Doctor] CI Failure Investigation - Run #37485

3 participants