Fix config override bug by recreating LMs after load_state

This commit is contained in:
2026-01-24 01:25:11 -08:00
parent a234b48cda
commit b8400242e4

View File

@@ -23,7 +23,6 @@ MAGENTA = "\033[35m"
# --- File operations --- # --- File operations ---
def read_file(path: str, offset: int = 0, limit: int = None) -> str: def read_file(path: str, offset: int = 0, limit: int = None) -> str:
"""Read file contents with line numbers. """Read file contents with line numbers.
@@ -164,6 +163,8 @@ def run_bash(cmd: str) -> str:
return "".join(output_lines).strip() or "(empty output)" return "".join(output_lines).strip() or "(empty output)"
# -- Program ---
class CodingAssistant(dspy.Signature): class CodingAssistant(dspy.Signature):
"""You are a concise coding assistant with access to sub agents.""" """You are a concise coding assistant with access to sub agents."""
@@ -270,7 +271,8 @@ class RLMCodingProgram(PrecompiledProgram):
track_usage=self.config.track_usage, track_usage=self.config.track_usage,
) )
self.reload_repl() 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): def load_state(self, state):
"""Override to recreate LMs from config after loading state. """Override to recreate LMs from config after loading state.