Repository navigation
fix(core): replace all case variants when overlaying headers - #8111
Elon-Jiang wants to merge 1 commit into
Conversation
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Overlay behavior and tests packages/core/src/core/header-source.ts, packages/core/src/__tests__/core-runtime-fetch-headers.test.ts |
The overlay removes all matching header-name variants before assigning core values, except when a matching content-type or accept header already exists. Tests cover casing, preservation, input representation, and runtime request IDs. |
Priority:
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix
Suggested reviewers: jpr5
Merge Risk: 
Minimal · up to a03a8
-
The change removes stale header-name variants while preserving request-owned protocol headers. No merge-blocking issue is identified; merge after normal checks pass.
Pre-merge checks: 
5
-
Full details: Docstring Coverage
-
Explanation
Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 1 functions across 2 files.
-
Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands.
What does this PR do?
Fix case-insensitive replacement in
ɵoverlayCoreHeadersfor record and tuple-list inputs. If an agent supplies bothx-request-idandX-Request-Id, overlaying the core value currently leaves one stale spelling behind. NativeHeadersthen combines the stale and current values (agent-one, core-current) instead of sending onlycore-current.The initial key lookup also becomes stale when the core map contains multiple spellings of a header. Resolve all matching spellings from the current output before each replacement, so record/tuple inputs agree with the existing
Headersbranch. Preserve request-ownedContent-Type/Accept, output behavior, unrelated headers and input immutability.Add parameterized regressions across all three input forms and a
CopilotKitCore.ɵruntimeFetchintegration regression. Against unchanged production code, the targeted file has 11 failures / 17 passes; with the fix it has 28 passes.Related PRs and Issues
Source-discovered bug; no existing issue found. Checked current main, file history, header-related issues/PRs, and file lists for open PRs targeting main before preparing this change.
Validation
pnpm nx run @copilotkit/core:test --excludeTaskDependencies --skipNxCache: 1,552 tests passed.pnpm nx run @copilotkit/core:check-types --excludeTaskDependencies --skipNxCache: passed.agent-one, core-currentbefore the fix and onlycore-currentafter it.oxlint: passed, 0 warnings/errors.oxfmt --check: passed.publint,attw, lint and commitlint.Validation uses an isolated local dependency environment satisfying the affected package manifests (Node 24, Nx 22.7.5, Vitest 3.2.6, TypeScript 5.8.2), with local learning/shared dependencies built. This is package-scoped validation, not a whole-monorepo test run. AI-assisted preparation; the reported checks were executed locally.
Checklist
Summary by CodeRabbit
Content-Type,Accept, and unrelated request headers remain preserved.