Skip to content

fix: keep codex models executable when discovery returns an empty catalog - #717

Closed
ayushnangia wants to merge 1 commit into
PrimeIntellect-ai:mainfrom
ayushnangia:fix/696-empty-codex-catalog
Closed

fix: keep codex models executable when discovery returns an empty catalog#717
ayushnangia wants to merge 1 commit into
PrimeIntellect-ai:mainfrom
ayushnangia:fix/696-empty-codex-catalog

Conversation

@ayushnangia

@ayushnangia ayushnangia commented Aug 6, 2026

Copy link
Copy Markdown

Fixes #696.

Problem

getExecutableModels() treats a successful discovery response with zero models the same as a real catalog: every openai-codex model is filtered out and the empty set is cached for 5 minutes. As #696 documents, the same credentials serve completions over /codex/responses, the picker still offers the model via getAvailable(), and the resulting subagent error blames authentication.

An empty 200 is an entitlement or client-version gate (#639), not proof that an authenticated provider has no models — and #639's fix leaves this handling latent for any account whose gate returns a subset or nothing.

Change

packages/coding-agent/src/core/model-registry.ts: empty catalogs fail open — codex models stay executable and per-request errors surface the real cause. Applies to the fresh result, the fresh-cache read, and the stale-cache fallback via one filterByCatalog helper. Non-empty catalogs filter exactly as before; the empty result is still cached, so there is no refetch-per-call.

Tests

test/suite/regressions/696-empty-codex-catalog.test.ts:

  • empty catalog keeps codex models executable (fails on main)
  • cached empty catalog stays fail-open, single fetch (fails on main)
  • subset catalog still filters to the returned slugs (control, passes on main)

npm run check clean; test run from the package root per AGENTS.md.


Note

Low Risk
Narrow change to Codex executable-model filtering with fail-open behavior on empty discovery; subset filtering and auth failure paths are unchanged.

Overview
Fixes #696 by changing how getExecutableModels() applies OpenAI Codex model discovery.

Previously, a successful discovery response with zero models was treated like a real catalog: every openai-codex entry was removed from the executable list and that empty set was cached for five minutes, while completions could still work and the UI could still show those models via getAvailable().

filterByCatalog now fails open when the discovered ID set is empty—Codex models stay executable and any entitlement or version issue surfaces on the actual request. When discovery returns one or more slugs, filtering is unchanged. The helper is used for fresh discovery, cache hits, and stale-cache fallback.

Regression tests cover empty catalog, cached empty catalog (single fetch), and subset filtering.

Reviewed by Cursor Bugbot for commit e1a5579. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Fix ModelRegistry.getExecutableModels to keep codex models available when discovery returns an empty catalog

When the OpenAI Codex catalog discovery returns an empty set, getExecutableModels previously filtered out all codex models. The fix introduces a filterByCatalog helper in model-registry.ts that skips catalog filtering when the discovered ID set is empty, treating an empty catalog as a failed entitlement check and failing open. Non-empty catalogs still filter as before. A regression test suite in 696-empty-codex-catalog.test.ts covers the empty catalog, cached empty catalog, and non-empty catalog cases.

Macroscope summarized e1a5579.

…alog

fixes PrimeIntellect-ai#696

A successful discovery response with zero models is an entitlement or
client-version gate (PrimeIntellect-ai#639), not proof that an authenticated provider has
no models. getExecutableModels() filtered every openai-codex model on it
and cached the empty set for 5 minutes, while the same credentials served
completions and the error blamed authentication.

Empty catalogs now fail open (fresh and cached); non-empty catalogs
filter exactly as before.
@fredluz

fredluz commented Aug 6, 2026

Copy link
Copy Markdown

Tested this locally against the current branch, including a real Codex/Luna subagent dispatch. The fix works as intended, and I did not observe any other breaking changes in the affected flow.

@ayushnangia

Copy link
Copy Markdown
Author

Thanks for the independent verification — a real Codex/Luna subagent dispatch is exactly the flow this guards. For reference, #731 is the companion fix (correct client_version so discovery returns the real catalog); this PR covers the fail-open when discovery legitimately returns empty.

@amphetamarina

Copy link
Copy Markdown

Verified locally. I applied this PR's empty-catalog fail-open fix to my installed Prime Agent runtime and restarted the daemon.

Environment:

  • Prime Agent: 0.7.0
  • OS: Ubuntu 24.04.4 LTS
  • Kernel: 7.0.0-28-generic
  • Architecture: x86_64

Before the fix:

  • await rlm.find_models("luna") returned an empty list.
  • Spawning openai-codex/gpt-5.6-luna failed as unavailable, unauthenticated, or expired.

After the fix and restart:

  • Model discovery returned openai-codex/gpt-5.6-luna.
  • A Luna RLM subagent was admitted, completed, and sent its expected reply to the parent.
  • A direct registry check kept 13 OpenAI Codex models executable, including Luna and Sol.

This verifies the fix against the bundled runtime path used by the daemon, not only the unbundled module.

@ayushnangia

Copy link
Copy Markdown
Author

Thanks for the before/after verification — that's the second independent confirmation on this PR (with the Codex/Luna dispatch test above), both on live runtimes. For anyone landing here from the RLM-discovery symptom: #731 is the companion that fixes discovery itself (correct client_version), and the pair together resolves #740/#639/#702.

zhengr pushed a commit to zhengr/prime-agent that referenced this pull request Aug 8, 2026
…l+o (PrimeIntellect-ai#717)

- Add expandTools to EditorAction in pi-tui so components can access it
- Update bash-execution, compaction-summary-message, branch-summary-message,
  and tool-execution to use getEditorKeybindings().getKeys('expandTools')
- Pass expandTools config to setEditorKeybindings in KeybindingsManager.create()
- Style keybinding with 'dim' color, description with 'muted' (matches startup hints)
zhengr pushed a commit to zhengr/prime-agent that referenced this pull request Aug 8, 2026
…ct-ai#724)

Follow-up to PrimeIntellect-ai#717. Replaces all remaining hardcoded keybinding hints with configurable ones.

- Add pasteImage to AppAction so it can be configured in keybindings.json
- Create keybinding-hints.ts with reusable helper functions:
  - editorKey(action) / appKey(keybindings, action) - get key display string
  - keyHint(action, desc) / appKeyHint(kb, action, desc) / rawKeyHint(key, desc) - styled hints
- Export helpers from components/index.ts for extensions
- Update all components to use configured keybindings
- Remove now-unused getDisplayString() from KeybindingsManager and EditorKeybindingsManager
- Use keybindings.matches() instead of matchesKey() for pasteImage in custom-editor.ts
avion23 pushed a commit to avion23/prime-agent that referenced this pull request Aug 9, 2026
…table when discovery returns an empty catalog
@sethkarten

sethkarten commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Closed as superseded by #1153, an independent implementation written from upstream/main without importing outside commits, source code, or test files. #1153 addresses the same empty-catalog behavior with its own implementation and regression coverage.

@ayushnangia

Copy link
Copy Markdown
Author

Completely reasonable — a clean review surface built from upstream/main is the right call for the fork's provenance. Glad the diagnosis and regression shape were useful as a report; the fail-open empty-catalog behavior was the part that mattered. I'll keep future findings coming as detailed reports with repros.

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.

openai-codex: empty-but-successful model discovery silently disables the provider and is reported as an auth failure

4 participants