Skip to content

OMI_DEV_HOST cannot make the dev harness reachable from a physical device — the harness binds 127.0.0.1 unconditionally #11774

Closed

Description

@formed2forge

The documented physical-device setup cannot work: OMI_DEV_HOST only changes what the app is compiled against, and the harness always binds loopback.

docs/doc/developer/AppSetup.mdx:152 tells a contributor: "On a physical iPhone, set OMI_DEV_HOST to your Mac's LAN address so the device can reach the harness." AppSetup.mdx:328 and app/README.md:50 say the same. Following that literally cannot succeed, because nothing ever makes the harness listen on that address.

Verified on a clean clone of main at 015172400b, harness started with PROVIDER_MODE=offline make dev-up (all seven services healthy).

The harness binds loopback with a hardcoded literal. scripts/dev-harness/dev_harness/cli.py:767 starts the backend as:

[sys.executable, "-m", "uvicorn", "main:app", "--host", "127.0.0.1", "--port", str(cfg.backend_port)],

The host is a string literal, not read from config or environment. The same is true of llm-gateway (cli.py:753-758) and desktop-backend (cli.py:778-787), and cli.py:609 rewrites the Firebase emulator hosts to 127.0.0.1 when generating the harness's firebase.json.

OMI_DEV_HOST is build-side only. Across the whole repo it occurs in exactly two code locations, both in app/setup.sh (:53, :55), plus three doc locations (app/README.md:50, AppSetup.mdx:152, :328). It appears nowhere under scripts/dev-harness/. The harness never reads it. It changes the URL the app is compiled against and nothing else — so the app is pointed at an address where no service is listening.

Measured, from the Mac itself:

lsof -nP -iTCP:8000 -sTCP:LISTEN   ->  Python  TCP 127.0.0.1:8000 (LISTEN)
lsof -nP -iTCP:9099 -sTCP:LISTEN   ->  node    TCP 127.0.0.1:9099 (LISTEN)

curl http://192.168.2.81:8000/     ->  000 in 0.0039s   (refused; 192.168.2.81 is this Mac's LAN address)
curl http://127.0.0.1:8000/        ->  200 in 0.0021s
curl http://192.168.2.81:9099/     ->  000 in 0.0013s
curl http://127.0.0.1:9099/        ->  200 in 0.0009s

A phone pointed at the LAN address reaches nothing — the connection is refused before it leaves the Mac.

This is not a one-line bind change, which is why I'm filing rather than PR-ing. The loopback posture looks deliberate and fail-closed: scripts/dev-harness/dev_harness/safety.py:181 defines is_loopback_host, :194 defines validate_loopback_emulator_host ("host must point to loopback"), and it is enforced at safety.py:210, safety.py:635 (Redis) and desktop_profile.py:259-260 ("Firebase Auth emulator host must be loopback"). Binding the LAN interface would relax a guard someone added on purpose, so the call belongs to whoever owns that guard.

Two shapes, both reasonable:

  1. Docs-only — state that a physical device needs a proxy/tunnel from the Mac's reachable address to 127.0.0.1:8000 and :9099, and drop the claim that OMI_DEV_HOST alone is sufficient. Cheapest, and honest about the current design.
  2. Opt-in bind — an explicit OMI_DEV_BIND_HOST (or OMI_DEV_HOST also driving the bind) that binds the app-facing services to the LAN interface, with the safety guard widened deliberately to permit RFC 1918 while still refusing public addresses.

Whichever is chosen, OMI_DEV_HOST should not silently produce a build that cannot reach anything.

Context / relation to other issues. This is the complement to #11534, and it corrects an assumption in it: #11534 says "setup.sh honours OMI_DEV_HOST (setup.sh:53) for exactly this, but nothing tells a contributor they need it" — which is true of the build side, but setting it still does not yield a reachable harness. So the reachability advice in #11534 and in the docs is incomplete in the same way.

Worth noting for anyone who has had device builds working: a proxy in front of the harness (in my case tailscale serve mapping :8000/:9099 to 127.0.0.1) makes all of this work and completely hides the gap. Every device-side success I had recorded turned out to depend on that undocumented extra step, not on OMI_DEV_HOST.

Found while running the documented iOS pathway end-to-end from a fresh clone as a new contributor would.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions