Repository navigation
[PR] fix: discard header edits from failed egress plugins - #6608
Merged
ranxianglei merged 1 commit intoNov 14, 2026
Merged
Conversation
Owner
|
Superseded by #6677 (merged as Landed into master via the real merge commit The fix for #6607 is now in master. Closing this PR as superseded — thanks for the careful, well-tested fix. |
This was referenced Nov 17, 2026
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.
Fixes #6607
Problem
An egress plugin can change the live request headers and then throw, time out or return an invalid body. The runner skips its result but leaves those partial edits in the request and in the next plugin's input. A timed-out plugin can also resume later and change headers after the pipeline has returned.
A real HTTP regression uses an actual local ESM plugin that overwrites the test credential and then throws. On unchanged master, the upstream behind
startServerreceives the rejected placeholder credential and the client gets 401. With this change, the original working credential is preserved and the same request returns 200.Change
Give each matching plugin a private writable header draft. Commit successful direct edits back into the original live map before merging the returned header patch. Discard drafts on throw, timeout or invalid body, so late writes from a timed-out task stay isolated.
Successful direct mutation remains supported, including undefined/null returns and deletion of fields. The caller retains the original header-map object. Only header state is isolated; Buffer/body handling, plugin-task cancellation, timeout duration, ordering, signing and configuration are unchanged. Unconfigured and unmatched plugins remain no-ops.
Validation
egress-header-isolation,egress-transformsandissue5688-egress-wiring.npm run typecheck,npm run build,npm run check:unused-exports,npm run check:test-import-graphandgit diff --checkpass.Baseline:
e1f31ad9d5b47500362699a9867819b861c7de96(0.1.213); Node v24.22.1; repository test/storage preloads. Full-suite validation remains with hosted CI on this head.Prior work
All-state egress/mutate/timeout/rollback searches and contributor history found no existing isolation fix. #6068 introduced the pipeline; its failure cases do not modify headers. #6606 fixes returned-header name replacement. This PR keeps that merge loop intact and addresses a different failure boundary.
Suggested triage:
bug,p2,scope/wiring; Topic N — server-side miscellaneous.