fix(codex): preserve customized agent TOMLs#5520
Conversation
|
All contributors have signed the CLA. Thank you! ✅ |
|
I have read the CLA Document and I hereby sign the CLA |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bad7d8421c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…oml-model-customizations # Conflicts: # packages/omo-codex/scripts/install-dist/install-local.mjs
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 457c862e6c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const previousHash = input.manifest.files[input.fileName]?.sha256 | ||
| const existingAgentName = extractAgentName(existingContent) | ||
| if (previousHash !== hashContent(existingContent) && existingAgentName === agentNameFromToml(input.fileName)) { | ||
| return |
There was a problem hiding this comment.
Migrate pre-manifest agent copies before preserving
On the first upgrade from any release before CODEX_HOME/.omo/native-agents.json existed, previousHash is undefined; if the bundled TOML changed since the old install, this branch treats the old managed copy as user-modified just because its name matches the filename and returns without writing the new bundled TOML or a manifest entry. That leaves pre-manifest users pinned to stale agent prompts/models indefinitely, so the no-overwrite path should require a known previous hash or otherwise migrate existing managed copies before preserving them.
Useful? React with 👍 / 👎.
Summary
CODEX_HOME/.omo/native-agents.jsonhash manifest for managed Codex agent TOMLs.modelvalues, while still refreshing unmodified managed TOMLs when bundled defaults change.Why
LazyCodex installs bundled agent TOMLs into
CODEX_HOME/agents/. Reinstalling previously copied the bundled TOML over the installed file, then restored onlymodel_reasoning_effortandservice_tier. That meant user edits such as:were reset on reinstall/bootstrap relink.
This PR follows the same durable-management shape as the accepted oh-my-codex fix, but uses a content hash manifest instead of a plain "file exists" check. That lets managed files receive future bundled updates when the user did not edit them.
Behavior
Verification
Red phase:
node --test packages/omo-codex/scripts/install-agent-links.test.mjsmodel = "gpt-5.5"instead of preservingmodel = "custom-provider/plan-model".Green gates:
npx --yes bun run --cwd packages/omo-codex typechecknpx --yes bun run test:codexlsp-tools-mcp: 25 files / 95 tests passednode --test packages/omo-codex/plugin/test/bootstrap-setup.test.mjsbash .agents/skills/codex-qa/scripts/lib/common.sh --self-checkbash .agents/skills/codex-qa/scripts/install-verify.sh --self-testCODEX_HOMEomo@sisyphuslabsenabled, component bins linked, agent TOMLs linked~/.codex/config.tomlhash unchangedCODEX_HOMECODEX_HOME/agents/plan.tomltomodel = "custom-provider/plan-model"plan.tomland confirmed the custom model survivedCODEX_HOME/.omo/native-agents.jsonkept the managed bundled hash and real~/.codex/config.tomlstayed unchangedNote: this environment had Bun available through
npx --yes bunbut not as a barebunbinary onPATH, so the codex-qa install verification used a temporary QA-only PATH wrapper that execsnpx --yes bun.This PR was debugged, implemented, and created with LazyCodex.
Tag: lazycodex-generated
Summary by cubic
Preserves customized Codex agent TOMLs during reinstall/bootstrap and refreshes unmodified files via a new hash manifest. Also replaces legacy agent symlinks with regular files to avoid broken links.
~/.codex/.omo/native-agents.jsonwith SHA-256 hashes to detect local edits and manage updates.model)..installed-agents.jsonfor uninstall tracking.Written for commit 457c862. Summary will update on new commits.