fix(codex-runtime): re-running /codex-runtime codex_app_server when already enabled now triggers migration (salvage of #26532 by @simpolism, closes #26529) - #468
Merged
Conversation
…lready enabled now triggers migration (salvage of NousResearch#26532 by @simpolism, closes NousResearch#26529)
|
Review Complete Risk: 🟡 Medium (38/100) — no findings · 97 LOC across 2 files PR adds a Files Reviewed (2 files) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
/codex-runtime codex_app_servernow re-runs the migration when the runtime is already set tocodex_app_server, instead of silently no-op'ing with "already set".Root cause:
apply()short-circuits onnew_value == currentbefore the migration block. That conflates "config value is correct" with "world state is converged" — fine forauto(disabling has no side effects) but wrong forcodex_app_server, where the config value can be correct while the~/.codex/config.tomlmanaged block, the hermes-tools MCP callback, and plugin discovery are missing. Users hit this by pre-settingopenai_runtime: codex_app_serverinconfig.yaml(whichhermes profile create --clonedoes automatically), then running the slash command expecting migration — silent no-op, bot falls back tocodex_responses.Changes
hermes_cli/codex_runtime_switch.py: oncodex_app_serverre-apply, fall through to the (idempotent) migration block while skippingset_runtime/persist — no config-value change, soconfig.yamlis not rewritten and prompt cache is untouched. User-visible message becomes"already set to codex_app_server — re-applying migration".autore-apply keeps the early-return short-circuit.tests/hermes_cli/test_codex_runtime_switch.py:test_reapply_codex_app_server_runs_migration— assertsmigrate()ran,persist_callbackdid NOT fire, migration output surfaces,requires_new_session=True.Validation
auto→codex_app_server)codex_app_server→codex_app_server)auto→autoorigin/main("migration must run on reapply") and passes with this fix.tests/hermes_cli/test_codex_runtime_switch.pypass.Salvage of NousResearch#26532 by @simpolism (also reporter of NousResearch#26529). Cherry-picked cleanly onto current
main, authorship preserved. Duplicate NousResearch#26535 (@aqilaziz) already closed; this is the more thorough implementation.Closes NousResearch#26529
Review + follow-up (hermes-pr-review Phase 2)
Ran the full Phase-2 review (targeted + broader test sweep, real unmocked
apply()smoke, 3-angle + Hermes-specific review): no Critical findings. Prompt-cache invariant verified (reapply does NOT callset_runtime/persist and does not touch system prompt/toolsets),auto-disable early-return preserved,migrate()idempotency (strip-before-write, atomic replace) confirmed.Follow-up commit
6e761547d(mine) folds in the two non-blocking clarity findings: collapse thereapplying_enablepredicate to a chained comparison, and dedupe themsg_linesliterals. No behavior change; 31/31 tests green.Also caught + corrected a stale-base artifact before pushing: an earlier working-tree state showed a phantom deletion of an unrelated
scripts/release.pyAUTHOR_MAP entry (branch was cut before that chore PR merged). Rebased onto currentmainso the PR shows only the two intended files.Mirror-of: NousResearch#56563
NousResearch#56563