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(install): pass sc.exe create as raw command line so binPath= quoting survives (#1654) (#1702)
Parideboyd6e071022837
diff --git a/headroom/install/supervisors.py b/headroom/install/supervisors.pyindex ef00d0aaf..dad1c2159 100644--- a/headroom/install/supervisors.py+++ b/headroom/install/supervisors.py@@ -261,11 +261,16 @@ def install_supervisor(manifest: DeploymentManifest) -> list[ArtifactRecord]:return recordsif _is_windows() and manifest.supervisor_kind == SupervisorKind.SERVICE.value:- service_bin = f'cmd.exe /c "{windows_run_cmd_path(manifest.profile)}"'- subprocess.run(- ["sc.exe", "create", manifest.service_name, f"binPath= {service_bin}", "start= auto"],- check=True,+ # sc.exe's binPath= value embeds its own quotes (cmd.exe /c "<path>").+ # Passing this as an argv list lets subprocess.list2cmdline re-quote the+ # token and sc.exe mis-tokenizes it (issue #1654), so build the exact+ # command line ourselves and hand subprocess a string.+ run_cmd = windows_run_cmd_path(manifest.profile)+ create_cmd = (+ f"sc.exe create {manifest.service_name} "+ f'binPath= "cmd.exe /c \\"{run_cmd}\\"" start= auto')+ subprocess.run(create_cmd, check=True)subprocess.run(["sc.exe", "failure", manifest.service_name, "reset= 0", "actions= restart/5000"],check=True,diff --git a/tests/test_install/test_supervisors.py b/tests/test_install/test_supervisors.pyindex 161cc8629..c43030341 100644--- a/tests/test_install/test_supervisors.py+++ b/tests/test_install/test_supervisors.py@@ -308,13 +308,13 @@ def test_install_supervisor_darwin_windows_and_unsupported(monkeypatch, tmp_pathwin_task = install_supervisor(_manifest(supervisor=SupervisorKind.TASK.value))assert win_service[-1].kind == "windows-service"assert win_task[-2].path.endswith("-startup")- assert [- "sc.exe",- "create",- "headroom-default",- 'binPath= cmd.exe /c "C:\\tmp\\default\\run-headroom.cmd"',- "start= auto",- ] in calls+ # Regression for #1654: the create command must be a single pre-quoted+ # string (bypassing list2cmdline) with the inner quotes backslash-escaped+ # and `start= auto` as a separate trailing token.+ assert (+ "sc.exe create headroom-default "+ 'binPath= "cmd.exe /c \\"C:\\tmp\\default\\run-headroom.cmd\\"" start= auto'+ ) in callsassert ["schtasks","/Create",