← Back to PRs

#8467: fix(github-copilot): add configurable IDE headers + fix null filtering

by ericchansen open 2026-02-04 02:31 View on GitHub →
agents stale
## Summary Enhanced fix for HTTP 421 Misdirected Request errors on GitHub Copilot Enterprise accounts. This PR addresses feedback from @greptile-apps on #8457. ## Changes from #8457 This PR includes all changes from #8457 plus: ### 1. Configurable IDE Headers (addresses P3 feedback) The Copilot IDE headers are now configurable via `models.providers["github-copilot"].headers`: ```json { "models": { "providers": { "github-copilot": { "headers": { "Editor-Version": "vscode/1.120.0", "X-Custom-Header": "custom-value" } } } } } ``` - Default headers are still applied automatically (no config needed for most users) - Users can override specific headers or add custom ones - Useful if GitHub changes validation rules in the future ### 2. Fix extraParamsOverride null filtering (addresses P1 feedback) The `extraParamsOverride` filtering now removes both `undefined` AND `null` values: ```typescript // Before: only filtered undefined .filter(([, value]) => value !== undefined) // After: filters both null and undefined .filter(([, value]) => value !== undefined && value !== null) ``` This prevents callers from accidentally overriding config params with `null` values from JSON/CLI/config merges. ## Testing - [x] All existing tests pass - [x] New test: config headers override default Copilot headers - [x] New test: null values filtered from extraParamsOverride ## References - Fixes #1797 - Addresses review feedback from #8457 - Thanks @at10ti0n for the original issue report <!-- greptile_comment --> <h2>Greptile Overview</h2> <h3>Greptile Summary</h3> This PR extends the embedded runner’s provider-specific request customization: - Adds a GitHub Copilot stream wrapper that injects required IDE headers to address HTTP 421 errors on some Enterprise accounts, with optional overrides via `models.providers["github-copilot"].headers`. - Updates `extraParamsOverride` merging to filter out both `undefined` and `null` so JSON/CLI merges don’t accidentally clobber configured params. - Adds Vitest coverage for Copilot header injection/override behavior and for null/undefined filtering. The changes are isolated to `src/agents/pi-embedded-runner/extra-params.ts` and integrate via the existing `applyExtraParamsToAgent` hook used by the embedded runner attempt flow. <h3>Confidence Score: 5/5</h3> - This PR is safe to merge with minimal risk. - Logic changes are small and well-scoped, header merge order is intentional (caller headers win), and added tests cover the new behaviors including config overrides and null/undefined filtering. - No files require special attention. <!-- greptile_other_comments_section --> <sub>(3/5) Reply to the agent's comments like "Can you suggest a fix for this @greptileai?" or ask follow-up questions!</sub> <!-- /greptile_comment -->

Most Similar PRs