fix: doctor reports a bad DOCSGPT_PORT instead of raising on it

_port_number was written so a hand-edited .env could not reach int() raw, and
then doctor did exactly that: a nonnumeric port ended the command with a
traceback rather than the message, in the one command whose job is to explain a
broken setup.
This commit is contained in:
Alex committed 2026-09-17 11:43:53 +01:00
1 parent 731baa7d31
commit bcf2707efa
2 files changed
+14 -1

No files matched your search

+3 -1
View File
@@ -862,7 +862,9 @@ def doctor(args, context: Optional[Context] = None) -> int:
_check_provider(env),
]
port = int(env.get("DOCSGPT_PORT") or stack.DEFAULT_PORT)
# The one command that exists to explain a broken setup must not fall over on one.
port = _port_number(env["DOCSGPT_PORT"], f"DOCSGPT_PORT in {env_path}") if env.get("DOCSGPT_PORT") \
else stack.DEFAULT_PORT
if _port_is_free(port):
checks.append(Check("port", "ok", f"{port} is free"))
else: