diff --git a/cli.py b/cli.py index 159f3486052..6c7e9bb7cee 100644 --- a/cli.py +++ b/cli.py @@ -6946,8 +6946,8 @@ class HermesCLI(CLIAgentSetupMixin, CLICommandsMixin): messages=list(self.conversation_history or []), config_context_length=getattr(self.agent, "_config_context_length", None), ) - except Exception: - pass + except Exception as exc: + logger.debug("preflight-compression switch warning failed: %s", exc) old_model = self.model self.model = result.new_model @@ -7225,8 +7225,8 @@ class HermesCLI(CLIAgentSetupMixin, CLICommandsMixin): messages=list(self.conversation_history or []), config_context_length=getattr(self.agent, "_config_context_length", None), ) - except Exception: - pass + except Exception as exc: + logger.debug("preflight-compression switch warning failed: %s", exc) if not self._confirm_expensive_model_switch(result): _cprint(" Model switch cancelled.") diff --git a/gateway/slash_commands.py b/gateway/slash_commands.py index b222b62ff1e..e5baf8693b2 100644 --- a/gateway/slash_commands.py +++ b/gateway/slash_commands.py @@ -1173,8 +1173,8 @@ class GatewaySlashCommandsMixin: custom_providers=custom_provs, load_gateway_config=_load_gateway_config, ) - except Exception: - pass + except Exception as exc: + logger.debug("preflight-compression switch warning failed: %s", exc) # Update cached agent in-place cached_entry = None @@ -1376,8 +1376,8 @@ class GatewaySlashCommandsMixin: custom_providers=custom_provs, load_gateway_config=_load_gateway_config, ) - except Exception: - pass + except Exception as exc: + logger.debug("preflight-compression switch warning failed: %s", exc) async def _finish_switch() -> str: """Apply the resolved switch (agent, session, config) and build the reply.""" diff --git a/hermes_cli/context_switch_guard.py b/hermes_cli/context_switch_guard.py index f0cb55bc73d..05b8bde63fb 100644 --- a/hermes_cli/context_switch_guard.py +++ b/hermes_cli/context_switch_guard.py @@ -166,4 +166,4 @@ def enrich_model_switch_warnings_for_gateway( messages=messages, custom_providers=custom_providers, config_context_length=cfg_ctx, - ) \ No newline at end of file + ) diff --git a/tests/hermes_cli/test_context_switch_guard.py b/tests/hermes_cli/test_context_switch_guard.py index ec61074444a..bfef151d4f6 100644 --- a/tests/hermes_cli/test_context_switch_guard.py +++ b/tests/hermes_cli/test_context_switch_guard.py @@ -102,4 +102,4 @@ def test_merge_appends_to_existing_warning(monkeypatch): result.warning_message = "expensive" merge_preflight_compression_warning(result, agent=agent) assert "expensive" in result.warning_message - assert "preflight compression" in result.warning_message \ No newline at end of file + assert "preflight compression" in result.warning_message diff --git a/tui_gateway/server.py b/tui_gateway/server.py index 81df58ca66b..87de2bb490e 100644 --- a/tui_gateway/server.py +++ b/tui_gateway/server.py @@ -2264,8 +2264,8 @@ def _apply_model_switch( custom_providers=custom_provs, config_context_length=_cfg_ctx, ) - except Exception: - pass + except Exception as exc: + logger.debug("preflight-compression switch warning failed: %s", exc) if not confirm_expensive_model: try: @@ -2286,7 +2286,7 @@ def _apply_model_switch( confirm_msg = f"{confirm_msg}\n\n{result.warning_message}" return { "value": result.new_model, - "warning": warning.message, + "warning": confirm_msg, "confirm_required": True, "confirm_message": confirm_msg, }