Skip to content

Send sticky workers only the history after their cached boundary (#1017 part 2) - #1141

Queued
rmcdaniel wants to merge 2 commits into
mainfrom
feat/server-1017-sticky-suffix
Queued

rmcdaniel wants to merge 2 commits into
mainfrom
feat/server-1017-sticky-suffix

Conversation

@rmcdaniel

Copy link
Copy Markdown
Member

Part 2 of #1017, stacked on #1140 (retarget to main after it merges). The SDK half is durable-workflow/sdk-php#384.

Change (wire shape on #1017, incl. the amendment)

  • Opt-in: a registration listing sticky_history_suffix (plus supported sticky_execution). Server advertises server_capabilities.sticky_history_suffix = {supported: true, version: 1}.
  • Completion: such a worker reports sticky_cache.history_last_sequence (last sequence it replayed and cached). It's stored on the completed task's payload (no schema change). A worker without the capability sending it gets 422 sticky_history_suffix_not_supported.
  • Claim: when that worker claims the run with sticky_hit_expected, history starts after the reported sequence; the answer carries history_after_sequence and history_last_sequence. Any other claim by an opted-in worker carries history_after_sequence: 0 and full history. Paging is unchanged. Workers without the capability see no new fields.
  • The SDK's contiguity check (cached last == after, contiguous suffix, else refetch from 0) remains the correctness guard.

Checks

🤖 Generated with Claude Code

Native and PHP both delivered full history on every workflow task, so a
1,001-event workflow moved about 242 MB (#1017 part 2, sdk-php#233).

A worker that lists sticky_history_suffix reports, with each sticky
completion, the last history sequence it replayed and cached
(sticky_cache.history_last_sequence). When that worker next claims the run
with sticky_hit_expected, it receives only the events after that sequence,
with history_after_sequence and history_last_sequence on the answer. Every
other claim to such a worker carries history_after_sequence 0 and full
history. Workers without the capability see no change and may not report a
boundary. The boundary is kept on the completed task's payload; no schema
change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@rmcdaniel

Copy link
Copy Markdown
Member Author

End-to-end check by sdk-php (2026-11-11) against a local build of this branch, fresh SQLite Server per run, 25 sequential timers (26 workflow tasks): with sdk-php#384, 25/26 sticky hits, 0 forced cold replays, 0 refetches, 41 KB of history; with the main SDK, 0 hits, 25 forced, 573 KB. About 14× less transfer; both runs completed. Details on #1017 and sdk-php#384.

@rmcdaniel
rmcdaniel marked this pull request as ready for review November 11, 2026 18:14
@rmcdaniel
rmcdaniel changed the base branch from feat/server-1017-sticky-parity to main November 11, 2026 18:53
@rmcdaniel
rmcdaniel enabled auto-merge November 11, 2026 18:53
@sonarqubecloud

Copy link
Copy Markdown

@rmcdaniel
rmcdaniel added this pull request to the merge queue Nov 11, 2026
Any commits made after this event will not be merged.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant