From b8400242e43e4889ede62c4419ede0f2a515492a Mon Sep 17 00:00:00 2001 From: Farouk Adeleke Date: Sat, 24 Jan 2026 01:25:11 -0800 Subject: [PATCH] Fix config override bug by recreating LMs after load_state --- nanocode.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/nanocode.py b/nanocode.py index be4ebc0..54482b8 100644 --- a/nanocode.py +++ b/nanocode.py @@ -23,7 +23,6 @@ MAGENTA = "\033[35m" # --- File operations --- - def read_file(path: str, offset: int = 0, limit: int = None) -> str: """Read file contents with line numbers. @@ -164,6 +163,8 @@ def run_bash(cmd: str) -> str: return "".join(output_lines).strip() or "(empty output)" +# -- Program --- + class CodingAssistant(dspy.Signature): """You are a concise coding assistant with access to sub agents.""" @@ -270,7 +271,8 @@ class RLMCodingProgram(PrecompiledProgram): track_usage=self.config.track_usage, ) self.reload_repl() - print(f"{BLUE}LMs RELOADED: {self.lm.model}, {self.sub_lm.model}{RESET}") + if os.getenv("MODAIC_ENV") == "dev": + print(f"{BLUE}LMs RELOADED: {self.lm.model}, {self.sub_lm.model}{RESET}") def load_state(self, state): """Override to recreate LMs from config after loading state.