Skip to content

Use Claude Code, Codex, VSCode, Pi, and OpenCode (and 6 other harnesses) for free (1.3B+ free tokens) from your terminal, app, IDE, or phone, and now from the browser with native browser sessions (multi-harness + multi-model) like OpenClaw (voice supported + ToS friendly)

Python

fix(smoke): avoid nested uv run on Windows for child processes

Alishahryar12e4a4fe63a06
diff --git a/messaging/platforms/factory.py b/messaging/platforms/factory.py
index 4b4bf270..b34b1100 100644
--- a/messaging/platforms/factory.py
+++ b/messaging/platforms/factory.py
@@ -55,6 +55,7 @@ def create_messaging_platform(
)
logger.warning(
- f"Unknown messaging platform: '{platform_type}'. Supported: 'telegram', 'discord'"
+ f"Unknown messaging platform: '{platform_type}'. "
+ "Supported: 'none', 'telegram', 'discord'"
)
return None
diff --git a/smoke/README.md b/smoke/README.md
index 769a9c2e..f4a9220a 100644
--- a/smoke/README.md
+++ b/smoke/README.md
@@ -98,6 +98,13 @@ uv run pytest smoke/product -n 0 -s --tb=short
- `FCC_SMOKE_INTERACTIVE=1`: enables manual inbound Telegram/Discord checks.
- `FCC_SMOKE_RUN_VOICE=1`: allows voice transcription backends to load/run.
+## Windows / nested `uv run`
+
+Run smoke the same way you run tests (`uv run pytest smoke` from the repo). Child
+processes use the **same Python interpreter** as the test runner, not nested
+`uv run`, so Windows does not try to replace `free-claude-code.exe` while it is
+locked.
+
## Failure Classes
Smoke artifacts are written to `.smoke-results/` and redact env values whose
diff --git a/smoke/lib/child_process.py b/smoke/lib/child_process.py
new file mode 100644
index 00000000..a61f7057
--- /dev/null
+++ b/smoke/lib/child_process.py
@@ -0,0 +1,44 @@
+"""Child-process commands for smoke (avoid nested ``uv run`` on Windows).
+
+Nested ``uv run`` can try to refresh console scripts while they are locked
+(``free-claude-code.exe`` in use), causing flaky smoke. The smoke runner is
+already executed under the project environment (``uv run pytest``), so children
+should use the same interpreter.
+"""
+
+from __future__ import annotations
+
+import sys
+
+
+def python_exe() -> str:
+ return sys.executable
+
+
+def cmd_python_c(script: str) -> list[str]:
+ return [python_exe(), "-c", script]
+
+
+def cmd_uvicorn_server_app(
+ host: str, port: int, *, graceful_shutdown_s: int = 5
+) -> list[str]:
+ return [
+ python_exe(),
+ "-m",
+ "uvicorn",
+ "server:app",
+ "--host",
+ host,
+ "--port",
+ str(port),
+ "--timeout-graceful-shutdown",
+ str(graceful_shutdown_s),
+ ]
+
+
+def cmd_fcc_init() -> list[str]:
+ return [python_exe(), "-c", "from cli.entrypoints import init; init()"]
+
+
+def cmd_free_claude_code_serve() -> list[str]:
+ return [python_exe(), "-c", "from cli.entrypoints import serve; serve()"]
diff --git a/smoke/lib/server.py b/smoke/lib/server.py
index d5074d7d..11f5ea56 100644
--- a/smoke/lib/server.py
+++ b/smoke/lib/server.py
@@ -13,6 +13,7 @@ from pathlib import Path
import httpx
+from .child_process import cmd_uvicorn_server_app
from .config import SmokeConfig, redacted
@@ -55,18 +56,7 @@ def start_server(
if env_overrides:
env.update(env_overrides)
- cmd = command or [
- "uv",
- "run",
- "uvicorn",
- "server:app",
- "--host",
- "127.0.0.1",
- "--port",
- str(port),
- "--timeout-graceful-shutdown",
- "5",
- ]
+ cmd = command or cmd_uvicorn_server_app("127.0.0.1", port)
with log_path.open("ab") as log_file:
process = subprocess.Popen(
diff --git a/smoke/prereq/test_cli_prereq_live.py b/smoke/prereq/test_cli_prereq_live.py
index 0cbcd158..aaa25969 100644
--- a/smoke/prereq/test_cli_prereq_live.py
+++ b/smoke/prereq/test_cli_prereq_live.py
@@ -7,6 +7,7 @@ from pathlib import Path
import pytest
+from smoke.lib.child_process import cmd_fcc_init, cmd_free_claude_code_serve
from smoke.lib.config import SmokeConfig
from smoke.lib.server import start_server
from smoke.lib.skips import skip_upstream_unavailable
@@ -21,7 +22,7 @@ def test_fcc_init_scaffolds_user_config(
env["HOME"] = str(tmp_path)
env["USERPROFILE"] = str(tmp_path)
result = subprocess.run(
- ["uv", "run", "fcc-init"],
+ cmd_fcc_init(),
cwd=smoke_config.root,
env=env,
capture_output=True,
@@ -36,7 +37,7 @@ def test_fcc_init_scaffolds_user_config(
def test_free_claude_code_entrypoint_starts_server(smoke_config: SmokeConfig) -> None:
with start_server(
smoke_config,
- command=["uv", "run", "free-claude-code"],
+ command=cmd_free_claude_code_serve(),
env_overrides={"MESSAGING_PLATFORM": "none"},
name="entrypoint",
) as server:
diff --git a/smoke/product/test_cli_package_product_live.py b/smoke/product/test_cli_package_product_live.py
index a0a37f86..066783bb 100644
--- a/smoke/product/test_cli_package_product_live.py
+++ b/smoke/product/test_cli_package_product_live.py
@@ -10,6 +10,7 @@ import pytest
from cli.manager import CLISessionManager
from cli.session import CLISession
+from smoke.lib.child_process import cmd_fcc_init
from smoke.lib.config import SmokeConfig
pytestmark = [pytest.mark.live, pytest.mark.smoke_target("cli")]
@@ -20,7 +21,7 @@ def test_entrypoint_init_e2e(smoke_config: SmokeConfig, tmp_path: Path) -> None:
env["HOME"] = str(tmp_path)
env["USERPROFILE"] = str(tmp_path)
result = subprocess.run(
- ["uv", "run", "fcc-init"],
+ cmd_fcc_init(),
cwd=smoke_config.root,
env=env,
capture_output=True,
diff --git a/smoke/product/test_config_extensibility_product_live.py b/smoke/product/test_config_extensibility_product_live.py
index 627d269f..50d3d00d 100644
--- a/smoke/product/test_config_extensibility_product_live.py
+++ b/smoke/product/test_config_extensibility_product_live.py
@@ -8,6 +8,7 @@ import pytest
from config.settings import Settings
from messaging.platforms.factory import create_messaging_platform
from providers.registry import PROVIDER_DESCRIPTORS, build_provider_config
+from smoke.lib.child_process import cmd_free_claude_code_serve, cmd_python_c
from smoke.lib.config import SmokeConfig
from smoke.lib.e2e import SmokeServerDriver
@@ -31,7 +32,7 @@ def test_env_precedence_e2e(smoke_config: SmokeConfig, tmp_path) -> None:
"print(s.model); print(s.anthropic_auth_token)"
)
result = subprocess.run(
- ["uv", "run", "python", "-c", script],
+ cmd_python_c(script),
cwd=smoke_config.root,
env=env,
capture_output=True,
@@ -51,13 +52,7 @@ def test_removed_env_migration_e2e(smoke_config: SmokeConfig, tmp_path) -> None:
env = os.environ.copy()
env["FCC_ENV_FILE"] = str(env_file)
result = subprocess.run(
- [
- "uv",
- "run",
- "python",
- "-c",
- "from config.settings import Settings; Settings()",
- ],
+ cmd_python_c("from config.settings import Settings; Settings()"),
cwd=smoke_config.root,
env=env,
capture_output=True,
@@ -91,7 +86,7 @@ def test_proxy_timeout_config_e2e(smoke_config: SmokeConfig, tmp_path) -> None:
"print(c.http_connect_timeout); print(c.http_write_timeout)"
)
result = subprocess.run(
- ["uv", "run", "python", "-c", script],
+ cmd_python_c(script),
cwd=smoke_config.root,
env=env,
capture_output=True,
@@ -135,7 +130,7 @@ def test_entrypoint_server_e2e(smoke_config: SmokeConfig) -> None:
with SmokeServerDriver(
smoke_config,
name="product-entrypoint",
- command=["uv", "run", "free-claude-code"],
+ command=cmd_free_claude_code_serve(),
env_overrides={"MESSAGING_PLATFORM": "none"},
).run() as server:
assert server.process.poll() is None