fix(eve): support explicit prompt-cache-path override for opaque Bedrock inference profiles (#1314) - #1415
Open
iroiro147 wants to merge 1 commit into
Open
Conversation
Contributor
|
@iroiro147 is attempting to deploy a commit to the Vercel Team on Vercel. A member of the Team first needs to authorize it. |
iroiro147
force-pushed
the
fix/bedrock-inference-profile-prefix-1314
branch
from
July 30, 2026 17:17
3ac2146 to
6849c43
Compare
…ock inference profiles Resolves vercel#1314. detectPromptCachePath inferred the Anthropic-direct prompt-cache path for Bedrock solely from the resolved model id containing "anthropic". AWS Bedrock application inference profile ids can be opaque and omit the underlying provider family, so an Anthropic model reached through such a profile was classified as `none`: the stable system/tool prefix received no Bedrock cache points and repeated turns were billed as fully uncached input. Detection now reads an optional, strictly-validated override from the eve-owned namespace on the model's authored options: modelOptions.providerOptions.eve = { cachePath: "anthropic-direct" | "none" } The explicit override takes precedence over inference; models without it keep their existing automatic behavior (direct Anthropic providers, @ai-sdk/amazon-bedrock Anthropic model ids, Vertex Anthropic). An unrecognized value fails fast at turn start so a mis-declared cache path is loud rather than silently uncached. The override is read from the active model reference's providerOptions, so it stays per-model correct for dynamic-model agents with a scoped selection. Mirrors the existing eve-namespaced `providerOptions.gateway.byok` hint pattern and preserves the public defineAgent/manifest schema (rides the open providerOptions bag). Includes targeted unit tests, a changeset, and user docs. Signed-off-by: iroiro147 <sarthak.singh@juspay.in>
iroiro147
force-pushed
the
fix/bedrock-inference-profile-prefix-1314
branch
from
July 30, 2026 17:28
6849c43 to
d073ba9
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #1314.
Eve inferred the Anthropic-direct prompt-cache path for AWS Bedrock only when the resolved model id contained the substring
anthropic. Bedrock application inference profile ids can be opaque and omit the underlying provider family, so an Anthropic model reached through such a profile was misclassified asnone— the stable system/tool prefix received no Bedrock cache points, and repeated turns were billed as fully uncached input.Plain Anthropic foundation-model ids kept working only because they happen to include
anthropic. Inferring provider family from an opaque deployment identifier is not reliable.What changed
detectPromptCachePathnow honors an explicit, supported, per-model override declared under the eve-owned namespace in the model's options:eve.cachePathaccepts"anthropic-direct"(force the Anthropic breakpoint path) or"none"(opt the model out of caching).@ai-sdk/amazon-bedrockAnthropic model ids, Vertex Anthropic).providerOptions, so it stays per-model correct for dynamic-model agents with a scoped selection.This mirrors the existing eve-namespaced
providerOptions.gateway.byokhint pattern and preserves the publicdefineAgent/ compiled-manifest schema — it rides the already-validated openproviderOptionsbag rather than adding a new top-level key.Why this design (smallest supported override)
I considered two narrower alternatives and rejected them: a
providerFamilyboolean forces a fake family onto models it can't know and silently no-ops elsewhere; an opaque-id heuristic keeps doing substring inference, which this issue shows is unreliable. An explicit cache-path override is the smallest supported surface that solves the opaque-profile case while leaving the inference path untouched.Validation
pnpm --filter eve typecheckpnpm lint(oxlint)prompt-cache+tool-loop+step-hooks+prompt-cache-accountingnone; opaque profile +anthropic-directoverride; explicit-override precedence;noneopt-out; fallback-to-inference; invalid override throws; non-Anthropic unchangedpackages/eveunit tiertest/bin-bootstrap.test.tsasserting the Node>=24engine contract while this shell runs Nodev22.22.3(pre-existing ambient mismatch;bin/eve.jsdeclares the samerequiredRangeguard on pristine main, and that file is not touched by this change)Notes for reviewers
eve(provider SDKs don't consume it), so it carries a framework hint without changing the provider's request semantics.Authoring: drafted under the Codex6 planning chain with an independent-reviewer gate; full review ledger (GLM-5.2/GRID + Codex6 admission attempts, findings, machine gate) is recorded and available. Happy to route a fresh GLM-5.2 independent re-review on request.
Maintainer note — DCO, base freshness, and the two "fail" checks
git commit -s), matching the PR author identity.main(5ff5534) so the diff is clean and current.Vercel – eve-docs/eve-docs-4759"Authorization required to deploy" and the fouragent-prompt-cachee2e runners: these are the standard external-fork secret/deploy gate, not a code regression. On a maintainer-authorized run they should behave exactly as on a same-repo branch. Evidence this change does not regress the prompt-cache path:agent-prompt-cachee2e fixture authors a directanthropic(...)instance with no override, so this change is a strict no-op on that code path (readCachePathOverride(undefined)→undefined→ unchanged inference →anthropic-direct).AI_GATEWAY_API_KEY, fell back to Vercel OIDC, and failed withVercelOidcTokenError: x-vercel-oidc-token header is missing / Unable to find project root (... vc link), producing0tool calls and aNaN%cache rate. For comparison, same-repo PR fix(eve): make turn cancellation reliable for sessions parked on subagents #1389 ran these exactagent-prompt-cacherunners to pass with the gateway secret present.lint,typecheck,test-unit,test-integration (ubuntu),changes,Socket,Vercel Agent Review.Happy to push any adjustment a maintainer-authorized CI run surfaces.