fix(codex-local): order Codex models the way the ChatGPT app does (stacked on #14917) (#14918)

## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work.
> - Each agent runs on an adapter, and the operator picks the agent's
model from the list the adapter advertises.
> - The `codex_local` adapter advertises a static, curated list. The
server returns that list as written, but the list itself is not in a
useful order: the default `gpt-5.6-sol` sits above the whole GPT-6
family (#14878).
> - This pull request orders the list the way the ChatGPT app orders
Codex models: newest model version first, then by decreasing capability
inside each version, with older models at the end.
> - It is stacked on #14917, which makes the model dropdown show a
hand-ordered list as the adapter advertises it. Without that change the
picker shows every list alphabetically.
> - The benefit is that a user who knows Codex finds the right model at
once, and older models sit at the end of the list.

## Linked Issues or Issue Description

Fixes #14878.

Related: #14917 (the Claude counterpart, #14877) carries the dropdown
change this PR relies on. This PR contains that commit until #14917
lands; after that it rebases to the Codex commit alone.

## What Changed

- `packages/adapters/codex-local/src/index.ts`: reorder the advertised
`models` list. GPT-6 (`astra`, `sol`, `luna`) first, then GPT-5.6
(`sol`, `terra`, `luna`), then `gpt-5.5`, `gpt-5.4`, `gpt-5.4-mini`,
`gpt-5`, `gpt-5-mini`, `gpt-5-nano`, then the o-series and
`codex-mini-latest` in their existing relative order.
`DEFAULT_CODEX_LOCAL_MODEL` is unchanged.
- `packages/adapters/codex-local/src/index.test.ts`: the metadata test
now asserts the full order of the GPT entries.

The ChatGPT app also lists GPT-6.1 Sol first. That model is not in
Paperclip's list today. Adding a model needs reasoning-effort and
fast-mode entries as well, so it is out of scope for an ordering fix.

## Verification

Run from the repository root:

```sh
pnpm exec vitest run packages/adapters/codex-local server/src/__tests__/adapter-models.test.ts
pnpm --filter @paperclipai/adapter-codex-local typecheck
```

Red on `master`, green here: the updated metadata test fails against the
unmodified list because `gpt-5.6-sol` comes first.

Manual check: open an agent that uses `codex_local` and open the model
dropdown. The list reads gpt-6-astra, gpt-6-sol, gpt-6-luna,
gpt-5.6-sol, gpt-5.6-terra, gpt-5.6-luna, gpt-5.5, gpt-5.4,
gpt-5.4-mini, gpt-5, gpt-5-mini, gpt-5-nano, o3, o4-mini, o3-mini, Codex
Mini.

## Risks

- Low risk. The list content and the default model do not change; only
the order does. The server returns this list as-is for the built-in
Codex adapter and the server test compares against the exported list, so
no server change is needed.
- The first entry is no longer the default model. Nothing reads the
first entry as a default: `DEFAULT_CODEX_LOCAL_MODEL` is resolved
separately.

## Model Used

Anthropic Claude Fable 5.1 (`claude-fable-5-1`) through Claude Code,
extended thinking on, with tool use for reading the repository, running
vitest and tsc, and editing files. The account holder reviewed the
change and owns the commit.

## Checklist

- [x] I have included a thinking path that traces from project context
to this change
- [x] I have specified the model used (with version and capability
details)
- [x] I have checked ROADMAP.md and confirmed this PR does not duplicate
planned core work
- [x] I have searched GitHub for duplicate or related PRs and linked
them above
- [x] I have either (a) linked existing issues with `Fixes: #` / `Closes
#` / `Refs #` OR (b) described the issue in-PR following the relevant
issue template
- [x] I have not referenced internal/instance-local Paperclip issues or
links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip`
URLs)
- [x] My branch name describes the change (e.g. `docs/...`, `fix/...`)
and contains no internal Paperclip ticket id or instance-derived details
- [x] I have run tests locally and they pass
- [x] I have added or updated tests where applicable
- [x] I have updated relevant documentation to reflect my changes
- [x] I have considered and documented any risks above
- [ ] All Paperclip CI gates are green
- [ ] Greptile is 5/5 with no open P2s, recommendations, or follow-ups
- [x] I will address all Greptile and reviewer comments before
requesting merge

---------

Co-authored-by: abderbj <115119179+abderbj@users.noreply.github.com>
This commit is contained in:
abderrahmen bejaouiandabderbj authored and GitHub committed 2026-10-02 13:32:18 -07:00
1 parent 92ad158ce1
commit d9b64ee28e
2 files changed
+16 -6

No files matched your search

@@ -14,13 +14,20 @@ describe("codex local adapter metadata", () => {
// Default to the concrete gpt-5.6-sol slug — Codex ships no metadata for the bare gpt-5.6
// alias, so it must not be advertised or used as the default (it triggers a fallback warning).
expect(DEFAULT_CODEX_LOCAL_MODEL).toBe("gpt-5.6-sol");
expect(modelIds.slice(0, 6)).toEqual([
"gpt-5.6-sol",
// Ordered like the ChatGPT app: newest version first, then by capability within a version (#14878).
expect(modelIds.slice(0, 12)).toEqual([
"gpt-6-astra",
"gpt-6-sol",
"gpt-6-luna",
"gpt-5.6-sol",
"gpt-5.6-terra",
"gpt-5.6-luna",
"gpt-5.5",
"gpt-5.4",
"gpt-5.4-mini",
"gpt-5",
"gpt-5-mini",
"gpt-5-nano",
]);
expect(modelIds).not.toContain("gpt-5.6");
expect(isCodexLocalFastModeSupported(DEFAULT_CODEX_LOCAL_MODEL)).toBe(true);
+7 -4
View File
@@ -106,22 +106,25 @@ export function isCodexLocalFastModeSupported(model: string | null | undefined):
);
}
// Ordered the way the ChatGPT app orders Codex models (#14878): newest model version first,
// then by decreasing capability inside each version, older models at the end. The server
// returns this list as written and the model dropdown keeps its order.
export const models = [
// DEFAULT_CODEX_LOCAL_MODEL is gpt-5.6-sol, so it doubles as the first (default) 5.6 entry.
{ id: DEFAULT_CODEX_LOCAL_MODEL, label: DEFAULT_CODEX_LOCAL_MODEL },
{ id: "gpt-6-astra", label: "gpt-6-astra" },
{ id: "gpt-6-sol", label: "gpt-6-sol" },
{ id: "gpt-6-luna", label: "gpt-6-luna" },
// DEFAULT_CODEX_LOCAL_MODEL is gpt-5.6-sol, the first 5.6 entry.
{ id: DEFAULT_CODEX_LOCAL_MODEL, label: DEFAULT_CODEX_LOCAL_MODEL },
{ id: "gpt-5.6-terra", label: "gpt-5.6-terra" },
{ id: "gpt-5.6-luna", label: "gpt-5.6-luna" },
{ id: "gpt-5.5", label: "gpt-5.5" },
{ id: "gpt-5.4", label: "gpt-5.4" },
{ id: "gpt-5.4-mini", label: "gpt-5.4-mini" },
{ id: "gpt-5", label: "gpt-5" },
{ id: "o3", label: "o3" },
{ id: "o4-mini", label: "o4-mini" },
{ id: "gpt-5-mini", label: "gpt-5-mini" },
{ id: "gpt-5-nano", label: "gpt-5-nano" },
{ id: "o3", label: "o3" },
{ id: "o4-mini", label: "o4-mini" },
{ id: "o3-mini", label: "o3-mini" },
{ id: "codex-mini-latest", label: "Codex Mini" },
];