Skip to content

fix(sdk): add gpt-5.2-codex, gpt-5.3-codex, and gpt-5.2 to model-variant detection#2238

Merged
enyst merged 2 commits intomainfrom
openhands/fix-gpt-5-codex-variant-detection
Feb 27, 2026
Merged

fix(sdk): add gpt-5.2-codex, gpt-5.3-codex, and gpt-5.2 to model-variant detection#2238
enyst merged 2 commits intomainfrom
openhands/fix-gpt-5-codex-variant-detection

Conversation

@enyst
Copy link
Copy Markdown
Collaborator

@enyst enyst commented Feb 27, 2026

Summary

Fixes #2233 - Add gpt-5.3-codex and gpt-5.2-codex to model-variant detection to avoid gpt-5 fallback.

Previously, gpt-5.3-codex and gpt-5.2-codex were incorrectly classified as gpt-5 instead of gpt-5-codex due to substring-based matching in _MODEL_VARIANT_PATTERNS. This caused codex models to inherit non-codex prompt behavior, leading to malformed pseudo-tool output and early run termination.

Changes

  • Added gpt-5.2-codex and gpt-5.3-codex to the gpt-5-codex variant patterns
  • Added gpt-5.2 to the gpt-5 variant patterns

Checklist

  • If the PR is changing/adding functionality, are there tests to reflect this? Yes - Added tests/sdk/utils/test_model_prompt_spec.py with tests for gpt-5 variant detection
  • If there is an example, have you run the example to make sure that it works? N/A
  • If there are instructions on how to run the code, have you followed the instructions and made sure that it works? Yes - Verified with manual tests and pytest
  • If the feature is significant enough to require documentation, is there a PR open on the OpenHands/docs repository with the same branch name? N/A
  • Is the github CI passing? To be verified

Agent Server images for this PR

GHCR package: https://github.com/OpenHands/agent-sdk/pkgs/container/agent-server

Variants & Base Images

Variant Architectures Base Image Docs / Tags
java amd64, arm64 eclipse-temurin:17-jdk Link
python amd64, arm64 nikolaik/python-nodejs:python3.12-nodejs22 Link
golang amd64, arm64 golang:1.21-bookworm Link

Pull (multi-arch manifest)

# Each variant is a multi-arch manifest supporting both amd64 and arm64
docker pull ghcr.io/openhands/agent-server:3298927-python

Run

docker run -it --rm \
  -p 8000:8000 \
  --name agent-server-3298927-python \
  ghcr.io/openhands/agent-server:3298927-python

All tags pushed for this build

ghcr.io/openhands/agent-server:3298927-golang-amd64
ghcr.io/openhands/agent-server:3298927-golang_tag_1.21-bookworm-amd64
ghcr.io/openhands/agent-server:3298927-golang-arm64
ghcr.io/openhands/agent-server:3298927-golang_tag_1.21-bookworm-arm64
ghcr.io/openhands/agent-server:3298927-java-amd64
ghcr.io/openhands/agent-server:3298927-eclipse-temurin_tag_17-jdk-amd64
ghcr.io/openhands/agent-server:3298927-java-arm64
ghcr.io/openhands/agent-server:3298927-eclipse-temurin_tag_17-jdk-arm64
ghcr.io/openhands/agent-server:3298927-python-amd64
ghcr.io/openhands/agent-server:3298927-nikolaik_s_python-nodejs_tag_python3.12-nodejs22-amd64
ghcr.io/openhands/agent-server:3298927-python-arm64
ghcr.io/openhands/agent-server:3298927-nikolaik_s_python-nodejs_tag_python3.12-nodejs22-arm64
ghcr.io/openhands/agent-server:3298927-golang
ghcr.io/openhands/agent-server:3298927-java
ghcr.io/openhands/agent-server:3298927-python

About Multi-Architecture Support

  • Each variant tag (e.g., 3298927-python) is a multi-arch manifest supporting both amd64 and arm64
  • Docker automatically pulls the correct architecture for your platform
  • Individual architecture tags (e.g., 3298927-python-amd64) are also available if needed

…ant detection

Previously, gpt-5.3-codex and gpt-5.2-codex were incorrectly classified as
gpt-5 instead of gpt-5-codex due to substring-based matching. This caused
codex models to inherit non-codex prompt behavior, leading to malformed
pseudo-tool output.

This fix adds:
- gpt-5.2-codex and gpt-5.3-codex to the gpt-5-codex variant patterns
- gpt-5.2 to the gpt-5 variant patterns

Co-authored-by: openhands <openhands@all-hands.dev>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 27, 2026

API breakage checks (Griffe)

Result: Passed

Action log

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 27, 2026

Agent server REST API breakage checks (OpenAPI)

Result: Passed

Action log

Copy link
Copy Markdown
Collaborator

@all-hands-bot all-hands-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Taste Rating: 🟢 Good taste - Clean fix for a real bug. The ordered tuple approach elegantly solves the substring matching problem. LGTM.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 27, 2026

Coverage

Coverage Report •
FileStmtsMissCoverMissing
openhands-sdk/openhands/sdk/llm/utils
   model_prompt_spec.py38294%55, 75
TOTAL19000568170% 

…ention

Convert TestModelVariantDetection class to simple parametrized functions
to follow the repo convention of avoiding test classes unless necessary.

Co-authored-by: openhands <openhands@all-hands.dev>
@enyst enyst merged commit cefaebf into main Feb 27, 2026
27 of 28 checks passed
@enyst enyst deleted the openhands/fix-gpt-5-codex-variant-detection branch February 27, 2026 23:39
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.

fix(sdk): add gpt-5.3-codex and gpt-5.2-codex to model-variant detection to avoid gpt-5 fallback

3 participants