Skip to content

fix: preserve insertion order for model variants in opencode API (fixes #145) - #311

Open
rohanranjan0902 wants to merge 1 commit into
rivet-dev:mainfrom
rohanranjan0902:fix-codex-model-variants
Open

rohanranjan0902 wants to merge 1 commit into
rivet-dev:mainfrom
rohanranjan0902:fix-codex-model-variants

Conversation

@rohanranjan0902

Copy link
Copy Markdown

Description

This PR fixes an issue where Codex model variants were being returned out of order in the OpenCode /models API (e.g. ["high", "low", "medium", "xhigh"]).

Root Cause: The opencode_compat handler manually builds the variants object, but serde_json uses BTreeMap by default, which inadvertently sorted the keys alphabetically during serialization.

Changes:

  • Enabled the preserve_order feature for serde_json in the workspace Cargo.toml. This swaps the underlying map implementation to IndexMap, preserving the logical insertion order defined by the agent configs.

Fixes #145

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.

bug: codex model variants are out of order

1 participant