Skip to content

fix(delegate): accept pi-ai 0.84 ProviderHeaders (null-valued headers filtered) - #26

Merged
rz1989s merged 1 commit into
mainfrom
fix/provider-headers-pi-084
Sep 2, 2026
Merged

fix(delegate): accept pi-ai 0.84 ProviderHeaders (null-valued headers filtered)#26
rz1989s merged 1 commit into
mainfrom
fix/provider-headers-pi-084

Conversation

@rz1989s

@rz1989s rz1989s commented Sep 2, 2026

Copy link
Copy Markdown
Member

Problem

pi-ai 0.84 widened ProviderHeaders from Record<string, string> to Record<string, string | null>. vision's delegate passes auth.headers (typed ProviderHeaders | undefined) into callVisionModel / callWithRetryAndFallback, whose params still declared Record<string, string> | undefined — a hard typecheck failure for any consumer compiling against pi-ai 0.84 (found via armory-fleet's pi 0.84.4 alignment, where vision 0.5.2 is the only red in the suite).

vision ships raw .ts, so skipLibCheck cannot mask this — downstream typechecks compile these lines directly.

Fix

  • Both internal params widened to the canonical ProviderHeaders | undefined (type imported from pi-ai, which vision already depends on)
  • The single header-merge site filters null values before fetch — null means "unset" in the widened type, and fetch's HeadersInit rejects null values, so this is the semantic fix, not just a type patch
  • Regression test pins both behaviors: null-valued provider header never reaches fetch; non-null header passes through; auth/content-type headers intact

Verification

  • pnpm typecheck green
  • pnpm test:run 354/354 (new test RED before fix on both axes — runtime assert + TS2322 on the null literal — then GREEN after)
  • Version bumped to 0.5.3 for release

… filtered before fetch)

pi-ai 0.84 widened ProviderHeaders from Record<string, string> to
Record<string, string | null>. callVisionModel and callWithRetryAndFallback
now accept the canonical ProviderHeaders type; the single header-merge site
filters null values ("unset") before fetch's HeadersInit, which rejects null.
Regression test pins both the filtering and the widened signature.
@rz1989s
rz1989s merged commit bab6760 into main Sep 2, 2026
1 check passed
@rz1989s
rz1989s deleted the fix/provider-headers-pi-084 branch September 2, 2026 23:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant