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
patch: Fix fcc-cline reconnecting to a stale Cline Hub (#1590) (#1641)
Tanishq-1d59300974083
diff --git a/src/free_claude_code/cli/launchers/cline.py b/src/free_claude_code/cli/launchers/cline.pyindex 4520957f..664e0d88 100644--- a/src/free_claude_code/cli/launchers/cline.py+++ b/src/free_claude_code/cli/launchers/cline.py@@ -1,4 +1,10 @@-"""Installed Cline launcher with private native provider settings."""+"""Installed Cline launcher with private native provider settings.++Sessions run with an isolated Hub discovery path so a stale or user-run Cline+Hub can never capture an fcc-cline session: the child resolves Hub state only+inside FCC's ephemeral configuration directory, which is deleted on exit. A+Hub started with ordinary cline keeps using its own discovery file.+"""import refrom collections.abc import Sequence@@ -29,6 +35,17 @@ def _configure()providers_path = files.write_json("settings/providers.json", config.providers)files.write_json("settings/models.json", config.models)+ # Interactive Cline passes backendMode:"auto" to core, which overrides+ # CLINE_SESSION_BACKEND_MODE and may attach to (or start) a detached Hub+ # that resolves provider settings from the user's global store instead of+ # FCC's ephemeral files. Redirecting Hub discovery into the ephemeral tree+ # makes that attachment impossible without touching user-run Hub state.+ # (Verified: shipped Cline 3.0.57 honors CLINE_HUB_DISCOVERY_PATH as the+ # discovery-path override in its hub resolver.)+ hub_discovery_path = files.directory / "hub" / "production.json"+ # Pre-create the directory, not the file: the child records Hub discovery+ # state here on startup, and the Hub itself must own the file.+ hub_discovery_path.parent.mkdir(parents=True, mode=0o700, exist_ok=True)return PreparedLaunch([ctx.binary_path, "--provider", CLINE_PROVIDER_ID, *args],client_environment(@@ -37,6 +54,7 @@ def _configure(updates={"CLINE_PROVIDER_SETTINGS_PATH": str(providers_path),"CLINE_SESSION_BACKEND_MODE": "local",+ "CLINE_HUB_DISCOVERY_PATH": str(hub_discovery_path),},),)diff --git a/tests/cli/test_cline_launcher.py b/tests/cli/test_cline_launcher.pyindex 7d2a0c47..c7939a3e 100644--- a/tests/cli/test_cline_launcher.py+++ b/tests/cli/test_cline_launcher.py@@ -139,6 +139,7 @@ def test_cline_native_configuration_is_available_to_child(launch_capture) -> Nonfrom tests.cli.test_launcher_workflow import launchlaunch_ids = []+ hub_paths = []def inspect(command, env):providers_path = Path(env["CLINE_PROVIDER_SETTINGS_PATH"])@@ -152,6 +153,16 @@ def test_cline_native_configuration_is_available_to_child(launch_capture) -> Nonassert settings["model"] in models["providers"][CLINE_PROVIDER_ID]["models"]assert env["CLINE_SESSION_BACKEND_MODE"] == "local"assert command[:3] == ["cline", "--provider", "openai-native"]+ hub_path = Path(env["CLINE_HUB_DISCOVERY_PATH"])+ assert hub_path.parent.name == "hub"+ assert hub_path.name == "production.json"+ # Hub discovery must resolve inside the same ephemeral tree as the+ # private provider files. The hub/ directory is pre-created so the+ # child can record discovery state; the file itself must not exist.+ assert hub_path.parent.parent == providers_path.parent.parent+ assert hub_path.parent.is_dir()+ assert not hub_path.exists()+ hub_paths.append(hub_path)launch_capture.on_start = inspectargs = ["--model", "native-selection", "--data-dir", "native-data-dir"]@@ -159,3 +170,32 @@ def test_cline_native_configuration_is_available_to_child(launch_capture) -> Nonassert launch_capture.commands[0][-len(args) :] == argslaunch("cline", [])assert launch_ids[0] != launch_ids[1]+ assert hub_paths[0] != hub_paths[1]+ assert all(not hub_path.exists() for hub_path in hub_paths)+++def test_cline_hub_discovery_path_overrides_stale_inherited_value(+ launch_capture, monkeypatch: pytest.MonkeyPatch+) -> None:+ from tests.cli.test_launcher_workflow import launch++ monkeypatch.setenv("CLINE_HUB_DISCOVERY_PATH", "stale-user-hub-discovery.json")+ dir_existed_at_start = []++ def inspect(command, env):+ hub_dir = Path(env["CLINE_HUB_DISCOVERY_PATH"]).parent+ dir_existed_at_start.append(hub_dir.is_dir())++ launch_capture.on_start = inspect+ launch("cline", [])+ hub_path = Path(launch_capture.environments[0]["CLINE_HUB_DISCOVERY_PATH"])+ # The stale user-level discovery file must be replaced by the isolated+ # ephemeral path, never inherited by the fcc-cline child. The hub/+ # directory is pre-created at launch (checked via on_start, since the+ # ephemeral tree is cleaned up when the launcher exits); only the file+ # itself must not be pre-created.+ assert hub_path.name == "production.json"+ assert hub_path.parent.name == "hub"+ assert str(hub_path) != "stale-user-hub-discovery.json"+ assert dir_existed_at_start == [True]+ assert not hub_path.exists()