Skip to content

fix: use IPv4 loopback for frontend proxy - #784

Merged
pancacake merged 1 commit into
HKUDS:devfrom
Iams4kura:codex/fix-deeptutor-ipv4-loopback-20260806t084051z
Aug 6, 2026
Merged

pancacake merged 1 commit into
HKUDS:devfrom
Iams4kura:codex/fix-deeptutor-ipv4-loopback-20260806t084051z

Conversation

@Iams4kura

Copy link
Copy Markdown
Contributor

Description

The native launcher currently gives the frontend's Node proxy a localhost backend URL. On affected Windows hosts, Node resolves that hostname to ::1 while the locally launched uvicorn backend is reachable over IPv4, so proxied API requests fail with HTTP 500.

This change uses 127.0.0.1 for that internal proxy connection, both for the configured backend port and after port-conflict resolution. Browser-facing URLs remain unchanged. A regression test covers both launcher paths.

Related Issues

Module(s) Affected

  • agents
  • api
  • config
  • core
  • knowledge
  • logging
  • services
  • tools
  • utils
  • web (Frontend)
  • docs (Documentation)
  • scripts
  • tests
  • Other: runtime launcher

Checklist

  • I have read and followed the contribution guidelines.
  • My code follows the project's coding standards.
  • I have run pre-commit run --all-files and fixed any issues.
  • I have added relevant tests for my changes.
  • I have updated the documentation (if necessary).
  • My changes do not introduce any new security vulnerabilities.

Additional Notes

Regression evidence:

  • Before the fix, both cases failed because the exported values were http://localhost:8001 and http://localhost:8123.
  • After the fix, the focused regression passes: 2 passed.

Verification:

  • Launcher suite: 19 passed.
  • Full Python suite: 3621 passed, 9 skipped.
  • Web Node tests on Node 22: 380 passed.
  • Ruff lint and format checks: passed.
  • CI import checks: passed.
  • All pre-commit hooks on the two changed files, including Ruff, mypy, Bandit, and detect-secrets: passed.

The repository-wide pre-commit command is not clean on the current dev baseline because formatting hooks rewrite unrelated tracked frontend build artifacts and existing web source files. Those unrelated changes are not included in this PR; all CI-equivalent non-mutating checks and all hooks covering the changed files pass.

@pancacake
pancacake merged commit 110dd90 into HKUDS:dev Aug 6, 2026
pancacake added a commit that referenced this pull request Aug 6, 2026
…ack everywhere

#784 fixed the launcher, but the same address is rendered on two other paths
that kept "localhost": the Docker entrypoint (render_environment) and the
last-resort default in web/proxy.ts. On a dual-stack host that name resolves
to ::1 first while uvicorn binds 0.0.0.0 (IPv4 only), so every rewritten
/api/* request fails to connect — the launcher and container paths are meant
to stay in sync, and after #784 they no longer did.

Also disambiguates the two same-named _optional_positive_int helpers added by
#774: catalog's drops junk from a live API response, contracts' rejects it as
cache corruption. Same name, opposite behaviour — the strict one is now
_require_optional_positive_int and says why it differs.
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.

2 participants