Skip to content

fix(dashboard): proxy modal stops pre-filling new scopes with an unrelated proxy - #4312

Merged
diegosouzapw merged 1 commit into
release/v3.8.30from
fix/escalated-proxy-modal-prefill
Jun 20, 2026
Merged

diegosouzapw merged 1 commit into
release/v3.8.30from
fix/escalated-proxy-modal-prefill

Conversation

@diegosouzapw

Copy link
Copy Markdown
Owner

Causa

/api/settings/proxies/assignments returns the global list of proxy assignments, so its first element belongs to some other scope (e.g. another account's proxy). ProxyConfigModal resolved the assignment for the current scope with:

items.find((item) => isSameScopeAssignment(item, scope, scopeId)) || items[0]

When the modal opened for a freshly created provider/key (no assignment of its own), find returned undefined and the || items[0] fallback pre-selected an unrelated proxy: it set selectedProxyId, flipped hasOwnProxy = true, and pre-filled host/port/username/password. Users reported "when I create a new provider it already comes with a proxy I never configured." (Reproduced against a real instance whose only assignment was a per-key SOCKS5 proxy — every new provider inherited it.)

Fix

Extracted the scope helpers into src/shared/components/proxyAssignment.ts and added selectScopeAssignment, which returns null (never items[0]) when the current scope owns no assignment. Both call sites (fetchAssignmentForScope and the modal's load effect) now use it, so a new scope shows the empty/custom state instead of borrowing another scope's proxy.

The extraction also keeps ProxyConfigModal.tsx under the 800-line file-size cap.

TDD (red → green)

src/shared/components/proxyAssignment.test.tsx (runs in the blocking test:vitest suite):

  • 🔴→🟢 no-match → null for provider, account/key, and global-vs-provider scopes (previously returned items[0])
  • regression guards: matching scope returns its assignment; empty list → null

Validation: new test 5/5; existing ProxyConfigModal component test 3/3; related proxy unit tests 14/14; typecheck:core clean; eslint 0 errors; check:file-size OK.

Origem

Reported on the mesh (escalated backlog): "quando eu crio um novo provider, ele já vem [com um proxy], isso tá vindo de onde? eu não configurei nenhum proxy aqui."

…lated proxy

The proxy assignments list returned by /api/settings/proxies/assignments is
global, so its first entry belongs to some other scope. ProxyConfigModal picked
`items.find(matchingScope) || items[0]`, so opening the proxy config for a freshly
created provider/key (which has no assignment of its own) fell back to items[0]
and pre-filled host/port/user/password from an unrelated proxy plus set
hasOwnProxy=true — users reported a new provider already carried a proxy they
never configured.

Extracted the scope helpers into proxyAssignment.ts and added selectScopeAssignment
which returns null (never items[0]) when the current scope has no assignment. The
modal then shows the empty/custom state for new scopes. Both call sites now use it.

TDD: src/shared/components/proxyAssignment.test.tsx (no-match -> null red->green for
provider/key/global scopes; matching-scope + empty-list regression guards). Existing
ProxyConfigModal component test stays green.
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@diegosouzapw
diegosouzapw merged commit 5193a59 into release/v3.8.30 Jun 20, 2026
4 checks passed
@diegosouzapw diegosouzapw mentioned this pull request Jun 20, 2026
@diegosouzapw
diegosouzapw deleted the fix/escalated-proxy-modal-prefill branch June 21, 2026 12:33
tkgo11 pushed a commit to tkgo11/OmniRoute that referenced this pull request Sep 23, 2026
…lated proxy (diegosouzapw#4312)

The proxy assignments list returned by /api/settings/proxies/assignments is
global, so its first entry belongs to some other scope. ProxyConfigModal picked
`items.find(matchingScope) || items[0]`, so opening the proxy config for a freshly
created provider/key (which has no assignment of its own) fell back to items[0]
and pre-filled host/port/user/password from an unrelated proxy plus set
hasOwnProxy=true — users reported a new provider already carried a proxy they
never configured.

Extracted the scope helpers into proxyAssignment.ts and added selectScopeAssignment
which returns null (never items[0]) when the current scope has no assignment. The
modal then shows the empty/custom state for new scopes. Both call sites now use it.

TDD: src/shared/components/proxyAssignment.test.tsx (no-match -> null red->green for
provider/key/global scopes; matching-scope + empty-list regression guards). Existing
ProxyConfigModal component test stays green.
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