From 7322da487f4e16e432978c29862c5297ef6928f9 Mon Sep 17 00:00:00 2001 From: kshitijk4poor <82637225+kshitijk4poor@users.noreply.github.com> Date: Wed, 1 Jul 2026 23:46:12 +0530 Subject: [PATCH] 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. --- hermes_cli/codex_runtime_switch.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/hermes_cli/codex_runtime_switch.py b/hermes_cli/codex_runtime_switch.py index e12434627ef..06bff58e2e1 100644 --- a/hermes_cli/codex_runtime_switch.py +++ b/hermes_cli/codex_runtime_switch.py @@ -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: