refactor(codex-runtime): tidy reapply-migration control flow

Self-review follow-up (hermes-pr-review Phase 2, non-blocking clarity findings).

- Collapse the reapplying_enable predicate to a single chained comparison
  (new_value == current == "codex_app_server") instead of a two-clause AND
  that re-tested new_value == current.
- Dedent the msg_lines list literals (drop trailing single-element commas).

No behavior change: reapply still falls through to the idempotent migrate()
while skipping set_runtime/persist (prompt cache preserved), and the auto-disable
early-return is unchanged. 31/31 tests green.
This commit is contained in:
kshitijk4poor 2026-07-01 23:46:12 +05:30 committed by kshitij
parent 35eb93c8df
commit 7322da487f

View file

@ -153,9 +153,7 @@ def apply(
# config.yaml without ever running the slash command. The migration is
# idempotent by design (it replaces its own managed block in place), so
# re-running is cheap and safe.
reapplying_enable = (
new_value == current and new_value == "codex_app_server"
)
reapplying_enable = new_value == current == "codex_app_server"
if new_value == current and not reapplying_enable:
return CodexRuntimeStatus(
success=True,
@ -199,12 +197,10 @@ def apply(
if reapplying_enable:
msg_lines = [
f"openai_runtime already set to {current} — re-applying migration",
f"openai_runtime already set to {current} — re-applying migration"
]
else:
msg_lines = [
f"openai_runtime: {current}{new_value}",
]
msg_lines = [f"openai_runtime: {current}{new_value}"]
if new_value == "codex_app_server":
ok, ver = _check_binary_cached()
if ok: