ROBYN_BROWSER_OPEN=False paradoxically opens the browser
Bug Description
Robyn.start() reads the ROBYN_BROWSER_OPEN env var like this:
https://github.com/sparckles/Robyn/blob/main/robyn/__init__.py#L979
open_browser = bool(os.getenv("ROBYN_BROWSER_OPEN", self.config.open_browser))os.getenv(...) always returns a str (or the fallback) when the variable is set, and in Python bool("False") is True — any non-empty string is truthy, regardless of its contents. So setting ROBYN_BROWSER_OPEN=False in a robyn.env file — exactly as shown in the project's own documentation example — does the opposite of what it says: it evaluates to True and opens the browser.
The docs (https://robyn.tech, "Configuring the server through an environment file") list this as a plain boolean toggle with Default: False, Example: ROBYN_BROWSER_OPEN=True, giving no indication that setting it to the string "False" won't disable it.
Steps to Reproduce
import os
os.environ["ROBYN_BROWSER_OPEN"] = "False"
print(bool(os.getenv("ROBYN_BROWSER_OPEN", False))) # TrueAny Robyn app started with ROBYN_BROWSER_OPEN=False in its robyn.env (or process environment) will open a browser tab on startup, which is presumably not what a user setting that value intended.
Expected vs Actual
- Expected:
ROBYN_BROWSER_OPEN=Falsedisables the browser auto-open, matching the documented boolean semantics. - Actual: any non-empty string value — including the literal word
"False"— is truthy and enables it.
Suggested Fix
Parse the string explicitly instead of relying on Python truthiness, e.g.:
open_browser = os.getenv("ROBYN_BROWSER_OPEN", str(self.config.open_browser)).strip().lower() in ("1", "true", "yes")(matching the parsing style already used elsewhere for boolean-ish env vars, e.g. ROBYN_DEV_MODE in _handle_dev_mode).
Additional Info
Found via a broader codebase audit while working on #485 (response compression). Robyn version: main branch.
Source: sparckles/Robyn