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
- 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.)
- Recompile lock files so the fix propagates to
.github/workflows/*.lock.yml.
- 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).
- 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 · ◷
Parent: #43200
Make
writeStepSummaryWithTokenUsageasync before awaitingsummary.write()— the current PR #43170 edit is a module-loadSyntaxError.Problem statement
PR #43170 added
await coreObj.summary.write();atactions/setup/js/parse_mcp_gateway_log.cjs:236, inside the non-asyncfunctionwriteStepSummaryWithTokenUsage(coreObj)(declared line 204).awaitin a non-async function is aSyntaxError, so the module throws atrequire()time and every consumer crashes before running.Affected workflows & run IDs
Both the
agent"Parse MCP Gateway logs for step summary" step and theconclusion"Handle agent failure" step fail (the latterrequires the module athandle_agent_failure.cjs:18). Confined to PR #43170's merge ref;mainis clean.Probable root cause
The new
require-await-core-summary-writeautofix (or a manual application of it) insertedawaitat a call site whose enclosing function is notasync. The PR's own spec says the suggestion should be "only offered when inside anasyncfunction" — that guard did not cover this hand-applied fix inparse_mcp_gateway_log.cjs.Proposed remediation
actions/setup/js/parse_mcp_gateway_log.cjs: markwriteStepSummaryWithTokenUsage(coreObj)asasync function, thenawaitit at its call site insideasync function main(). (Simplest alternative: drop the erroneousawaiton line 236 — but making the helper async is the correct fix consistent with the rule's intent.).github/workflows/*.lock.yml.eslint-factory/src/rules/require-await-core-summary-write.tsso it never insertsawaitwhen the nearest enclosing function is notasync(verify the existing non-async-no-suggestion test actually blocks the fixer, not just the suggestion).require()s each generated.cjs(or runsnode --check) to catch module-loadSyntaxErrors before merge.Success criteria / verification
node --check actions/setup/js/parse_mcp_gateway_log.cjspasses;require('./parse_mcp_gateway_log.cjs')loads without throwing.awaitis inserted in a non-async scope.node --checkgate over generated.cjsis green and would have caught this diff.Related to [aw-failures] [aw-fix] Module-load SyntaxError in parse_mcp_gateway_log.cjs — PR #43170 added
awaitinside non-async writeStep [Content truncated due to length] #43200