Skip to content

Qwen3.8-Flash-Next on any consumer hardware: one-click install for Windows / Linux. Strata inference engine, OpenAI/Anthropic API on localhost, optional image input.

C++

Fix #3188: strata_bench names the port it starts its own server on

Niko1221461d0baee701
diff --git a/tests/terminal/test_issues_022.py b/tests/terminal/test_issues_022.py
index 9de268ec4..f6e125812 100644
--- a/tests/terminal/test_issues_022.py
+++ b/tests/terminal/test_issues_022.py
@@ -65,6 +65,35 @@ class Issue3298MtpDepth(unittest.TestCase):
self.assertEqual(files_present({"args": ["--mtp", str(self.root / "gone")]}), [str(self.root / "gone")])
+class Issue3188BenchStartsItsOwnServer(unittest.TestCase):
+ """tools/strata_bench.py named `port` in the start-a-server branch without ever setting it."""
+
+ def test_the_start_branch_runs_with_the_config_port(self):
+ from unittest import mock
+ from tools import strata_bench as sb
+ import io
+ from contextlib import redirect_stdout
+ with tempfile.TemporaryDirectory() as tmp:
+ cfg = Path(tmp) / "run.json"
+ cfg.write_text(json.dumps({"port": 18999, "args": []}), encoding="utf-8")
+ started = []
+ with mock.patch.object(sb, "is_strata", return_value=False), \
+ mock.patch.object(sb, "try_json", return_value=None), \
+ mock.patch.object(sb, "start_server", side_effect=lambda c, p, g, log: started.append(p) or object()), \
+ mock.patch.object(sb, "wait_ready", return_value=False), \
+ mock.patch.object(sb, "stop_server"):
+ out = io.StringIO()
+ with redirect_stdout(out), mock.patch("sys.stderr", io.StringIO()):
+ code = sb.main(["--config", str(cfg)])
+ self.assertEqual(code, 1)
+ self.assertEqual(started, [18999])
+ self.assertIn("on port 18999", out.getvalue())
+ started.clear()
+ with redirect_stdout(io.StringIO()), mock.patch("sys.stderr", io.StringIO()):
+ sb.main(["--config", str(cfg), "--port", "18777"])
+ self.assertEqual(started, [18777])
+
+
@unittest.skipUnless(sys.platform == "win32", "SDDL aliases exist on Windows only")
class Issue3302AdministratorAlias(unittest.TestCase):
"""SDDL prints the built-in Administrator (RID 500) as `LA`; the owner-only checks must still accept it."""
diff --git a/tools/strata_bench.py b/tools/strata_bench.py
index 3a9877fc9..93d92ee1d 100644
--- a/tools/strata_bench.py
+++ b/tools/strata_bench.py
@@ -975,7 +975,8 @@ def main(argv=None) -> int:
if a.url:
base = a.url.rstrip("/")
else:
- base = server_base(cfg.get("host"), a.port or int(cfg.get("port", 8080)))
+ port = a.port or int(cfg.get("port", 8080))
+ base = server_base(cfg.get("host"), port)
red = redactor(key=key)
started = False
try: