Skip to content

fix(ai): make model codegen hermetic and widen OpenAIResponsesCompat - #1

Merged
pdettori merged 1 commit into
feat/m5-openfromcheckpointfrom
fix/hermetic-models-build
Aug 24, 2026
Merged

fix(ai): make model codegen hermetic and widen OpenAIResponsesCompat#1
pdettori merged 1 commit into
feat/m5-openfromcheckpointfrom
fix/hermetic-models-build

Conversation

@pdettori

Copy link
Copy Markdown
Member

Problem

The packages/ai build script regenerated src/models.generated.ts and
src/image-models.generated.ts from the live models.dev API on every build:

"build": "npm run generate-models && npm run generate-image-models && tsgo -p tsconfig.build.json",

models.dev is a moving target. When it emits supportsReasoningEffort on a model
mapped to the openai-responses API, the regenerated file no longer typechecks
against OpenAIResponsesCompat:

error TS2353: Object literal may only specify known properties, and
'supportsReasoningEffort' does not exist in type 'OpenAIResponsesCompat'.

This breaks downstream consumers that pin this package as a git submodule and run
npm run build in CI (e.g. rossoctl/serverless-harness, where it blocked the
check job — Typecheck and unit tests stopped running).

Fix (two independent, complementary changes)

  1. Hermetic build. Codegen is split out of build. build now runs only
    tsgo, so builds are reproducible and use the committed generated files.
    Regeneration moves to a dedicated generate script, plus a check:models-drift
    script (mirrors the proto "verify no codegen drift" pattern) to detect when the
    committed files fall behind models.dev.

  2. Widen the type. supportsReasoningEffort?: boolean is added to
    OpenAIResponsesCompat (and to the Required<> defaults in getCompat,
    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.json on packages/ai → exit 0 (RED reproduced via a
narrow-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

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
pdettori merged commit ac02072 into feat/m5-openfromcheckpoint Aug 24, 2026
3 checks passed
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>
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