Skip to content

fix(dev-harness): keep local desktop auth-scoped calls off production - #17302

Merged
Git-on-my-level merged 1 commit into
mainfrom
fix/dev-harness-local-auth-api-url
Sep 23, 2026
Merged

Git-on-my-level merged 1 commit into
mainfrom
fix/dev-harness-local-auth-api-url

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Sep 23, 2026 •

Copy link
Copy Markdown
Member

Bug

The local dev-harness desktop profile (scripts/dev-harness/dev_harness/desktop_profile.py) set OMI_PYTHON_API_URL and OMI_DESKTOP_API_URL but not OMI_AUTH_API_URL. The macOS app's DesktopBackendEnvironment.authBaseURL() therefore fell back to the production API for auth-scoped calls (GET /v2/desktop/prompts, GET /v1/csat/config). A local named bundle sent its Firebase Auth emulator token to production, got 401, and AuthSessionCoordinator treated the post-refresh 401 as a dead session (invalidateSession reason=postRefreshHTTP401) — so every local desktop profile signed itself out about a second after signing in.

Fix

Set OMI_AUTH_API_URL to the local python backend (same value as OMI_PYTHON_API_URL) so auth-scoped calls stay on the loopback backend instead of silently defaulting to production.

Verification

  • python -m pytest -q scripts/dev-harness/tests/test_desktop_profile.py → 5 passed in 0.02s (interpreter selected the way scripts/dev-harness/run-tests.sh selects it).
  • bash scripts/dev-harness/run-tests.sh → 550 passed, 6 skipped, 20 xfailed, 23 subtests passed in 100.35s, run with the documented local setup: backend/.venv provisioned by scripts/dev-harness/lane-backend.sh, PYTHONPATH=<repo>/backend, and a non-symlinked TMPDIR (macOS /tmp→/private/tmp breaks three test_native_probe_builds path tests locally; CI's Linux runners are unaffected).
  • Live behavior, verified in the session that developed the fix: after the fix a local named bundle stays signed in, and GET /v2/desktop/prompts and GET /v1/csat/config return 200 from the local backend.

Found while validating #17281.

Note on the dev-harness-unit-tests check (pre-existing on main, unrelated to this diff)

#17284 (current main HEAD) added from utils.llm.model_config import LUNA_MODEL to the shared fake backend/testing/e2e/fakes/llm.py, which this lane loads by file path. In the lean interpreter environments the lane runs under (no backend package on sys.path, no openai/langchain-openai deps — exactly CI's Repo Checks Hygiene job), that import chain fails with ModuleNotFoundError: No module named 'utils', taking ~12 tests red. Reproduced on clean origin/main (268e04e) with this branch's change stashed: the same tests fail identically. No PR since #17284 has selected this check (backend-only paths don't trigger it), so CI has not surfaced it yet. This PR's two-file diff doesn't touch the fake or the loader; the failure is expected to track main until #17284's collateral is fixed upstream.

Product invariants affected

none

Failure class (fixes)

Failure-Class: FC-hermetic-suite-points-at-remote-api

The violated contract — a local development context must not send its traffic to a non-loopback API — is the same shape here: an unset auth endpoint let the desktop profile silently fall back to the production API, like the leftover remote API_BASE_URL that class was minted for.

🤖 Generated with Claude Code

Review in cubic

The local dev harness desktop profile set OMI_PYTHON_API_URL and
OMI_DESKTOP_API_URL but not OMI_AUTH_API_URL, so the macOS app's
DesktopBackendEnvironment.authBaseURL() fell back to the production API
for auth-scoped calls (GET /v2/desktop/prompts, GET /v1/csat/config).
A local named bundle sent its Firebase Auth emulator token to
production, got 401, and AuthSessionCoordinator treated the
post-refresh 401 as a dead session (invalidateSession
reason=postRefreshHTTP401), signing every local desktop profile out
about a second after signing in.

Point OMI_AUTH_API_URL at the local python backend, same as
OMI_PYTHON_API_URL, so auth-scoped calls stay on the local backend.
Verified locally: with the fix the bundle stays signed in and those
calls return 200 from the local backend;
scripts/dev-harness/tests/test_desktop_profile.py passes (5 tests).

Co-Authored-By: ZCode (GLM-5.3) on behalf of Claude Code session
@Git-on-my-level

Copy link
Copy Markdown
Member Author

Hygiene / dev-harness-unit-tests is red for a reason that pre-dates this PR and is unrelated to its diff — documenting per the pre-existing-failure practice.

cc @beastoin — flagging since #17284 is yours; happy to take a follow-up if you want the lane repaired.

@Git-on-my-level
Git-on-my-level merged commit b477547 into main Sep 23, 2026
44 of 45 checks passed
@Git-on-my-level
Git-on-my-level deleted the fix/dev-harness-local-auth-api-url branch September 23, 2026 11:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant