Skip to content

[aw-failures] [aw-fix] Make writeStepSummaryWithTokenUsage async before awaiting summary.write() (PR #43170 module-load SyntaxError) #43201

Description

@github-actions

Parent: #43200

Make writeStepSummaryWithTokenUsage async before awaiting summary.write() — the current PR #43170 edit is a module-load SyntaxError.

Problem statement

PR #43170 added await coreObj.summary.write(); at actions/setup/js/parse_mcp_gateway_log.cjs:236, inside the non-async function writeStepSummaryWithTokenUsage(coreObj) (declared line 204). await in a non-async function is a SyntaxError, so the module throws at require() time and every consumer crashes before running.

Affected workflows & run IDs

Both the agent "Parse MCP Gateway logs for step summary" step and the conclusion "Handle agent failure" step fail (the latter requires the module at handle_agent_failure.cjs:18). Confined to PR #43170's merge ref; main is clean.

Probable root cause

The new require-await-core-summary-write autofix (or a manual application of it) inserted await at a call site whose enclosing function is not async. The PR's own spec says the suggestion should be "only offered when inside an async function" — that guard did not cover this hand-applied fix in parse_mcp_gateway_log.cjs.

Proposed remediation

  1. In actions/setup/js/parse_mcp_gateway_log.cjs: mark writeStepSummaryWithTokenUsage(coreObj) as async function, then await it at its call site inside async function main(). (Simplest alternative: drop the erroneous await on line 236 — but making the helper async is the correct fix consistent with the rule's intent.)
  2. Recompile lock files so the fix propagates to .github/workflows/*.lock.yml.
  3. Harden the ESLint rule's autofix in eslint-factory/src/rules/require-await-core-summary-write.ts so it never inserts await when the nearest enclosing function is not async (verify the existing non-async-no-suggestion test actually blocks the fixer, not just the suggestion).
  4. Add a CI build gate that require()s each generated .cjs (or runs node --check) to catch module-load SyntaxErrors before merge.

Success criteria / verification

Generated by 🔍 [aw] Failure Investigator (6h) · 155.9 AIC · ⌖ 40.9 AIC · ⊞ 5.2K ·

  • expires on Jul 10, 2026, 5:31 AM UTC-08:00

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions