Skip to content

refactor(ai): remove obsolete context and model adapters - #794

Merged
izadoesdev merged 1 commit into
stagingfrom
codex/agent-adapter-cleanup-20260914
Sep 14, 2026
Merged

izadoesdev merged 1 commit into
stagingfrom
codex/agent-adapter-cleanup-20260914

Conversation

@izadoesdev

@izadoesdev izadoesdev commented Sep 14, 2026

Copy link
Copy Markdown
Member

The private AI package still exposed a request/authentication path with no callers, a single-caller website validation wrapper, and a model router that only returned its input. Remove those adapters and their unused types and exports. Current callers use the existing website lookup and validated model tier directly.

Website-not-found errors, organization isolation, API-key scopes, session permissions, tier validation, and the balanced default retain their behavior. The existing authorization test now explicitly checks a missing site before permission evaluation. No new files or dependencies. Net reduction: 177 lines across 8 files.

Validation: root lint, all 33 type/build tasks, all 27 test tasks, 76 focused AI tests, and 11 actual API route tests pass. Independent diff review found no issues.

Scope: internal AI adapters and their direct callers. No dependencies or file overlap with open PR #751 or #790.


Summary by cubic

Removes the unused request/authentication path, website validation wrapper, and model router from the private AI package. Callers now use the existing website lookup and validated model tier directly.

Refactors

  • Website-not-found errors, organization isolation, API-key scopes, session permissions, tier validation, and the balanced default keep their existing behavior.
  • The authorization test now explicitly checks a missing site before permission evaluation.

Written for commit 5382e98. Summary will update on new commits.

Review in cubic

@vercel

vercel Bot commented Sep 14, 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 14, 2026 7:32pm UTC
2 Skipped Deployments
Project Deployment Actions Updated
dashboard Skipped Skipped Sep 14, 2026 7:32pm UTC
documentation Skipped Skipped Sep 14, 2026 7:32pm UTC

@coderabbitai

coderabbitai Bot commented Sep 14, 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: e7192c3b-52a0-4da3-821a-3c5b8d311765

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.

@izadoesdev
izadoesdev marked this pull request as ready for review September 14, 2026 19:32
@greptile-apps

greptile-apps Bot commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR removes obsolete internal AI adapters and routes their remaining caller directly through the existing website lookup and validated model tier.

  • Removes the identity model router and its private package exports.
  • Removes unused request-context, timezone, and website-validation helpers.
  • Preserves website-not-found handling, organization isolation, API-key scope checks, session permissions, and the balanced model default.
  • Adds focused coverage ensuring a missing website is rejected before permission evaluation.

Confidence Score: 5/5

The PR appears safe to merge; the removed adapters have no remaining callers, and the direct replacements preserve validated model selection and website authorization behavior.

No actionable failures remain: accepted model tiers match every configured model key, the removed symbols are unused within the private package, and the website access path retains not-found, organization, scope, and permission checks.

Important Files Changed

Filename Overview
apps/api/src/routes/agent.ts Replaces the identity tier router with a direct, schema-validated model-key assignment while retaining the balanced default.
packages/ai/src/ai/mcp/tool-context.ts Uses the underlying cached website lookup directly while preserving not-found, tenant, API-key, and session permission checks.
packages/ai/src/lib/website-utils.ts Removes unused request-context and validation adapters while retaining all website lookup functions used by current consumers.
packages/ai/package.json Removes the obsolete router subpath from the private package export map with no remaining repository consumers.
packages/ai/src/ai/mcp/tool-context.test.ts Updates the website lookup mock and adds coverage that missing sites fail before authorization checks.

Reviews (1): Last reviewed commit: "refactor(ai): remove obsolete context an..." | Re-trigger Greptile

@izadoesdev
izadoesdev merged commit 6fb5380 into staging Sep 14, 2026
21 checks passed
@izadoesdev
izadoesdev deleted the codex/agent-adapter-cleanup-20260914 branch September 14, 2026 19:37
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