Skip to content

fix(providers): make native Vertex+Claude path accept Anthropic-style model IDs and tool schemas - #1084

Merged
murdore merged 1 commit into
releasefrom
fix/vertex-claude-model-id-and-tool-schema
Jun 12, 2026
Merged

murdore merged 1 commit into
releasefrom
fix/vertex-claude-model-id-and-tool-schema

Conversation

@murdore

@murdore murdore commented Jun 12, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Deployments that share one model/tool config across providers (e.g. TARA/curator, where the model ID comes from a Superposition flag) break on the native @anthropic-ai/vertex-sdk path introduced in 9.61:

  1. Model-ID dialect. The Anthropic API dates models with a trailing dash segment (claude-haiku-4-5-20251001) but Vertex publisher IDs use @ (claude-haiku-4-5@20251001). The native path passed the dash form through verbatim → Vertex 404 Publisher Model ... was not found on every call.

    Verified live against us-east5 (project with Anthropic integration):

    model id result
    claude-haiku-4-5-20251001 404 NOT_FOUND
    claude-haiku-4-5@20251001 200
    claude-sonnet-4-6 (bare alias) 200
  2. Tool-schema dialect. Once requests reach Vertex, the native Anthropic paths converted tool input_schema / the final_result schema with the "openApi3" target (correct for Gemini, wrong for Claude). Anthropic validates input_schema as JSON Schema draft 2020-12 and rejects OpenAPI-3 output (nullable: true) with tools.N.custom.input_schema: JSON schema is invalid 400s.

Fix

  • toVertexAnthropicModelId() in modelDetection.ts — normalizes trailing -YYYYMMDD to @YYYYMMDD for claude-* IDs at both native call sites (executeNativeAnthropicStream / executeNativeAnthropicGenerate). @-form IDs, bare aliases, and non-Claude models pass through untouched. Legacy v2-suffixed Vertex IDs have no dash-date equivalent and stay out of scope (they 404 before and after — no regression).
  • The two native Anthropic tool-conversion sites and both final_result schema conversions now use the default JSON Schema target, matching the direct anthropic provider. All Gemini paths keep "openApi3".

Verification

  • Deterministic unit suite: npx tsx test/continuous-test-suite-vertex-model-id.ts (9 cases — conversions + pass-throughs).
  • E2E through curator (provider=vertex, claude-haiku-4-5-20251001 from remote config, 88 MCP tools registered): chat + structured-attachment turns succeed with zero 404/400; before the fix the identical config failed every turn.
  • pre-commit check/format/lint green.

Summary by CodeRabbit

  • New Features

    • Added Claude model ID normalization for Anthropic Vertex compatibility, converting model IDs to expected date format.
  • Improvements

    • Enhanced JSON Schema validation compatibility with Anthropic Vertex.
    • Updated tool schema conversion to use native JSON Schema format for better compatibility.
  • Tests

    • Added comprehensive test suite validating model ID normalization across Claude variants and edge cases.

… model IDs and tool schemas

Two compatibility gaps in the native @anthropic-ai/vertex-sdk path that broke
deployments sharing one model/tool config across providers (e.g. TARA):

1) Model IDs: the Anthropic API dates models with a trailing dash segment
(claude-haiku-4-5-20251001) but Vertex publisher IDs use "@"
(claude-haiku-4-5@20251001). The native path passed the dash form through
verbatim and Vertex 404'd (verified live on us-east5: dash form NOT_FOUND,
@ form 200). toVertexAnthropicModelId() normalizes at both native call
sites; @-form IDs, bare aliases and non-Claude models pass through.

2) Tool schemas: the native path converted tool input_schema and the
final_result schema with the "openApi3" target (correct for Gemini, wrong
for Claude) — Anthropic validates input_schema as JSON Schema draft 2020-12
and rejects OpenAPI-3 dialect output (nullable: true) with
tools.N.custom.input_schema 400s. Use the default JSON Schema target,
matching the direct anthropic provider.

Verified e2e through curator (provider=vertex, claude-haiku-4-5-20251001
from remote config, 88 MCP tools registered): chat + structured attachment
turns succeed with zero 404/400; deterministic unit suite covers the
normalization (9 cases).
Copilot AI review requested due to automatic review settings June 12, 2026 16:42
@vercel

vercel Bot commented Jun 12, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
neurolink Ready Ready Preview, Comment Jun 12, 2026 4:42pm

@github-actions

Copy link
Copy Markdown
Contributor

✅ Single Commit Policy - COMPLIANT

Status: Policy requirements met • 1 commit • Valid format • Ready for merge

📊 View validation details

📝 Commit Details

  • Hash: 3e6507e946a7c565b0929b93fd89976b16891d15
  • Message: fix(providers): make native Vertex+Claude path accept Anthropic-style model IDs and tool schemas
  • Author: Sachin Sharma

✅ Validation Results

  • Single commit requirement met
  • No merge commits in branch
  • Semantic commit message format verified
  • Ready for squash merge to release branch

🤖 Automated validation by NeuroLink Single Commit Enforcement

@coderabbitai

coderabbitai Bot commented Jun 12, 2026 •

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

This PR improves Anthropic-on-Vertex compatibility by introducing centralized Claude model ID normalization from Anthropic's dash-date format to Vertex's @-date format, and updates JSON Schema dialect in tool schema construction to use the compatible default instead of OpenAPI-3, applied across both native streaming and generation paths.

Changes

Anthropic Vertex Compatibility

Layer / File(s) Summary
Model ID normalization utility
src/lib/utils/modelDetection.ts, test/continuous-test-suite-vertex-model-id.ts
New toVertexAnthropicModelId() utility converts Claude model IDs from dash-date (claude-*-YYYYMMDD) to Vertex @-date format (claude-*@YYYYMMDD``), with comprehensive test coverage for multiple Claude variants, pass-through behavior for non-Claude and already-normalized IDs, and edge cases.
Native Anthropic Vertex provider integration
src/lib/providers/googleVertex.ts
Imports and uses toVertexAnthropicModelId in both executeNativeAnthropicStream and executeNativeAnthropicGenerate for model-id mapping; updates JSON Schema dialect from "openApi3" to compatible default in tool schema and final_result definitions across both paths.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • juspay/neurolink#1033: Both PRs modify src/lib/providers/googleVertex.ts in the native Anthropic Vertex execution paths, but #1033 focuses on per-call timeout plumbing while this PR addresses model-id mapping and JSON-schema dialect compatibility.

Suggested labels

released

Suggested reviewers

  • Tara-ag
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly summarizes the main fix: enabling the native Vertex+Claude path to accept Anthropic-style model IDs and tool schemas, which is precisely what the changes address.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/vertex-claude-model-id-and-tool-schema

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install timed out. The project may have too many dependencies for the sandbox.


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.

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

Copy link
Copy Markdown
Contributor

🤖 AI Review & Build Compliance ✅

Status: AI analysis complete • Build rules validated • Ready for review

📊 View detailed analysis results

🛡️ Analysis Complete

  • ✅ Security scan (vulnerabilities, API keys)
  • ✅ TypeScript safety & code quality
  • ✅ Error handling & best practices
  • ✅ Build rule enforcement validated
  • ✅ Commit format & compliance checks

📋 Ready for Merge When

  • All CI checks passing
  • Manual review approved
  • Any AI-flagged issues resolved

🤖 AI analysis complete - check individual code comments for specific feedback

@Tara-ag Tara-ag left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Review Summary

Files reviewed: 3
New issues found: 0
Status: ✅ APPROVE

Analysis

This PR fixes two interoperability issues between the native Vertex+Claude path and Anthropic-style configurations:

  1. Model ID normalization (toVertexAnthropicModelId): Correctly converts Anthropic API date format (claude-haiku-4-5-20251001) to Vertex publisher format (claude-haiku-4-5@20251001). The regex /^(claude-[a-z0-9-]+)-(\d{8})$/ properly handles:

    • Standard conversions (haiku, sonnet, opus variants)
    • Legacy 3.5 model IDs
    • Pass-through for @-form IDs, bare aliases, and non-Claude models
    • Correctly rejects non-8-digit suffixes
  2. Tool schema dialect fix: Removing "openApi3" from the native Anthropic paths is correct — verified that the direct anthropic provider also uses the default JSON Schema target (not openApi3). This aligns the Vertex native path with the direct provider behavior.

  3. Test coverage: 9 deterministic test cases covering conversions and pass-through scenarios.

Verification Against Standards

  • ✅ CLAUDE.md Rule 5: No breaking changes to public SDK API
  • ✅ Security: No hardcoded secrets or injection risks
  • ✅ Architecture: Changes are properly scoped to Vertex+Claude native paths only
  • ✅ Type safety: Proper TypeScript types throughout
  • ✅ Testing: New test file follows existing harness patterns

The fix is minimal, well-documented, and addresses the root cause verified through live testing against us-east5.

@murdore
murdore merged commit e6d852d into release Jun 12, 2026
16 of 18 checks passed
@murdore
murdore deleted the fix/vertex-claude-model-id-and-tool-schema branch June 12, 2026 16:50
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 9.70.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

This branch was successfully deployed

1 active deployment
Preview — 3e6507e9 Deployed Jun 12, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants