Remove the legacy --single-process mode

coderai now always boots as the front proxy + supervised engine subprocess(es);
the one-process "UI/API and model work in the same process" mode is gone. This
unblocks removing the engine's now-dead UI/stats/data handlers (the engine only
ever runs as --engine-only behind the front).

Removed: the --single-process CLI flag (cli.py), config.server.single_process
(config.py + save), the proc-title branch and the run-mode branch (main.py), and
the arg from the engine spawn filter (engine_supervisor.py). Existing config.json
files with a stale single_process key are tolerated (_dc ignores unknown keys).

Verified: argparse rejects --single-process; --engine-only still parses.
Co-Authored-By: 's avatarClaude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011DDv7BchtZQWsnPG6Jm49m
parent b821f87c
...@@ -303,13 +303,6 @@ configuration directory (--config DIR, default: OS-specific CoderAI directory). ...@@ -303,13 +303,6 @@ configuration directory (--config DIR, default: OS-specific CoderAI directory).
"run (use after changing a model's quantization/precision config).", "run (use after changing a model's quantization/precision config).",
) )
# ─── Frontend/engine split ─────────────────────────────────────────────── # ─── Frontend/engine split ───────────────────────────────────────────────
parser.add_argument(
"--single-process",
action="store_true",
help="Run the legacy single-process server (UI/API and all model work in "
"one process). Default boots a front proxy + supervised engine "
"subprocess(es) so the web UI stays responsive during model work.",
)
parser.add_argument( parser.add_argument(
"--engine-only", "--engine-only",
action="store_true", action="store_true",
......
...@@ -41,12 +41,10 @@ class ServerConfig: ...@@ -41,12 +41,10 @@ class ServerConfig:
# use the default above. # use the default above.
max_parallel_requests_overrides: dict = field(default_factory=dict) max_parallel_requests_overrides: dict = field(default_factory=dict)
# ─── Frontend/engine split ─────────────────────────────────────────────── # ─── Frontend/engine split ───────────────────────────────────────────────
# By default coderai boots a thin, always-responsive *front* reverse proxy on # coderai boots a thin, always-responsive *front* reverse proxy on the public
# the public host/port and supervises one or more *engine* subprocesses (which # host/port and supervises one or more *engine* subprocesses (which do all
# do all GPU/model work) on internal localhost ports. This keeps the web UI # GPU/model work) on internal localhost ports. This keeps the web UI responsive
# responsive while a model loads or generates. Set single_process=True (or pass # while a model loads or generates.
# --single-process) to keep the legacy one-process behavior.
single_process: bool = False
internal_port_base: int = 8780 # first engine binds here; +1 per extra engine internal_port_base: int = 8780 # first engine binds here; +1 per extra engine
engines: int = 0 # 0 = auto (one per detected GPU, min 1) engines: int = 0 # 0 = auto (one per detected GPU, min 1)
engine_gpus: Optional[list] = None # explicit GPU indices, e.g. [0, 1]; None = auto engine_gpus: Optional[list] = None # explicit GPU indices, e.g. [0, 1]; None = auto
...@@ -595,7 +593,6 @@ class ConfigManager: ...@@ -595,7 +593,6 @@ class ConfigManager:
"queue_max_size": self.config.server.queue_max_size, "queue_max_size": self.config.server.queue_max_size,
"max_parallel_requests": self.config.server.max_parallel_requests, "max_parallel_requests": self.config.server.max_parallel_requests,
"max_parallel_requests_overrides": self.config.server.max_parallel_requests_overrides, "max_parallel_requests_overrides": self.config.server.max_parallel_requests_overrides,
"single_process": self.config.server.single_process,
"internal_port_base": self.config.server.internal_port_base, "internal_port_base": self.config.server.internal_port_base,
"engines": self.config.server.engines, "engines": self.config.server.engines,
"engine_gpus": self.config.server.engine_gpus, "engine_gpus": self.config.server.engine_gpus,
......
...@@ -283,7 +283,7 @@ class EngineSupervisor: ...@@ -283,7 +283,7 @@ class EngineSupervisor:
if skip_next: if skip_next:
skip_next = False skip_next = False
continue continue
if a in ("--single-process", "--engine-only"): if a == "--engine-only":
continue continue
if a == "--internal-port": if a == "--internal-port":
skip_next = True skip_next = True
......
...@@ -345,8 +345,6 @@ def _set_proc_title(): ...@@ -345,8 +345,6 @@ def _set_proc_title():
_ename = (os.environ.get("CODERAI_ENGINE_NAME") _ename = (os.environ.get("CODERAI_ENGINE_NAME")
or os.environ.get("CODERAI_ENGINE_BACKEND") or "engine") or os.environ.get("CODERAI_ENGINE_BACKEND") or "engine")
name = f"coderai-{_ename}" name = f"coderai-{_ename}"
elif "--single-process" in _argv:
name = "coderai"
else: else:
name = "coderai-front" name = "coderai-front"
try: try:
...@@ -604,10 +602,8 @@ def main(): ...@@ -604,10 +602,8 @@ def main():
# below runs in it (so its event loop is never blocked by model work). # below runs in it (so its event loop is never blocked by model work).
# --engine-only → this process IS an engine: bind an internal localhost # --engine-only → this process IS an engine: bind an internal localhost
# port and run the full app below (the front spawns these). # port and run the full app below (the front spawns these).
# --single-process → legacy: one process, full app on the public port.
_engine_only = getattr(args, "engine_only", False) _engine_only = getattr(args, "engine_only", False)
_single_process = getattr(args, "single_process", False) or config.server.single_process if not _engine_only:
if not _engine_only and not _single_process:
from codai.frontproxy import run_front from codai.frontproxy import run_front
run_front(config, args) run_front(config, args)
return return
...@@ -1342,9 +1338,8 @@ def main(): ...@@ -1342,9 +1338,8 @@ def main():
# Start the server # Start the server
import uvicorn import uvicorn
# The bind target: an engine binds 127.0.0.1:<internal-port> with plain HTTP # The bind target: an engine binds 127.0.0.1:<internal-port> with plain HTTP
# (the front owns the public host + TLS); single-process uses the configured # (the front owns the public host + TLS). config.server keeps the CONFIGURED
# public host/port/https. config.server keeps the CONFIGURED values either way # values so the settings API reports them correctly.
# so the settings API reports them correctly.
if getattr(args, 'engine_only', False): if getattr(args, 'engine_only', False):
bind_host = "127.0.0.1" bind_host = "127.0.0.1"
bind_port = int(getattr(args, "internal_port", None) bind_port = int(getattr(args, "internal_port", None)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment