Repository navigation
refactor(sse): stop three executors shadowing BaseExecutor.buildHeaders - #8498
Merged
diegosouzapw merged 1 commit intoJul 26, 2026
Conversation
backryun
force-pushed
the
chore/ts7-types-executor-overrides
branch
2 times, most recently
from
July 25, 2026 08:26
a4af19a to
250f04b
Compare
`BaseExecutor.buildHeaders(credentials, stream?, clientHeaders?, model?, health?)` was shadowed in three executors by same-named helpers with unrelated signatures: hailuo-web private buildHeaders(token: string, yy: string) lmarena protected buildHeaders(_model: string, credentials: unknown, _body: unknown) qwen-web private buildHeaders(token: string, cookieHeader: string, chatId?: string) Name collisions, not overrides — each reported TS2416. They are renamed to `buildStreamHeaders` / `buildRequestHeaders` / `buildApiHeaders`; the two lmarena test files that called the helper directly are updated with them. Worth stating precisely, because the shadow sat on a live dispatch path without being a live bug: `BaseExecutor.countTokens()` calls `this.buildHeaders(credentials, false)`, and all three inherit `countTokens()`. It is unreachable today only because `buildCountTokensUrl()` returns null unless `config.format === "claude"` and the URL carries `/messages` — hailuo-web and qwen-web set no format, lmarena sets `"openai"` — so `countTokens()` returns at the guard above. Latent, not live; one `format` change away from passing a credentials object where a token string is expected. Two more, surfaced by clearing the above: * `lmarena` declared `buildUrl` and `transformRequest` `protected` while both are public on BaseExecutor (TS2415 — a subclass may widen visibility, never narrow it). Both were masked behind the buildHeaders TS2416 and appeared one at a time as it cleared. Runtime is unaffected; JavaScript has no member visibility. * `GithubExecutor.refreshCredentials` had no declared return type, so TypeScript inferred the union of its four literal returns. `GheCopilotExecutor` legitimately overrides it with a wider `providerSpecificData` (it also records the enterprise proxy URL) and no `expiresIn`, which is not assignable to that inferred union. Declared as `RefreshedCopilotCredentials | null` — same shape of fix as cheaper-inference#8489, on a different method. Validation: full tsc error-set diff against the base config — 335 -> 331, zero new errors (line-number-agnostic). `typecheck:core` clean; the 15 existing test files importing a touched executor pass, including lmarena's 44 across the two updated files. `plan3-p0.test.ts` fails identically with and without this change (it reads the developer's real ~/.omniroute DB rather than a test-scoped DATA_DIR). The new test pins that the inherited method is no longer shadowed — verified to fail on the base, where all three prototypes still carry their own `buildHeaders` — and that the `countTokens()` early return which kept it harmless still holds.
backryun
force-pushed
the
chore/ts7-types-executor-overrides
branch
from
July 25, 2026 21:08
250f04b to
f0025d0
Compare
diegosouzapw
merged commit Jul 26, 2026
06326a3
into
cheaper-inference:release/v3.8.49
5 checks passed
Collaborator
|
Thanks @backryun — merged into |
Merged
HouMinXi
pushed a commit
to HouMinXi/OmniRoute
that referenced
this pull request
Aug 2, 2026
…rs (cheaper-inference#8498) `BaseExecutor.buildHeaders(credentials, stream?, clientHeaders?, model?, health?)` was shadowed in three executors by same-named helpers with unrelated signatures: hailuo-web private buildHeaders(token: string, yy: string) lmarena protected buildHeaders(_model: string, credentials: unknown, _body: unknown) qwen-web private buildHeaders(token: string, cookieHeader: string, chatId?: string) Name collisions, not overrides — each reported TS2416. They are renamed to `buildStreamHeaders` / `buildRequestHeaders` / `buildApiHeaders`; the two lmarena test files that called the helper directly are updated with them. Worth stating precisely, because the shadow sat on a live dispatch path without being a live bug: `BaseExecutor.countTokens()` calls `this.buildHeaders(credentials, false)`, and all three inherit `countTokens()`. It is unreachable today only because `buildCountTokensUrl()` returns null unless `config.format === "claude"` and the URL carries `/messages` — hailuo-web and qwen-web set no format, lmarena sets `"openai"` — so `countTokens()` returns at the guard above. Latent, not live; one `format` change away from passing a credentials object where a token string is expected. Two more, surfaced by clearing the above: * `lmarena` declared `buildUrl` and `transformRequest` `protected` while both are public on BaseExecutor (TS2415 — a subclass may widen visibility, never narrow it). Both were masked behind the buildHeaders TS2416 and appeared one at a time as it cleared. Runtime is unaffected; JavaScript has no member visibility. * `GithubExecutor.refreshCredentials` had no declared return type, so TypeScript inferred the union of its four literal returns. `GheCopilotExecutor` legitimately overrides it with a wider `providerSpecificData` (it also records the enterprise proxy URL) and no `expiresIn`, which is not assignable to that inferred union. Declared as `RefreshedCopilotCredentials | null` — same shape of fix as cheaper-inference#8489, on a different method. Validation: full tsc error-set diff against the base config — 335 -> 331, zero new errors (line-number-agnostic). `typecheck:core` clean; the 15 existing test files importing a touched executor pass, including lmarena's 44 across the two updated files. `plan3-p0.test.ts` fails identically with and without this change (it reads the developer's real ~/.omniroute DB rather than a test-scoped DATA_DIR). The new test pins that the inherited method is no longer shadowed — verified to fail on the base, where all three prototypes still carry their own `buildHeaders` — and that the `countTokens()` early return which kept it harmless still holds.
muhamadgalihsaputra
pushed a commit
to niyatna/NiyatnaRoute
that referenced
this pull request
Sep 27, 2026
…rs (cheaper-inference#8498) `BaseExecutor.buildHeaders(credentials, stream?, clientHeaders?, model?, health?)` was shadowed in three executors by same-named helpers with unrelated signatures: hailuo-web private buildHeaders(token: string, yy: string) lmarena protected buildHeaders(_model: string, credentials: unknown, _body: unknown) qwen-web private buildHeaders(token: string, cookieHeader: string, chatId?: string) Name collisions, not overrides — each reported TS2416. They are renamed to `buildStreamHeaders` / `buildRequestHeaders` / `buildApiHeaders`; the two lmarena test files that called the helper directly are updated with them. Worth stating precisely, because the shadow sat on a live dispatch path without being a live bug: `BaseExecutor.countTokens()` calls `this.buildHeaders(credentials, false)`, and all three inherit `countTokens()`. It is unreachable today only because `buildCountTokensUrl()` returns null unless `config.format === "claude"` and the URL carries `/messages` — hailuo-web and qwen-web set no format, lmarena sets `"openai"` — so `countTokens()` returns at the guard above. Latent, not live; one `format` change away from passing a credentials object where a token string is expected. Two more, surfaced by clearing the above: * `lmarena` declared `buildUrl` and `transformRequest` `protected` while both are public on BaseExecutor (TS2415 — a subclass may widen visibility, never narrow it). Both were masked behind the buildHeaders TS2416 and appeared one at a time as it cleared. Runtime is unaffected; JavaScript has no member visibility. * `GithubExecutor.refreshCredentials` had no declared return type, so TypeScript inferred the union of its four literal returns. `GheCopilotExecutor` legitimately overrides it with a wider `providerSpecificData` (it also records the enterprise proxy URL) and no `expiresIn`, which is not assignable to that inferred union. Declared as `RefreshedCopilotCredentials | null` — same shape of fix as cheaper-inference#8489, on a different method. Validation: full tsc error-set diff against the base config — 335 -> 331, zero new errors (line-number-agnostic). `typecheck:core` clean; the 15 existing test files importing a touched executor pass, including lmarena's 44 across the two updated files. `plan3-p0.test.ts` fails identically with and without this change (it reads the developer's real ~/.omniroute DB rather than a test-scoped DATA_DIR). The new test pins that the inherited method is no longer shadowed — verified to fail on the base, where all three prototypes still carry their own `buildHeaders` — and that the `countTokens()` early return which kept it harmless still holds.
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.
Part of #8484. Type-only; no toolchain change.
The collisions
BaseExecutor.buildHeaders(credentials, stream?, clientHeaders?, model?, health?)was shadowed in three executors by same-named helpers whose signatures have nothing to do with it:hailuo-webprivate(token: string, yy: string)lmarenaprotected(_model: string, credentials: unknown, _body: unknown)qwen-webprivate(token: string, cookieHeader: string, chatId?: string)Name collisions, not overrides — each reported
TS2416. Renamed tobuildStreamHeaders/buildRequestHeaders/buildApiHeaders, with the two lmarena test files that call the helper directly updated alongside.Latent, not live — stating it precisely.
BaseExecutor.countTokens()callsthis.buildHeaders(credentials, false)and all three inheritcountTokens(), so the shadow sat on a real dispatch path. It is unreachable today only becausebuildCountTokensUrl()returnsnullunlessconfig.format === "claude"and the URL carries/messages; hailuo-web and qwen-web set no format and lmarena sets"openai", socountTokens()returns at the guard one line above. Oneformatchange away from passing a credentials object where a token string is expected — but not a bug today, and I'm not going to dress it up as one.Two more, surfaced by clearing the first
TypeScript reports these one at a time, so each fix revealed the next:
lmarenanarrowed inherited visibility —buildUrlandtransformRequestwereprotectedwhile both are public onBaseExecutor(TS2415: a subclass may widen visibility, never narrow it). Verified identical on the pristine base ref, so pre-existing and masked behind thebuildHeaderserror. Runtime is unaffected — JavaScript has no member visibility.GithubExecutor.refreshCredentialshad no declared return type, so TypeScript inferred the union of its four literal returns.GheCopilotExecutorlegitimately overrides it with a widerproviderSpecificData(it also records the enterprise proxy URL) and noexpiresIn— not assignable to that inferred union. Declared asRefreshedCopilotCredentials | null. Same shape of fix as refactor(sse): declare the executor execute() result contract #8489, different method.Validation
The remaining two
TS2416(felo-web,gitlab— bothexecute) are #8489's; untouched here.npm run typecheck:coretests/unit/ts7-executor-override-signatures.test.tsTwo known base-red conditions, neither caused nor touched here:
plan3-p0.test.ts(reads the developer's real~/.omnirouteDB instead of a test-scopedDATA_DIR) andnpm run lint(stale suppression count inclaude-to-openai-think-close-5123.test.ts). Both are addressed in #8490.Tests
The renames are behavior-preserving, so the guard targets what actually changed — that the inherited method is no longer shadowed:
Verified to fail on the base, where all three prototypes still carry their own
buildHeaders. The suite also pins that each provider keeps its own helper under the new name, and that thecountTokens()early return which kept the shadow harmless still holds — so if that guard ever changes, the inherited method is the one that runs.Overlap note
This touches
open-sse/executors/github.ts, as does #8489 — different methods (executeguard there,refreshCredentialssignature here) in well-separated regions, so they should auto-merge. Flagging it in case you want a merge order.