Skip to content

fix(hook-codex): stop snapshotting Codex.app's Info.plist#1

Merged
kPatch merged 1 commit into
mainfrom
fix/install
May 11, 2026
Merged

fix(hook-codex): stop snapshotting Codex.app's Info.plist#1
kPatch merged 1 commit into
mainfrom
fix/install

Conversation

@kPatch

@kPatch kPatch commented May 11, 2026

Copy link
Copy Markdown
Contributor

enableHook copied the full Info.plist to ~/.plaipin/state/ and disableHook restored it byte-for-byte. The plist contains data Codex owns - most importantly ElectronAsarIntegrity, whose SHA-256 of app.asar is rewritten by Codex's auto-updater. After any auto-update between install and uninstall, the snapshot's hash no longer matches the on-disk app.asar, and restoring it causes Electron's EnableEmbeddedAsarIntegrityValidation fuse to abort at launch (SIGTRAP in asar_util.cc).

Plaipin only ever needs to mutate :LSEnvironment:CODEX_CLI_PATH, so:

  • drop BACKUP_INFO_PLIST and all whole-file copy/restore
  • enableHook: surgically delete only :LSEnvironment:CODEX_CLI_PATH (was wiping the whole :LSEnvironment dict, clobbering any other env vars Codex or the user set), add parent dict idempotently, then add our key
  • disableHook: single PlistBuddy delete + ad-hoc re-sign
  • cmd-uninstall: delegate to cmdHookCodex({disable:true}) for one source of truth
  • drop codesign --deep (deprecated; editing Info.plist only invalidates the outer bundle signature)

Uninstall is now purely declarative against the live Info.plist, so no stale-snapshot bug is possible across Codex auto-updates

`enableHook` copied the full Info.plist to ~/.plaipin/state/ and `disableHook` restored it byte-for-byte. The plist contains data Codex owns - most importantly ElectronAsarIntegrity, whose SHA-256 of app.asar is rewritten by Codex's auto-updater. After any auto-update between install and uninstall, the snapshot's hash no longer matches the on-disk app.asar, and restoring it causes Electron's EnableEmbeddedAsarIntegrityValidation fuse to abort at  launch (SIGTRAP in asar_util.cc).

Plaipin only ever needs to mutate :LSEnvironment:CODEX_CLI_PATH, so:
- drop BACKUP_INFO_PLIST and all whole-file copy/restore
- enableHook: surgically delete only :LSEnvironment:CODEX_CLI_PATH (was wiping the whole :LSEnvironment dict, clobbering any other env vars Codex or the user set), add parent dict idempotently, then add our key
- disableHook: single PlistBuddy delete + ad-hoc re-sign
- cmd-uninstall: delegate to cmdHookCodex({disable:true}) for one source of truth
- drop `codesign --deep` (deprecated; editing Info.plist only invalidates the outer bundle signature)

Uninstall is now purely declarative against the live Info.plist, so no stale-snapshot bug is possible across Codex auto-updates
@kPatch kPatch merged commit c8ba5fc into main May 11, 2026
1 check passed
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.

1 participant