Repository navigation
Give Vercel AI SDK model and embedding calls a 10-second default heartbeat timeout - #510
Merged
Merged
Conversation
…tbeat timeout TemporalLanguageModel and TemporalEmbeddingModel set no heartbeat timeout, and the model Activities start their heartbeat timer only when one is set. So a cancel never reached a call waiting on the provider, and a lost Worker went unnoticed until the 10-minute start-to-close timeout. Default it to 10 seconds. A heartbeatTimeout set in the provider or model options wins, and 0 turns it off. The README said the Activities send no heartbeat without a heartbeatTimeout; it now gives the default and how to turn it off. Part of #491.
campoy
marked this pull request as ready for review
November 13, 2026 00:55
JasonSteving99
approved these changes
Nov 13, 2026
DABH
approved these changes
Nov 13, 2026
This was referenced Nov 14, 2026
campoy
added a commit
that referenced
this pull request
Nov 16, 2026
…beat timeout (#552) ## What was changed The Vercel AI SDK README now says how to upgrade from 1.0.0, and how to roll back, now that the model and embedding Activities get a 10-second heartbeat timeout by default (#510). ## Why? 1.0.0 schedules these Activities with no heartbeat timeout. Its `invokeModel` and `invokeEmbeddingModel` never heartbeat, and its `invokeModelStreaming` heartbeats only when a stream part arrives ([the only `heartbeat()` call in 1.0.0](https://github.com/temporalio/ai-integrations/blob/typescript/vercel-ai-sdk/v1.0.0/typescript/vercel-ai-sdk/src/activities.ts#L285)). But the timeout is recorded when a Workflow schedules the Activity, so whichever Worker runs it has to heartbeat. During a rolling upgrade, a call that a Workflow on the next version schedules and a 1.0.0 Worker runs fails with a heartbeat timeout after 10 seconds, and so does each retry. Does replay break? No: core only compares an Activity's ID and type. But a passing replay doesn't mean mixed versions work. So the README now gives the same steps that #520 and #551 give for Google ADK Python and google-genai: - Upgrade the Workers that run the model Activities first. If the same Workers run Workflows too, deploy with `heartbeatTimeout: 0` and remove it in a later deploy. - Before a rollback, deploy with `heartbeatTimeout: 0`, and wait for the calls scheduled before that deploy to finish. - Runs pinned with Worker Versioning avoid both. ## Checklist 1. No issue: a docs follow-up to #510, part of #491. 2. How was this tested: Docs only. The conventions check and `git diff --check` pass. To check the claims, I read 1.0.0's code: it sets no `heartbeatTimeout` default, and its only `heartbeat()` call is in `invokeModelStreaming`'s stream loop. On `main`, `TemporalProviderOptions.default` takes the `ActivityOptions` the example sets. #520 measured the failure itself on a local dev server: an Activity that doesn't heartbeat failed 10.02 seconds in, and both attempts of a retried one failed the same way. 3. Any docs updates needed? This is the docs update. The 2.0.0 release notes should carry the same upgrade step.
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.
What was changed
TemporalLanguageModelandTemporalEmbeddingModelnow give their Activities (invokeModel,invokeModelStreamingandinvokeEmbeddingModel) a 10-secondheartbeatTimeoutwhen the options don't set one.TemporalProviderbuilds its models with itsdefault,languageModelandembeddingModeloptions, so it gets the default too.heartbeatTimeoutyou set wins, andheartbeatTimeout: 0turns it off. The default is applied with??, so a 0 passes through, and Temporal schedules it as no heartbeat timeout.heartbeatTimeout. It now gives the default and how to turn it off.The MCP Activities don't heartbeat yet, so they still get no heartbeat timeout.
Why?
Without a heartbeat timeout, these Activities never heartbeat while they wait on the provider. So a cancel never reaches the call, and a lost Worker goes unnoticed until the 10-minute start-to-close timeout. #491 has the details, and the measurements behind 10 seconds.
Does this break anything? Not replay: when core replays a scheduled Activity, it only compares its ID and type. I recorded a History for each of the three Activities without this change, and all three replay with it. But a call that didn't set
heartbeatTimeoutnow heartbeats, which in Temporal Cloud is at most one Action every 8 seconds of a running call. And a Worker whose event loop is blocked for about 10 seconds now fails the call with a heartbeat timeout, and retries it.This goes well with #470, which passes the Activity's cancellation signal to the model. Without a heartbeat timeout, that signal never fires while the call waits on the provider.
This PR and #469 both change the
proxyActivitiesoptions inTemporalEmbeddingModel.doEmbed. Whichever merges second keeps both.Checklist
Closes [Feature Request] Give Vercel AI SDK model and embedding calls a 10-second default heartbeat timeout #509
How was this tested:
Model activity (<call>) heartbeats while the provider is slownow runs each call three times and reads the Activity's heartbeat timeout from History: 1 second when set (which passes only if the Activity heartbeats, since each call takes 2 seconds), 10 seconds by default, and none with0. Without the change, all three tests fail on the default:||in place of??, the0case gets 10 seconds and fails, so the test covers the opt-out too.make test(86 passed, 1 skipped),make lintand the conventions check pass, on Node 24.Any docs updates needed?
The README is updated here. Release notes should mention the new default, and how to turn it off.