Skip to content

refactor(agent): remove Vercel adapter dead aliases#4766

Closed
mmabrouk wants to merge 1 commit into
feat/sdk-local-tools-runner-docsfrom
refactor/vercel-adapter-cleanup
Closed

refactor(agent): remove Vercel adapter dead aliases#4766
mmabrouk wants to merge 1 commit into
feat/sdk-local-tools-runner-docsfrom
refactor/vercel-adapter-cleanup

Conversation

@mmabrouk

@mmabrouk mmabrouk commented Jun 19, 2026

Copy link
Copy Markdown
Member

This PR is part of a stack. Review bottom-up.

Each PR's diff is only its own delta. Merge from the bottom. This PR's base is #4765 (merge that first).

Context

The Vercel adapter moved into its own package (agents/adapters/vercel/). That move left behind a set of compatibility shims: underscore-prefixed aliases and re-exports that pointed back at the new canonical names. Nothing reads them anymore. This PR base is feat/sdk-local-tools-runner-docs. It is slice #2 (protocol shell hardening) of docs/design/agent-workflows/pr-stack.md, the dead-code removal step.

What this changes

This deletes the leftover aliases. The canonical functions stay exactly where they are. No call site changes, no behavior changes. The diff is one trimmed import plus the removed shim lines.

Key architectural decision to review

The only thing to confirm is that the removed names have no live callers. Here is what was removed and where it lived:

  • _resolve_session_id and _inject_stream_session_id: compatibility wrappers in sdks/python/agenta/sdk/decorators/routing.py. The real helpers are resolve_session_id and inject_stream_session_id in the Vercel adapter.
  • _VERCEL_UI_MESSAGE_STREAM_HEADERS and _vercel_sse_stream: self-aliases at the bottom of sdks/python/agenta/sdk/agents/adapters/vercel/sse.py. The canonical names VERCEL_UI_MESSAGE_STREAM_HEADERS and vercel_sse_stream are untouched.
  • vercel_ui_messages_to_messages, message_to_vercel_ui_message, and agent_run_to_vercel_parts: re-exports trimmed from sdks/python/agenta/sdk/agents/ui_messages.py. These names still live in the adapter package and are imported directly from there.

One subtlety worth a second look: decorators/routing.py imports the canonical sse.py names and locally re-aliases them with as _VERCEL_UI_MESSAGE_STREAM_HEADERS and as _vercel_sse_stream. That local alias is separate from the deleted self-aliases inside sse.py, so it keeps working.

How to review this PR

Grep the codebase for each removed name and confirm zero live callers, then approve. The removed underscore wrappers have no callers. The trimmed ui_messages.py re-exports have no importers that go through ui_messages; every caller imports the canonical names directly from agents.adapters.vercel. This is safe to approve quickly.

@vercel

vercel Bot commented Jun 19, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
agenta-documentation Ready Ready Preview, Comment Jun 19, 2026 3:42pm

Request Review

@coderabbitai

coderabbitai Bot commented Jun 19, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

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: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: aed7403d-b7af-4435-925b-298c17f3814f

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
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/vercel-adapter-cleanup

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 and usage tips.

@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. python Pull requests that update Python code refactoring A code change that neither fixes a bug nor adds a feature labels Jun 19, 2026
@mmabrouk

Copy link
Copy Markdown
Member Author

Reviewer guide: interesting code

This PR only deletes dead shims. I grepped the whole repo for each removed name to confirm no live caller. Results below.

  • sdks/python/agenta/sdk/decorators/routing.py:37-46 — the _resolve_session_id and _inject_stream_session_id wrappers used to sit here. Grep for \b_resolve_session_id\b and \b_inject_stream_session_id\b returns zero callers. (The one hit for _resolve_session_id is a test function name, test_resolve_session_id_..., not a call.)

  • sdks/python/agenta/sdk/agents/adapters/vercel/sse.py:19 — the _VERCEL_UI_MESSAGE_STREAM_HEADERS and _vercel_sse_stream self-aliases used to follow the canonical defs here. No module imports these underscore names from sse.py. The two hits in decorators/routing.py import the canonical names and apply their own local as _... alias, which is separate and untouched.

  • sdks/python/agenta/sdk/agents/ui_messages.py:9 — the trimmed re-exports vercel_ui_messages_to_messages, message_to_vercel_ui_message, and agent_run_to_vercel_parts. Grep shows zero importers reach these via ui_messages. Every caller (including services/oss/src/agent/app.py and the unit tests) imports the canonical names directly from agents.adapters.vercel, where they still live.

Net: all removed names are dead at their old locations, and the canonical functions are unchanged. Safe to approve quickly.

register_agent_message_routes,
resolve_session_id,
)
from agenta.sdk.agents.adapters.vercel.routing import register_agent_message_routes

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Trimmed to import only register_agent_message_routes. The dropped resolve_session_id/inject_stream_session_id were only fed into the now-deleted underscore wrappers below, so nothing else needed them.


from .adapters.vercel import (
agent_run_to_vercel_parts,
from_ui_messages,

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This module is now a thin facade over the three names callers actually use through it. The dropped re-exports (vercel_ui_messages_to_messages, message_to_vercel_ui_message, agent_run_to_vercel_parts) had no importers via ui_messages; callers reach them straight from agents.adapters.vercel.

@mmabrouk

Copy link
Copy Markdown
Member Author

Superseded. Replacing the path-based stack with PRs sliced by functional area showing final code only, so reviewers don't comment on intermediate scaffolding that a later PR rewrites. See the new set.

@mmabrouk mmabrouk closed this Jun 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

python Pull requests that update Python code refactoring A code change that neither fixes a bug nor adds a feature size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant