fix(ai): make model codegen hermetic and widen OpenAIResponsesCompat - #1
Merged
Merged
Conversation
The build script regenerated src/models.generated.ts and src/image-models.generated.ts from the live models.dev API on every build. When models.dev emits supportsReasoningEffort on a model mapped to the openai-responses API, the regenerated file no longer typechecks against OpenAIResponsesCompat (TS2353), breaking downstream builds in consumers that pin this package as a git submodule. - Split codegen out of build: build now only runs tsgo, so builds are hermetic and use the committed generated files. Regeneration moves to a dedicated generate script, with check:models-drift to verify the committed files are current. - Add supportsReasoningEffort to OpenAIResponsesCompat (and its Required<> defaults in getCompat) so deliberate regeneration stays valid. Assisted-By: Claude (Anthropic AI) <noreply@anthropic.com> Signed-off-by: Paolo Dettori <dettori@us.ibm.com>
pdettori
added a commit
to rossoctl/serverless-harness
that referenced
this pull request
Aug 24, 2026
The check job runs 'cd pi-fork && npm ci && npm run build', which regenerated pi's models.generated.ts from the live models.dev API at build time. Drift there emitted 'supportsReasoningEffort' on an openai-responses-typed literal, failing typecheck (TS2353) and blocking the downstream Typecheck and Test steps -- harness unit tests have not run in CI since 2026-08-20. Bump pi-fork to rossoctl/pi@2c28be5, which makes the ai package build hermetic (codegen split out of 'build') and widens OpenAIResponsesCompat so deliberate regeneration stays type-valid. See rossoctl/pi#1. Assisted-By: Claude (Anthropic AI) <noreply@anthropic.com> Signed-off-by: Paolo Dettori <dettori@us.ibm.com>
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.
Problem
The
packages/aibuildscript regeneratedsrc/models.generated.tsandsrc/image-models.generated.tsfrom the live models.dev API on every build:models.dev is a moving target. When it emits
supportsReasoningEfforton a modelmapped to the
openai-responsesAPI, the regenerated file no longer typechecksagainst
OpenAIResponsesCompat:This breaks downstream consumers that pin this package as a git submodule and run
npm run buildin CI (e.g.rossoctl/serverless-harness, where it blocked thecheckjob — Typecheck and unit tests stopped running).Fix (two independent, complementary changes)
Hermetic build. Codegen is split out of
build.buildnow runs onlytsgo, so builds are reproducible and use the committed generated files.Regeneration moves to a dedicated
generatescript, plus acheck:models-driftscript (mirrors the proto "verify no codegen drift" pattern) to detect when the
committed files fall behind models.dev.
Widen the type.
supportsReasoningEffort?: booleanis added toOpenAIResponsesCompat(and to theRequired<>defaults ingetCompat,defaulting to
true) so a deliberate regeneration remains type-valid.Either change alone unblocks CI; together they make the failure mode structurally
impossible.
Verification
tsgo -p tsconfig.build.jsononpackages/ai→ exit 0 (RED reproduced via anarrow-typed literal before the fix, GREEN after).
Related
Fixes the build break tracked in rossoctl/serverless-harness#160. A companion PR
bumps the submodule pointer there.
Assisted-By: Claude Code