Skip to content

[eslint-miner] Add require-http-response-error-listener rule #54475

Closed

Description

@github-actions

Summary

New net-new ESLint rule for eslint-factory: require-http-response-error-listener.

Evidence: recurring gap in actions/setup/js

Scanning actions/setup/js for raw http/https request usage found 4 call sites using the http.request(...) / http.get(...) / https.request(...) / https.get(...) response-callback pattern:

  • mcp_cli_bridge.cjs — http.request, response callback attaches res.on("data", ...) / res.on("end", ...) but no res.on("error", ...)
  • mount_mcp_as_cli.cjs — same pattern, no response error listener
  • start_mcp_gateway.cjs — same pattern, no response error listener
  • handle_agent_failure.cjs — the one site that does correctly attach res.on("error", reject) in addition to req.on("error", reject)

3 of 4 sites are missing the response-level error listener. Node emits 'error' on the IncomingMessage itself (not the request) for socket-level failures that occur while the body is being streamed — reset connections, decompression failures, aborted sockets. req.on("error", ...) alone does not catch these; an unhandled 'error' event on the response is an uncaught exception that crashes the action. The one correct site (handle_agent_failure.cjs) shows this is a known, intentional pattern that simply isn't enforced anywhere, so new call sites (like the 3 found) silently drop it.

What the rule does

For http.request / http.get / https.request / https.get calls where the module identifier is bound via const http = require("http") (or https/node:http/node:https), flags the response callback if it never calls <response>.on("error", ...) / .once("error", ...) anywhere in its body.

  • Low false-positive risk: only fires when the http/https module binding is statically resolved via a top-level require(...) call with a literal "http"/"https"/"node:http"/"node:https" argument; other module aliasing (e.g. require("./my-http-helper.cjs") bound to a variable named http) is correctly excluded (verified in tests).
  • Out of scope: fetch-based HTTP calls (already covered by existing require-fetch-try-catch/require-fetch-timeout rules), and non-standard http client libraries.

Live validation against actions/setup/js

Ran npm run lint:setup-js with the new rule enabled — it surfaces exactly 3 real instances (mcp_cli_bridge.cjs:240, mount_mcp_as_cli.cjs:245, start_mcp_gateway.cjs:323), with no other findings, and correctly stays silent on the one already-compliant site in handle_agent_failure.cjs.

Validation

  • cd eslint-factory && npm install
  • cd eslint-factory && npm run build — passes
  • cd eslint-factory && npx vitest run — 624/624 tests pass (including 5 new tests + updated README/rule-count parity test)
  • cd eslint-factory && npm run lint:setup-js — 0 errors, 168 warnings (previously 165 + 3 new real findings)

Files changed

  • eslint-factory/src/rules/require-http-response-error-listener.ts (new rule)
  • eslint-factory/src/rules/require-http-response-error-listener.test.ts (new tests)
  • eslint-factory/src/index.ts (register rule)
  • eslint-factory/eslint.config.cjs (enable rule as warn)
  • eslint-factory/README.md (document rule)

Warning

Protected Files — Push Permission Denied

This was originally intended as a pull request, but the patch modifies protected files. A human must create the pull request manually.

Protected files
  • README.md

The push was rejected because GitHub Actions does not have workflows permission to push these changes, and is never allowed to make such changes, or other authorization being used does not have this permission.

Create the pull request manually
# Download the patch from the workflow run
gh run download 32465337489 -n agent -D /tmp/agent-32465337489

# Create a new branch
git checkout -b eslint-miner/require-http-response-error-listener-1787302975-ee5ab98301a82239 main

# Apply the patch (--3way handles cross-repo patches)
git am --3way /tmp/agent-32465337489/aw-eslint-miner-require-http-response-error-listener-1787302975.patch

# Push the branch and create the pull request
git push origin eslint-miner/require-http-response-error-listener-1787302975-ee5ab98301a82239
gh pr create --title '[eslint-miner] Add require-http-response-error-listener rule' --base main --head eslint-miner/require-http-response-error-listener-1787302975-ee5ab98301a82239 --repo github/gh-aw

Generated by ESLint Miner · auto · 121.8 AIC · ⌖ 12 AIC · ⊞ 6.8K · ◷

  • expires on Aug 28, 2026, 1:06 AM UTC-08:00

Activity

  1. github-actions commented on Aug 21, 2026

    @github-actions
    ContributorAuthor

    🍪 Issue Monster selected this for Copilot

    I've identified this issue as a good candidate for automated resolution and requested assignment to the Copilot coding agent.

    If assignment succeeds, the Copilot coding agent will analyze the issue and create a pull request with the fix.

    Om nom nom! 🍪

    🍪 Om nom nom by Issue Monster · gpt54 · 9.44 AIC · ⌖ 10.1 AIC · ⊞ 12.3K · ◷

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