Skip to content

fix(ai): preserve supported chat domain selectors - #769

Merged
izadoesdev merged 1 commit into
stagingfrom
codex/business-context-domain-compatibility
Sep 8, 2026
Merged

fix(ai): preserve supported chat domain selectors#769
izadoesdev merged 1 commit into
stagingfrom
codex/business-context-domain-compatibility

Conversation

@izadoesdev

@izadoesdev izadoesdev commented Sep 8, 2026

Copy link
Copy Markdown
Member

The shared chat preflight added in #768 rejects authorized domain selectors such as example.com for a stored Example.com, or an HTTP(S)-prefixed selector that the downstream MCP resolver accepts. Extract the existing MCP domain comparison into one pure matcher and use it in both places.

Case-insensitive matching and optional HTTP(S) prefixes are preserved. Literal www hosts and ports still require matching stored values; no new hostname aliases, path rewriting, whitespace trimming or default-port normalization is introduced. The explicit website-ID constraint and organization-scoped accessible list remain required.

Native public ask/stream/trace regressions cover case, protocol prefixes, literal www hosts, matching ports, domain-only and explicit-ID selection, duplicate normalized domains, and rejection of near-miss domains or mismatched accessible IDs before profile/model access. Downstream resolver regressions pin the same accepted and rejected forms.

Rebased once onto staging 51d92fb, which includes the session-organization membership fix. The domain-matcher/test patch is byte-for-byte unchanged by the rebase. Fresh validation at af3c06f: root lint passed; root types 33/33; targeted tests 62/62; normal pre-push tests 27/27 tasks, including AI 874 passed and 21 skipped. Frozen dependencies installed and SDK build restored in the fresh isolated worktree. Follow-up to merged #768; no unmerged dependency.

P2 triage: the old Cursor blanket ban on unknown conflicts with the current Bun skill's explicit recommendation to use unknown plus schema validation for untrusted inputs and the maintainer's instruction for this task. The unrelated existing API boundary-mock types are unchanged; no broad test cleanup is included.

@vercel

vercel Bot commented Sep 8, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
databuddy-status Ready Ready Preview Sep 8, 2026 10:04pm UTC
2 Skipped Deployments
Project Deployment Actions Updated
dashboard Skipped Skipped Sep 8, 2026 10:04pm UTC
documentation Skipped Skipped Sep 8, 2026 10:04pm UTC

@coderabbitai

coderabbitai Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 6ec0e958-e48f-4cb3-886c-8caf87d2020a

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@greptile-apps

greptile-apps Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR extracts the MCP website-domain comparison into a shared matcher and applies it to the native chat preflight, preserving case-insensitive selectors and optional HTTP(S) prefixes while retaining exact hostname, port, path, website-ID, and organization-access constraints.

  • Reuses one domain-matching implementation across preflight and downstream resolution.
  • Adds regression coverage for accepted case/protocol variants, duplicate normalized domains, ports, literal www hosts, explicit IDs, and unsupported rewrites.
  • Keeps authorization checks and explicit ID/domain pairing intact.

Confidence Score: 5/5

The PR appears safe to merge; no actionable regression or authorization weakness was identified.

The extracted matcher preserves the downstream resolver’s prior behavior, and the preflight now accepts the same supported case and protocol variants while continuing to require organization-scoped accessibility and consistent explicit website IDs.

Important Files Changed

Filename Overview
packages/ai/src/lib/website-domain.ts Introduces a pure matcher equivalent to the downstream resolver’s previous protocol-stripping and case-insensitive comparison.
packages/ai/src/ai/mcp/run-agent.ts Aligns shared-agent preflight domain validation with downstream MCP selector semantics without weakening organization or website-ID constraints.
packages/ai/src/ai/mcp/tool-context.ts Replaces the resolver’s inline comparison with the behaviorally equivalent shared matcher.
packages/ai/src/ai/mcp/business-context-delivery.test.ts Adds native ask, stream, and trace coverage for supported selectors, near misses, duplicate domains, and mismatched accessible IDs.
packages/ai/src/ai/mcp/tool-context.test.ts Pins downstream resolver behavior for the same accepted and rejected selector forms.

Reviews (1): Last reviewed commit: "fix(ai): align chat preflight with MCP d..." | Re-trigger Greptile

@izadoesdev
izadoesdev force-pushed the codex/business-context-domain-compatibility branch from 71405d2 to af3c06f Compare September 8, 2026 22:03
@vercel
vercel Bot temporarily deployed to Preview – documentation September 8, 2026 22:03 Inactive
@vercel
vercel Bot temporarily deployed to Preview – dashboard September 8, 2026 22:03 Inactive
@unkey-deploy

unkey-deploy Bot commented Sep 8, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Unkey Deploy

Name Status Preview Inspect Updated (UTC)
links (preview) Ready Visit Preview Inspect Sep 8, 2026 10:04pm

@izadoesdev
izadoesdev merged commit cf6f7e2 into staging Sep 8, 2026
20 checks passed
@izadoesdev
izadoesdev deleted the codex/business-context-domain-compatibility branch September 8, 2026 22:08
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