Skip to content

fix(sap-ai-core): serve the spec v3 provider entrypoint - #14509

Open
jerome-benoit wants to merge 1 commit into
anomalyco:devfrom
jerome-benoit:fix/sap-ai-core-provider-entrypoint
Open

jerome-benoit wants to merge 1 commit into
anomalyco:devfrom
jerome-benoit:fix/sap-ai-core-provider-entrypoint

Conversation

@jerome-benoit

@jerome-benoit jerome-benoit commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Change

providers/sap-ai-core/provider.toml: npm → @jerome-benoit/sap-ai-provider. packages/core/src/generate-v2.ts: same key in DEFAULT_NPM_BASE_URLS, looked up by provider npm (:426,492).

Why

opencode v2.4.1 reads finishReason.raw / .unified and usage.inputTokens.total (packages/core/src/aisdk.ts:845,879-892,895 at 6f05140). Against -v2 every step ends in Error: Schema validation failed (StepFinish.make, packages/ai/src/schema/events.ts:269-270,374-377) and token usage resolves to nothing. Reported as jerome-benoit/sap-ai-provider#342, closed with this swap as the workaround.

The root entrypoint is what such consumers read. Same factory name, same settings type, callable provider: nothing else moves. -v2 stays published for explicit pins.

v1

One field. Needs maintainer approval.

1  api npm: "@jerome-benoit/sap-ai-provider-v2" -> "@jerome-benoit/sap-ai-provider"   [sap-ai-core (provider)]

Verification

bun validate exit 0 · bun run v1:check upstream/dev gives only the line above · bun run test in packages/sdk 25 pass · generated v2 output: sdk.aisdk flips, ${AICORE_DEPLOYMENT_URL} still resolves 51 times before and after.

@github-actions

Copy link
Copy Markdown
Contributor

No actionable findings.

@github-actions github-actions Bot added the reviewer: ready Automated review found no actionable items label Nov 24, 2026
The `-v2` facade publishes AI SDK provider spec v2 payloads: `finishReason` a
string, `usage` flat. AI SDK 6 consumers read the spec v3 object and nested
totals, so opencode v2.4.1 fails every step with `Error: Schema validation
failed` and drops token usage (packages/core/src/aisdk.ts:845,879-892 at
6f05140). The root entrypoint publishes spec v3 behind the same factory name,
settings type and callable provider, so nothing else moves. Reported in
jerome-benoit/sap-ai-provider#342, closed with this swap as the workaround.
`bun run v1:check upstream/dev` reports this `npm` value as its only change.
@jerome-benoit
jerome-benoit force-pushed the fix/sap-ai-core-provider-entrypoint branch from 782c224 to 8d5bd90 Compare November 24, 2026 22:04
@github-actions github-actions Bot removed the reviewer: ready Automated review found no actionable items label Nov 24, 2026
@github-actions

Copy link
Copy Markdown
Contributor

No actionable findings.

@github-actions github-actions Bot added the reviewer: ready Automated review found no actionable items label Nov 24, 2026
@rekram1-node

Copy link
Copy Markdown
Member

Holding this for now. The swap itself is right (the root entry of @jerome-benoit/sap-ai-provider 5.1.2 is the v3 build), but OpenCode still matches the exact old package name, so changing it here first would drop SAP's reasoning settings:

  • packages/core/src/aisdk.ts maps @jerome-benoit/sap-ai-provider-v2 to the sap-ai provider options key
  • packages/core/src/models-dev.ts lists it among the packages that build their own URL
  • packages/core/src/variant.ts maps it to the SAP reasoning variants

Released v1.19.6 does the same in packages/opencode/src/provider/transform.ts. Separately, anomalyco/opencode#66164 fixes the "Schema validation failed" error inside OpenCode, which may make this change unnecessary.

I'll pick this up again once OpenCode recognizes both package names.

@jerome-benoit

Copy link
Copy Markdown
Contributor Author

Holding noted - the OpenCode side has landed.

anomalyco/opencode#67848 (dev, merged 2026-12-03, merge commit 86aee9c) accepts both package
names: one shared sap-ai providerOptions key, shared SAP reasoning variants, shared catalog
base-URL exclusion. Core loads the unsuffixed package root, which is the V3 build, so #66164 is not
a prerequisite for this path. No flag and no further catalog change is needed.

Gate: the fix is not in any published tag yet (latest release is v2.4.4, 2026-12-03, which predates
the merge). Please land this after the first 2.x release that contains it, so installed clients can
resolve the new package name before the catalog advertises it.

anomalyco/opencode#67849 mirrors the change onto the v1 branch as a courtesy. That line no longer
receives releases, so it should not hold this PR.

The patch still applies cleanly on current dev (merge-base 03c5c9e, git merge-tree clean).
Happy to rebase on request.

@github-actions github-actions Bot removed the reviewer: ready Automated review found no actionable items label Dec 3, 2026

This branch was previously deployed

1 inactive deployment
release — 8d5bd907 Deployed Nov 24, 2026 by jerome-benoit via review #20687
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.

2 participants