From 9e2890ba81e07d2905d8ac5802c9a52dc7fb99d8 Mon Sep 17 00:00:00 2001 From: Octopus Date: Tue, 7 Apr 2026 02:28:53 -0500 Subject: [PATCH] fix(embed): skip profile .env overwrite when config has no HINDSIGHT_API_* keys (#896) When the daemon is already running, ensure_running() calls _register_profile() with a config dict using short keys (llm_api_key, llm_provider, etc.) that do not match the HINDSIGHT_API_* prefix filter. This caused api_config to always be empty, and create_profile() would overwrite the existing .env with an empty file on every CLI command. Add an early return guard so _register_profile() skips the create_profile() call when api_config is empty, preserving any existing profile configuration. Fixes #894 --- hindsight-embed/hindsight_embed/daemon_embed_manager.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hindsight-embed/hindsight_embed/daemon_embed_manager.py b/hindsight-embed/hindsight_embed/daemon_embed_manager.py index c601cea3..d6b29b39 100644 --- a/hindsight-embed/hindsight_embed/daemon_embed_manager.py +++ b/hindsight-embed/hindsight_embed/daemon_embed_manager.py @@ -419,6 +419,8 @@ class DaemonEmbedManager(EmbedManager): """ try: api_config = {k: v for k, v in config.items() if k.startswith("HINDSIGHT_API_")} + if not api_config: + return self._profile_manager.create_profile(profile, port, api_config) except Exception as e: logger.debug(f"Failed to register profile '{profile}' in metadata: {e}")