Skip to content

[WRONG BRANCH] routing: evaluate policy locality against effective provider destination - #20

Closed
luvs01 wants to merge 1 commit into
mainfrom
codex/fix-policy-routing-locality-checks
Closed

[WRONG BRANCH] routing: evaluate policy locality against effective provider destination#20
luvs01 wants to merge 1 commit into
mainfrom
codex/fix-policy-routing-locality-checks

Conversation

@luvs01

@luvs01 luvs01 commented Aug 7, 2026

Copy link
Copy Markdown
Owner

Motivation

  • Prevent policy profiles (e.g. localOnly / remoteAllowed) from being satisfied by a stale or ignored configured baseUrl when the actual dispatch uses a registry-pinned destination.

Description

  • Add effectiveProviderBaseUrl in src/providers/registry.ts to resolve the destination routing will actually use for a configured provider row.
  • Use the shared effectiveProviderBaseUrl in src/router.ts when building the routed provider config so dispatch continues to validate the effective destination and warn about discarded configured URLs.
  • Replace the ad-hoc hostname classifier in src/routing/capability.ts with the canonical assessUrlDestination classifier and evaluate locality evidence against the effective provider destination rather than the raw configured baseUrl.
  • Add a regression test in tests/policy-execution.test.ts that verifies a registry-pinned remote provider with a stale loopback baseUrl cannot satisfy a localOnly policy requirement.

Testing

  • Ran bun run typecheck, which completed successfully.
  • Ran bun run privacy:scan, which completed successfully.
  • Added and executed the focused policy regression via the test suite; the new policy-execution regression passed (tests/policy-execution.test.ts).
  • Ran the full test suite (bun run test); the policy regression passed but a later unrelated provider outbound test timed out in the environment (the timeout is not related to these routing changes).

@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@luvs01, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 2 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 14f91da2-ce5b-4979-8039-421c66d7d621

📥 Commits

Reviewing files that changed from the base of the PR and between 2468502 and 051e2db.

📒 Files selected for processing (4)
  • src/providers/registry.ts
  • src/router.ts
  • src/routing/capability.ts
  • tests/policy-execution.test.ts

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown

Deterministic PR hygiene checks passed.

@github-actions github-actions Bot added the bug Something isn't working label Aug 7, 2026
@github-actions github-actions Bot changed the title routing: evaluate policy locality against effective provider destination [WRONG BRANCH] routing: evaluate policy locality against effective provider destination Aug 7, 2026
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown

⏳ DRAFT

  • wrong target branch (main); retarget to dev.

What to do

  • Retarget this PR to dev — all contributions go to dev.

Its title has been prefixed with [WRONG BRANCH].
This pull request was already a draft. Its draft status will be preserved after every issue above is resolved.

@github-actions
github-actions Bot marked this pull request as draft August 7, 2026 05:44

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 051e2dbaa4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/routing/capability.ts
Comment on lines +103 to +104
if (assessment.kind === "public" || assessment.kind === "hostname") {
return { remoteAllowed: true, localOnly: false };

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Keep unresolved hostnames as unknown locality

When a self-hosted provider uses a DNS name such as ollama.internal that resolves to loopback or RFC1918 space and is admitted with allowPrivateNetwork, assessUrlDestination returns hostname; these lines therefore assert remoteAllowed: true and localOnly: false without resolving it. This makes localOnly profiles reject valid local candidates and can make remoteAllowed profiles accept private ones. Keep hostname unknown here, or use DNS-resolved evidence, rather than treating every hostname as public.

Useful? React with 👍 / 👎.

luvs01 commented Aug 7, 2026

Copy link
Copy Markdown
Owner Author

Closing this public review surface. The effective-destination mismatch is real, but this patch classifies an unresolved hostname as remote-allowed and can therefore replace one locality error with another. A complete correction must keep unresolved/special destinations unknown and cover all local/public address classes, so it is being handled through private security review.

@luvs01 luvs01 closed this Aug 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

aardvark bug Something isn't working codex

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant