Skip to content

fix(ai): preserve full RPC paths with the native client - #796

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

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

Conversation

@izadoesdev

@izadoesdev izadoesdev commented Sep 14, 2026

Copy link
Copy Markdown
Member

AI tool calls built a separate client for each subrouter, so middleware received create instead of links.create. That dropped the namespace from tracking and caused the existing mutation-audit gate to skip these calls.

Use oRPC's native client for the full router. Delete the one-consumer client adapter, three type casts, and two forwarding helpers. Keep the lazy router import, authentication context, dry-run guard, cancellation, validation, and error mapping. Existing audit and tracking middleware now receive the complete procedure path.

Validation: reproduced the missing path with the installed SDK and a failing regression test before the fix. All six focused RPC checks now pass, including strict AbortSignal identity. Root lint, 33 type/build tasks, and 27 test tasks pass; independent diff review is clear. Runtime checks use synthetic procedures and mocks. One file deleted, no new files.

Scope: AI tool RPC invocation only. No dependency on or file overlap with #790 or #751; RPC context, billing implementation, and business-context handlers are unchanged.


Summary by cubic

Fixes AI tool RPC calls so middleware receives the full procedure path (links.create) instead of just create. Previously, a separate client was built per subrouter, which dropped the namespace and caused the mutation-audit gate to skip these calls. Now we use oRPC's native client for the full router, preserving path, authentication context, dry-run guard, cancellation, validation, and error mapping. The old adapter, type casts, and forwarding helpers are removed. This change is limited to AI tool RPC invocation.

Written for commit 235339a. 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 8:48pm UTC
2 Skipped Deployments
Project Deployment Actions Updated
dashboard Skipped Skipped Sep 14, 2026 8:48pm UTC
documentation Skipped Skipped Sep 14, 2026 8:48pm 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: 23646f45-d790-4112-a5ff-135db206ae38

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 14, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR replaces the per-subrouter oRPC adapter with a native client constructed from the complete application router, preserving namespaced procedure paths for mutation auditing and tracking.

  • Keeps lazy router loading and existing authentication-context construction.
  • Retains dry-run mutation blocking, validation, cancellation forwarding, and error mapping.
  • Adds focused coverage for full paths, service authentication, AbortSignal identity, missing procedures, validation, and mapped errors.
  • Removes the now-unused server RPC adapter.

Confidence Score: 5/5

The PR appears safe to merge, with no actionable correctness, security, or repository-rule issues identified.

The native full-router client matches existing two-segment callers and router structure, restores the complete middleware path, and preserves the adapter’s authentication, cancellation, dry-run, validation, and error behavior.

Important Files Changed

Filename Overview
packages/ai/src/ai/tools/utils/rpc.ts Replaces per-subrouter client construction with the native full-router client while preserving guards, context, invocation, and error handling.
packages/ai/src/ai/tools/utils/rpc.test.ts Adds focused regression coverage for complete procedure paths, authentication context, cancellation, validation, and error behavior.
packages/ai/src/lib/orpc-server.ts Deletes the obsolete one-consumer adapter, with no remaining repository references.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  AI[AI tool call] --> Guard{Dry-run mutation?}
  Guard -->|Yes| Receipt[Return blocked-mutation receipt]
  Guard -->|No| Context[Create authenticated RPC context]
  Context --> Client[Create native client from full appRouter]
  Client --> Path[Resolve routerName.method]
  Path --> Middleware[Audit and tracking middleware receive full path]
  Middleware --> Procedure[Invoke procedure with input and AbortSignal]
Loading

Reviews (1): Last reviewed commit: "fix(ai): preserve full RPC paths with th..." | Re-trigger Greptile

@izadoesdev
izadoesdev merged commit 6f4dd47 into staging Sep 14, 2026
21 checks passed
@izadoesdev
izadoesdev deleted the codex/agent-rpc-client-cleanup-20260914 branch September 14, 2026 20:53
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