Skip to content

Fix model-picker patch no-op on Codex Desktop 0.141.0+ (model-list-filter bundle; also 26.616.x)#50

Open
DevRico003 wants to merge 4 commits into
sybil-solutions:mainfrom
DevRico003:fix/picker-patch-codex-0.141
Open

Fix model-picker patch no-op on Codex Desktop 0.141.0+ (model-list-filter bundle; also 26.616.x)#50
DevRico003 wants to merge 4 commits into
sybil-solutions:mainfrom
DevRico003:fix/picker-patch-codex-0.141

Conversation

@DevRico003

@DevRico003 DevRico003 commented Jun 18, 2026

Copy link
Copy Markdown

Problem

On Codex Desktop 0.141.0 (macOS), codex-shim patch-app reports

Codex Desktop model picker allowlist filter patch is already applied.

on a fresh, unpatched app and exits successfully — but the picker filter is never actually patched, so custom/BYOK catalog entries stay hidden from the model picker.

Root cause

Two things combine:

  1. Codex Desktop ≥ 0.141.0 factors the model-list filter into its own bundle, webview/assets/model-list-filter-*.js, which wasn't in the patch's glob list. The relevant code is:

    let a=[],o=null,s=i&&e!==`amazonBedrock`;
    return r.forEach(n=>{ if(s ? t.has(n.model) : !n.hidden){ ... } })

    s truthy ⇒ only server-allowlisted models (availableModels) render; custom slugs are dropped.

  2. _find_js_bundle returned the first candidate matching the needle or the deliberately-loose MODEL_PICKER_APPLIED marker ((?:let )?\w+=!1[,;]…\.forEach). An unrelated minified bundle that merely contains =!1;…forEach sorts earlier and matches that marker, so it shadowed the real filter bundle. _replace_once then found the applied marker there and returned "already applied" — a false no-op.

The needle itself (…&&\w+!==\amazonBedrock``) already matches the new bundle, so once the right file is selected the existing replacement works unchanged.

Fix

  • Add model-list-filter-*.js to the picker glob list.
  • Make _find_js_bundle two-pass: prefer any candidate still containing the unpatched needle before falling back to an "already applied" match. An unrelated bundle can no longer shadow the real target.

Verified end-to-end against an actual Codex Desktop 0.141.0 app.asar: the filter is now correctly rewritten to s=!1 (allowlist branch off, !n.hidden branch active), ASAR integrity re-hashed and re-signed, and custom models appear in the picker. Existing test suite passes; backward-compatible with the older inline (let u=c.useHiddenModels&&o!==\amazonBedrock`,d;`) and extracted-helper bundle shapes.


Update — also verified on Codex Desktop 26.616.32156

The same root cause reproduces on the current Codex Desktop 26.616.32156 (macOS arm64): the allowlist guard ships in its own model-list-filter-*.js bundle (...,s=i&&e!==\amazonBedrock`;), and the loose *already-applied* regex matched an unrelated bundle first, so patch-app` exited as a no-op on a fresh app.

With the model-list-filter-*.js glob and the needle-first two-pass lookup in this PR, patch-app now resolves the correct bundle and rewrites the guard to s=!1. Verified end-to-end: the picker shows custom catalog entries again. README test matrix updated accordingly.

Codex Desktop >= 0.141.0 factors the model-list filter into its own
webview/assets/model-list-filter-*.js bundle. `_find_js_bundle` returned
the first candidate matching the needle OR the (loose) "already applied"
regex. An unrelated minified bundle that happens to contain
`=!1;...forEach` sorts earlier and matches the applied marker, so it
shadowed the real filter bundle and `patch-app` reported a false
"already applied" — leaving the Statsig allowlist branch
(`useHiddenModels && authMethod !== 'amazonBedrock'`) intact and custom
BYOK models hidden from the picker.

Fixes:
- Look up the dedicated `model-list-filter-*.js` bundle explicitly.
- Make `_find_js_bundle` two-pass: prefer any candidate still containing
  the unpatched needle before falling back to an "already applied" match,
  so an unrelated bundle can no longer shadow the real target.
@DevRico003 DevRico003 force-pushed the fix/picker-patch-codex-0.141 branch from 7d51d88 to 70b5f31 Compare June 18, 2026 19:26
@nilswx

nilswx commented Jun 20, 2026

Copy link
Copy Markdown

Thank you, hope this pesky fix gets merged soon (or OpenAI drops Statsig gating altogether)!

The model-list-filter bundle lookup added for 0.141.0 also resolves the
no-op on newer Codex Desktop builds (26.616.32156), where the allowlist
guard ships as model-list-filter-*.js. Verified end-to-end: the guard is
rewritten to s=!1 and custom catalog entries appear in the picker.
@DevRico003 DevRico003 changed the title Fix model-picker patch no-op on Codex Desktop 0.141.0 Fix model-picker patch no-op on Codex Desktop 0.141.0+ (model-list-filter bundle; also 26.616.x) Jun 20, 2026
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.

2 participants