Skip to content

Instantly share code, notes, and snippets.

@beeman
Created May 2, 2026 18:32
Show Gist options
  • Select an option

  • Save beeman/ec52db9d786bf125af9a13429a6ea4fc to your computer and use it in GitHub Desktop.

Select an option

Save beeman/ec52db9d786bf125af9a13429a6ea4fc to your computer and use it in GitHub Desktop.

I want to locally enable Codex Pets by overriding the cached Statsig gate, without patching app.asar.

Context:

  • Codex desktop is an Electron app.
  • The Pets / avatar overlay feature is gated by Statsig gate 2679188970.
  • The custom pet files should live under ~/.codex/pets/<pet-id>/.
  • The relevant cache is Chromium localStorage LevelDB at: ~/Library/Application Support/Codex/Local Storage/leveldb
  • The relevant localStorage keys look like: statsig.cached.evaluations.<number>
  • Each value is an outer JSON object with a stringified JSON data field. Inside data.feature_gates, add: { "2679188970": { "name": "2679188970", "value": true, "rule_id": "local_override", "id_type": "userID", "secondary_exposures": [] } }

Please do this carefully:

  1. First verify my pet package exists and is valid under ~/.codex/pets.
  2. Do not edit .ldb files as text.
  3. Use a LevelDB-aware tool/library, for example Node with classic-level.
  4. Make a full backup of the LevelDB directory before writing.
  5. Dry-run against a copied snapshot first and report which statsig.cached.evaluations.* keys are patchable.
  6. Patch every parseable cached evaluation key, not just one.
  7. Codex must be fully quit before patching the live DB, because the LevelDB is locked while Codex is running.
  8. Do not use launchctl submit for the restart flow. It can create a repeating launchd job and put Codex into a quit/patch/reopen loop.
  9. Prefer this flow instead:
    • prepare the patch script
    • dry-run on a copied DB snapshot
    • ask me to quit Codex manually
    • run the live patch once
    • ask me to reopen Codex manually
  10. If you do use launchd anyway, use a non-keepalive one-shot job and immediately remove it after the first run with: launchctl remove <label> Then verify: launchctl print gui/$(id -u)/<label> should fail with “Could not find service”.
  11. After restart, verify the gate reads as already enabled in the patched cache and tell me to check Settings > Appearance > Pets.

Do not patch /Applications/Codex.app/Contents/Resources/app.asar. Do not modify Electron signatures or app integrity. Do not force-kill Codex unless I explicitly approve it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment