fix: bind the code-interpreter image type across the openrouter 1.1.40 rename - #27
Merged
Merged
Conversation
…0 rename openrouter 1.1.40 renamed components.OutputImage to components.CodeInterpreterImageOutput with no back-compat alias. This package re-exports that symbol by name from __init__.py and declares `openrouter>=1.1,<2`, so any resolution at or above 1.1.40 raises ImportError on `import openrouter_agent` — the whole package, not just the renamed type. That is the state of the published 0.8.0 wheel today: a plain `pip install openrouter-agent-sdk` resolves the newest 1.1.x and cannot be imported. CI missed it because every job except `build` runs through uv.lock, which pins 1.1.22; `build` installs the wheel unpinned and is the one job that sees what users get. Bind whichever name the installed SDK provides. The two models are structurally identical (type, url) and this package only re-exports the type, so OutputImage and OutputInputImage stay stable for consumers on both sides of the boundary. Verified against 1.1.22, 1.1.39, 1.1.40 and 1.1.90; the full unit suite also passes against 1.1.90, so the rename was the only incompatibility in the range. Co-Authored-By: Claude Opus 5 <noreply@anthropic.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.
Fixes the
buildjob, which is red onmainand on every open PR.The bug
openrouter1.1.40 renamedcomponents.OutputImage→components.CodeInterpreterImageOutputwith no back-compat alias.__init__.pyimports that symbol by name, and this package declaresopenrouter>=1.1,<2— so any resolution at or above 1.1.40 raises:That is an import failure on
import openrouter_agent— the entire package, not just the renamed type.This is the state of the published 0.8.0 wheel right now. A plain
pip install openrouter-agent-sdkresolves the newest 1.1.x and produces an uninstallable-in-practice package. This PR is therefore worth landing ahead of the release train, not just to unstick CI.Why CI only just caught it
Every job except
buildruns throughuv.lock, which pinsopenrouter 1.1.22— comfortably below the boundary.buildinstalls the wheel unpinned (uv run --isolated --no-project --with "$wheel"), so it is the only job that sees what a user actually gets. It went red on its own as soon as a run happened after the SDK release; the last greenmainrun predates it.The fix
Bind whichever name the installed SDK provides. The two models are structurally identical (
type,url) and this package only re-exports the type, soOutputImageandOutputInputImage— both in__all__— stay stable for consumers on both sides of the boundary.Both
type: ignorecodes are load-bearing across the range rather than redundant: mypy resolves against the locked SDK, so exactly one of the two imports is unresolvable at any given pin, and which one flips when the lock crosses 1.1.40.warn_unused_ignoresis alreadyfalse.Scope check
I checked every SDK symbol this package imports against the newest release:
OutputImageis the only one missing. The full 117-test unit suite also passes against 1.1.90, so the rename was the sole incompatibility in the range — no cascade, and no reason to move the substrate pin.Tests
tests/unit/test_sdk_compat_exports.py— the alias identity, the{type, url}shape, and a sweep asserting every name in__all__is actually importable (the general form of this failure).Mutation-checked: with the shim reverted, the CI build step reproduces the original
ImportErrorverbatim and the new tests fail at collection under the newest SDK.Verification