fix: use InputsUnion1 for input item types instead of BaseInputsUnion#548
fix: use InputsUnion1 for input item types instead of BaseInputsUnion#548devin-ai-integration[bot] wants to merge 1 commit into
Conversation
BaseInputsUnion is the full input union (string | Array<...>), not an item type; the lib code only compiled because the generated type carried a trailing `| any` member. The upcoming OpenAPI 3.1 spec change removes that escape hatch, so item-typed positions now use InputsUnion1, the element union of InputsUnion. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Original prompt from luke.parke
|
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
There was a problem hiding this comment.
⚠️ APPROVE unavailable on this installation — the maintainer GitHub App is not
configured with pull_requests: write, so the verdict below is posted as COMMENT.
Event-level approval (for branch-protection / review requirements) must be added out-of-band.
Perry's Review
Narrows the item type of appendToMessages/normalizeInputToArray from models.BaseInputsUnion (the full input union, string | array) to models.InputsUnion1 (the actual element union) — a preparatory fix ahead of an OpenAPI 3.1 spec regen that removes the | any escape hatch these positions were silently compiling through.
Verdict: ✅ LGTM
Details
Risk: 🟢 Low
CI: all passing ✅
Findings: none — verified InputsUnion1 is the correct element union of InputsUnion (matches normalizeInputToArray's actual return semantics), traced all call sites in model-result.ts (the two callers passing FunctionCallOutputItem[] already satisfy InputsUnion1[] without a cast; the two callers that needed the added as models.InputsUnion1[] casts pass broader OutputItems/response-output unions that legitimately need narrowing). No behavioral change — type-only.
Security: no concerns — no auth/streaming/logging/rendering/tenant-boundary categories touched.
Test coverage: existing appendToMessages unit tests already exercise this function; no new tests needed for a type-only change.
Unresolved threads: none
Details (footer)
Scope: first review (full)
Review: tier=trivial · model=claude-sonnet-latest · score=0.1
Summary
Companion to OpenRouterTeam/openrouter-web#27314 (OpenAPI 3.1 nullability).
The hand-written
src/libcode usedmodels.BaseInputsUnionas the item type of the responsesinputarray, butBaseInputsUnionis the full input union (string | Array<...>). It only compiled because the current generated type carries a trailing| anymember — an artifact of a bare{nullable: true}union variant in the 3.0-style spec that Speakeasy turns intoz.any(). The 3.1 spec change replaces that with an explicittype: 'null', removing theanyescape hatch, and these item-typed positions stop compiling.Fix: use
models.InputsUnion1(the element union ofInputsUnion, which includesEasyInputMessageandFunctionCallOutputItem) wherever an input item type was meant:plus the matching
as models.InputsUnion1[]casts inmodel-result.tswhere responseoutputitems are echoed back as next-turn input.Compiles against both today's generated models (with
| any) and the regenerated models from the 3.1 spec, verified viaspeakeasy run(v1.763.2) with the PR spec.Link to Devin session: https://openrouter.devinenterprise.com/sessions/10bab5add638413090c7a6a74858843f