Skip to content

Commit 62094d3

Browse files
QUSETIONSclaude
andcommitted
perf/fix: prompt_pipeline lru_cache leak + clear_cache stale; prompt Any hint
prompt_pipeline._build_cached had @lru_cache(maxsize=1) on an instance method that is called once per fresh PromptPipeline: the cache never helped (new instance each turn → miss) and (a) leaked the instance via the bound-method cache and (b) made clear_cache() ineffective (lru_cache returned a stale string after sections were cleared). Removed the decorator so each build() rebuilds and clear_cache actually invalidates. prompt.py: drop a stray `: Any` annotation that referenced an unimported name. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 0c6149d commit 62094d3

2 files changed

Lines changed: 1 addition & 3 deletions

File tree

minicode/prompt.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ def _build_skills():
200200
# MCP servers section
201201
mcp_servers = extras.get("mcpServers", [])
202202
if mcp_servers:
203-
def _server_line(server: Any) -> str:
203+
def _server_line(server) -> str:
204204
# Guard each entry so one malformed server (missing keys / non-dict)
205205
# can't crash the whole system-prompt build.
206206
if not isinstance(server, dict):

minicode/prompt_pipeline.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
from __future__ import annotations
1515

16-
import functools
1716
import hashlib
1817
import time
1918
from dataclasses import dataclass, field
@@ -102,7 +101,6 @@ def build(self) -> str:
102101
"""Assemble the full system prompt with cache boundary marker."""
103102
return self._build_cached()
104103

105-
@functools.lru_cache(maxsize=1)
106104
def _build_cached(self) -> str:
107105
"""Assemble the full system prompt with cache boundary marker."""
108106
parts: list[str] = []

0 commit comments

Comments
 (0)