Skip to content

Expand Activity Heartbeat guidance and fix related heartbeat docs - #5804

Open
Duncanma wants to merge 9 commits into
mainfrom
duncan/activity-heartbeat-docs-review-2be6fd
Open

Duncanma wants to merge 9 commits into
mainfrom
duncan/activity-heartbeat-docs-review-2be6fd

Conversation

@Duncanma

Copy link
Copy Markdown
Contributor

What does this PR do?

Adds the Heartbeat guidance from Tihomir's activity-heartbeat-timeouts playbook that applies to every SDK, and fixes some errors in related heartbeat docs.

Detecting Activity failures

  • Throttling: how often code calls Heartbeat doesn't change how many Heartbeats reach the Temporal Service. The Heartbeat Timeout sets the rate, which is about one a minute above 75s. Also covers the cost of raising maxHeartbeatThrottleInterval.
  • New: Heartbeat details. Only the latest details are kept, and unsent details are lost if the Worker crashes. The 2 MB payload limit applies, and Reset keeps details unless you pass --clear-heartbeat-details.
  • New: Choose a Heartbeat Timeout.
    • How long it takes to detect a crashed Worker (1 timeout) or hung Activity code (1–1.8 timeouts).
    • Each Heartbeat has only about 20% of the timeout to arrive.
    • Common causes of late Heartbeats: a CPU-starved Worker, many Activities heartbeating in one Workflow Execution, or RESOURCE_EXHAUSTED.
    • Don't set a timeout under 1s.
  • New: What happens after a Heartbeat Timeout. The timed-out attempt can overlap the next one. Retries show in pending-Activity info, not in Event History. Pause doesn't move the Heartbeat deadline.

Fixes

  • cost-optimization.mdx: "Long-running Activities with Heartbeats" linked to Worker heartbeats, a different feature.
  • request-failures.mdx: the NOT_FOUND heartbeat throttling step pointed to the poll-operations section. It now points to respond operations.
  • actions.mdx: the throttle wording was missing the 60s cap and the 30s default when no timeout is set.
  • long-running-activity.mdx: gives the 2 MB size limit. Removes the claim that frequent heartbeat calls add traffic, since throttling caps them.
  • failures.mdx and pause.mdx: cross-links to the new sections.

Notes to reviewers

  • Claims were checked against source: temporalio/temporal, sdk-go, sdk-java, and sdk-core.
    • The throttle rule (0.8× the Heartbeat Timeout, 30s default, 60s max) is the same in Go, Java, and Core.
    • The server replaces heartbeat details on every heartbeat, and computes the deadline as max(start, lastHeartbeat) + timeout.
    • Paused Activities get no timeout timers.
    • history.timerProcessorMaxTimeShift defaults to 1s.
  • Go and Java SDK specifics from the playbook are left for a follow-up PR: what happens when heartbeat calls fail, and Java's 4 shared heartbeat threads. A heartbeat-timeout troubleshooting page with server metrics is also planned.
  • Possible bugs, left out of this PR to report upstream: after a Heartbeat Timeout, currentRetryInterval shows a wrong value of about 56 years. After a temporal activity update-options change, new attempts reportedly still use the originally scheduled Heartbeat Timeout.
  • Vale (CI config) is clean and yarn build passes locally.

Add three sections to the Detecting Activity failures page, based on the
activity-heartbeat-timeouts playbook in temporal-server-operations and
checked against server and SDK source:

- Heartbeat details: only the latest are kept, unsent details are lost on a
  Worker crash, the payload size limit applies, and Reset keeps them.
- Choose a Heartbeat Timeout: detection time versus the ~20% of the timeout
  each Heartbeat has to arrive, common causes of late Heartbeats, and no
  sub-second timeouts.
- What happens after a Heartbeat Timeout: overlapping attempts, retries
  missing from Event History, and Pause not moving the deadline.

Also explain that call frequency doesn't change the Heartbeat rate, and fix
related pages: a Worker-heartbeat mislink in cost optimization, a wrong
throttling link in request failures, the throttle defaults in Cloud Actions,
the size limit and call-frequency advice in the long-running Activity
pattern, and cross-links from the failures reference and Activity Pause.
@Duncanma
Duncanma requested a review from a team as a code owner November 24, 2026 15:55
Copilot AI balanced review requested due to automatic review settings November 24, 2026 15:55
@vercel

vercel Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
temporal-documentation Ready Ready Preview Nov 25, 2026 6:11pm UTC

Request Review

@github-actions

github-actions Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

📖 Docs PR preview links

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

🟡 Changes recommended

The documentation still overstates Heartbeat send rates, omits the default 60-second throttle cap from guidance, and gives conflicting Unpause guarantees that could mislead readers about overlapping Activity attempts.

3 open issues
What changed in this PR

Expands the shared Activity Heartbeat reference with SDK-independent guidance and aligns related operational, billing, and design-pattern documentation.

Changes:

  • Explains throttling, checkpoint details, and Heartbeat Timeout selection.
  • Documents retry overlap, failure visibility, and Pause deadline behavior.
  • Corrects heartbeat links and updates billing and long-running Activity guidance.
File Description
docs/​troubleshooting/​request-failures.mdx Points heartbeat throttling troubleshooting to respond operations.
docs/​references/​failures.mdx Links the HEARTBEAT timeout type to recovery guidance.
docs/​evaluate/​cloud/​actions.mdx Adds throttle defaults and their billing implications.
docs/​encyclopedia/​detecting-activity-failures.mdx Expands heartbeat, checkpoint, timeout, and retry guidance.
docs/​encyclopedia/​activities/​activity-operations/​pause.mdx Explains heartbeat deadlines across Pause and Unpause.
docs/​design-patterns/​long-running-activity.mdx Updates heartbeat trade-offs, payload limits, and cadence advice.
docs/​best-practices/​cost-optimization.mdx Corrects the link to Activity Heartbeats.

Review effort: Balanced

Say the throttle interval caps the Heartbeat rate rather than setting it,
include the 60-second default cap in the long-running Activity guidance,
and note on Unpause that an expired Heartbeat deadline can overlap attempts.
Core-based SDKs time the Heartbeat Timeout on the Worker and cancel the
attempt without a Heartbeat, and Java reports it as an exception rather
than a cancellation.
Remove facts stated more than once across the changed pages (pause and
Heartbeat deadline, progress in details, lost unsent details, the
throttle cap), lead procedural sentences with the reader's action, turn
label-style bullet lists into prose, and split the Unpause exception into
its own bullet so it no longer contradicts the no-overlap guarantee.

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

🟡 Changes recommended

Unresolved documentation inconsistencies misstate Heartbeat progress visibility, billing for SDK-throttled calls, and the failure exception to send-rate limits.

3 open issues
3 resolved since last review

Review effort: Balanced

Say only Heartbeats that reach the Temporal Service count as Actions,
scope the one-per-interval cap to a running attempt, and say that clients
can read the latest Heartbeat details while Workflow code can't.

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

🟡 Changes recommended

SDK guides still contradict the clarified cancellation requirements and imply that locally buffered heartbeat details are persisted, leaving readers with misleading guidance.

2 open issues
3 resolved since last review

Review effort: Balanced

Heartbeat calls deliver cancellation; the Heartbeat Timeout detects Worker
failure and sets the throttle interval. A timeout failure carries the last
details the Temporal Service recorded, which can be older than the latest
local value if the Worker crashed.
…eview-2be6fd' into duncan/activity-heartbeat-docs-review-2be6fd

This branch was successfully deployed

1 active deployment
Preview — 9facbe08 Deployed Nov 25, 2026 by vercel[bot]
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