Repository navigation
fix: destroy non-200 responses so their sockets close - #42
Merged
Merged
Conversation
|
Hey @dany74q - thanks for the report and the contrib! Your changes look good to me and I will kick off the rest of the CI to make sure things are passing.
|
joker23
approved these changes
Sep 28, 2026
tanderson-ld
added a commit
that referenced
this pull request
Sep 29, 2026
…ions (#43) ## What Adds an explicit `permissions:` block (`contents: write`, `pull-requests: write`) to the `release-please` job in `.github/workflows/release-please.yml`. ## Why release-please has failed on every push to `main` since 2026-09-23 (the runs for #38, #40, #42), all with the same error: ``` POST /repos/launchdarkly/js-eventsource/git/refs → 403 "Resource not accessible by integration" (x-accepted-github-permissions: contents=write) ✖ Error when creating branch release-please failed: Error creating Pull Request: Resource not accessible by integration ``` The `release-please` job passes `token: ${{secrets.GITHUB_TOKEN}}` but had **no `permissions:` block**, so it inherited the repository's *default* `GITHUB_TOKEN` permissions. It worked for every release through 2.2.0 (Apr 2025) because that default was read-write; it broke once the default was tightened to read-only, which removed the write access the job needs to create the release branch/PR. The workflow file itself has not changed since 2024-04-26 — only the environment did. (The lone "success" on 2026-09-23 was a `chore:` push, which release-please treats as non-release-worthy, so it never reached the branch-creation step. The next release-worthy commits — #38, #40, #42 — all hit the 403.) ## Fix Grant the two write scopes explicitly on the job that needs them, so the workflow no longer depends on the repo default. This brings the job to parity with the js-core monorepo's `release-please` job, which already sets `contents: write` + `pull-requests: write` explicitly and continues to run successfully under the same `GITHUB_TOKEN`. ## Effect Once merged, the push to `main` re-runs release-please with the corrected permissions and it will open the pending release PR (covering the currently-unreleased #38, #40, #42), which on merge publishes the next version. ## Notes / possible follow-ups (intentionally not in this PR) - If the org has *also* disabled "Allow GitHub Actions to create and approve pull requests," a later run could 403 on the PR-create step (a separate setting from token scope). That setting was clearly enabled through the 2.2.0 release, so it is likely still fine. - The action reference here (`google-github-actions/release-please-action@v4`) is the old org name on a floating tag; js-core uses the renamed `googleapis/release-please-action` pinned to a SHA. Modernizing it is optional and left out to keep this fix focused. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Overview** > **Fixes release-please 403 failures** by giving the `release-please` job explicit `GITHUB_TOKEN` scopes instead of relying on the repo default (which was tightened to read-only). > > The job now declares `contents: write` and `pull-requests: write` so it can create the release branch/tag and open or update the release PR. The downstream `release-package` job already had these permissions; only `release-please` was missing them, which caused `Resource not accessible by integration` on recent pushes to `main`. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 97f01e5. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->
tanderson-ld
pushed a commit
that referenced
this pull request
Sep 29, 2026
🤖 I have created a release *beep* *boop* --- ## [2.3.0](2.2.0...2.3.0) (2026-09-29) ### Features * allow a custom retry delay strategy to be provided ([#40](#40)) ([dd081f0](dd081f0)) ### Bug Fixes * anchor retry backoff reset to the first event of each connection ([#38](#38)) ([9d46860](9d46860)) * destroy non-200 responses so their sockets close ([c0ba67c](c0ba67c)) * destroy non-200 responses so their sockets close ([#42](#42)) ([988a7b3](988a7b3)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Overview** > This PR **bumps the package to 2.3.0** via Release Please: `package.json`, `.release-please-manifest.json`, and a new **2.3.0** section in `CHANGELOG.md`. > > There are **no runtime or library code changes** in the diff itself. The changelog records what ships in this tag: **custom `retryDelayStrategy`** for reconnect timing, **retry backoff reset tied to the first event on each connection**, and **destroying non-200 HTTP responses** so underlying sockets close cleanly. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit ebf94e0. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
Overview
Fixes a connection leak when the server returns redirects or non-200 HTTP responses: the client now calls
res.destroy()on those responses before following redirects or surfacing errors, so the underlying socket is torn down instead of staying open (notably when using a keep-alivehttp.Agent).Tests add a keep-alive agent helper and assert the server socket closes for 301/307 redirects and for error statuses 301, 307, 401, and 503.
Reviewed by Cursor Bugbot for commit c0ba67c. Bugbot is set up for automated code reviews on this repo. Configure here.