Skip to content

fix(oauth): use transparent egress in Linux guests - #849

Merged
dofastted merged 2 commits into
dofastted:mainfrom
LemonYangZW:fix/oauth-guest-transparent-egress
Nov 2, 2026
Merged

dofastted merged 2 commits into
dofastted:mainfrom
LemonYangZW:fix/oauth-guest-transparent-egress

Conversation

@LemonYangZW

Copy link
Copy Markdown
Contributor

Summary

Fixes #848.

Linux guest OAuth now always leaves egress selection to the slot's existing kin-eg-* transparent network. It no longer forwards the VM binding URL into kin-oauth-auth.

Root cause

runGuestOAuthAuthService previously sent boundProxyUrl(vm.proxy) unless the binding was px-local. A controller-side SOCKS forwarder stored as 127.0.0.1:20881 was therefore forwarded into the Docker/KVM guest, where loopback points at the guest itself and token exchange failed with ECONNREFUSED.

The slot already joins its bound transparent egress network, and its worker uses an empty proxy_url in that mode. This change applies the same rule to guest OAuth.

Changes

  • Send proxy_url: '' to non-native guest OAuth helpers; the macOS native path still returns before this code and keeps its original payload.
  • Add a deterministic unit test that mocks prepare / runDocker and verifies both loopback and remote bindings produce an empty guest proxy_url.
  • Update the existing binary fixture to assert the production input is empty, then inject its host-local SOCKS fixture only for the subprocess test.

This is complementary to #845: #845 avoids the control-plane bootstrap hop after exchange, while this PR fixes the guest helper input that still carried the unreachable controller URL.

Tests

node --test test/unit/oauth-auth-url.test.mjs test/unit/oauth-binary.test.mjs test/unit/oauth-identity.test.mjs test/unit/guest-oauth-transparent-egress.test.mjs

tests 21
pass 20
fail 0
skipped 1 (openssl unavailable)
  • npx biome check on all changed JS tests/source: passed.
  • git diff --check: passed.
  • No real OAuth, proxy, model, or upstream API requests were made for this change.

Risk

Low. Only the non-native Linux guest helper input changes, from a controller-specific proxy URL to the transparent-network contract already used by slot workers. Native macOS behavior is unchanged.

@cursor
cursor Bot force-pushed the fix/oauth-guest-transparent-egress branch 2 times, most recently from e16ae0d to 080ac21 Compare November 2, 2026 11:42
Co-authored-by: ted <kuhlmangarry24@gmail.com>
@cursor
cursor Bot force-pushed the fix/oauth-guest-transparent-egress branch from 080ac21 to ca69d3e Compare November 2, 2026 11:42
Keep both Unreleased notes: the cleanup already on main, and dofastted#848.
@dofastted
dofastted merged commit ba63894 into dofastted:main Nov 2, 2026
2 checks passed
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.

[Bug] Docker 槽 OAuth 换票把宿主 loopback SOCKS 地址传入容器 (1.4.031)

2 participants