Compress tool outputs, logs, files, and RAG chunks before they reach the LLM. 20% fewer tokens for coding agents, 60-95% fewer tokens for JSON, same answers. Library, proxy, MCP server.
Python agentaianthropicclaude-codecompressioncontext-engineeringcontext-windowcursorfastapilangchainllmmcpopenaiprompt-engineeringproxypythonragtoken-optimizationtokenstypescript
fix(update-check): skip releases with no files and do not fall back to an uninstallable version (#4560)
HetCreepc1dae5adae2b
diff --git a/headroom/update_check.py b/headroom/update_check.pyindex 77f24eae5..355f84c6e 100644--- a/headroom/update_check.py+++ b/headroom/update_check.py@@ -158,11 +158,9 @@ def _select_latest(data: dict[str, Any], *, allow_pre: bool) -> str | None:candidates: list[Version] = []if isinstance(releases, dict):for ver_str, files in releases.items():- # Skip releases whose every artifact is yanked.- if (- isinstance(files, list)- and files- and all(isinstance(f, dict) and f.get("yanked") for f in files)+ # Skip releases with no artifacts, or whose every artifact is yanked.+ if isinstance(files, list) and (+ not files or all(isinstance(f, dict) and f.get("yanked") for f in files)):continuetry:@@ -174,6 +172,10 @@ def _select_latest(data: dict[str, Any], *, allow_pre: bool) -> str | None:candidates.append(ver)if candidates:return str(max(candidates))+ if isinstance(releases, dict) and releases:+ # Releases are listed but none is installable (all yanked or file-less):+ # do not fall back to info.version, which names one of them.+ return None# Fallback to info.version when releases is absent/empty.info = data.get("info")diff --git a/tests/test_update_check.py b/tests/test_update_check.pyindex 7f00917ec..24a8e6596 100644--- a/tests/test_update_check.py+++ b/tests/test_update_check.py@@ -69,6 +69,18 @@ def test_select_latest_skips_fully_yanked():assert uc._select_latest(data, allow_pre=False) == "0.26.0"+def test_select_latest_skips_release_with_no_files():+ data = {"releases": {"1.0.0": [{"yanked": False}], "9.9.9": []}}+ assert uc._select_latest(data, allow_pre=False) == "1.0.0"+++def test_select_latest_no_fallback_when_every_release_is_unavailable():+ data = {"releases": {"9.9.9": []}, "info": {"version": "9.9.9"}}+ assert uc._select_latest(data, allow_pre=False) is None+ data = {"releases": {"9.9.9": [{"yanked": True}]}, "info": {"version": "9.9.9"}}+ assert uc._select_latest(data, allow_pre=False) is None++def test_select_latest_falls_back_to_info_version():data = {"releases": {}, "info": {"version": "0.26.0"}}assert uc._select_latest(data, allow_pre=False) == "0.26.0"