Repository navigation
Keep the sticky cache on empty continuation tails and renew its TTL - #503
Merged
Merged
Conversation
Two follow-ups from the independent review of #501, both in StickyWorkflowCache::appendTail, both affecting only the opt-in continuation v2 path: - An empty tail at the cached boundary (last_sequence == after_sequence, no events), as a completion that records no events answers, now keeps the entry instead of evicting it. The run's next workflow task stays a sticky hit instead of a cold replay. - An appended tail now renews expires_at, as remember() does. A chain of accepted continuations longer than the TTL no longer loses its cache. Unit tests fail without each fix. A new replay corpus scenario shows an empty tail keeping the cache, so the next workflow task replays the cache plus its suffix with no authoritative history read; the base revision evicts and refetches. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Member
Author
|
Independent review: PASS at head c832276 This addresses both non-blocking findings from the #501 review. The only source change is to What I verified:
One minor note, which needs no change: the corpus scenario answers an empty tail to a completion that schedules an activity. A real Server would record an |
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.



Part of #500. This follows up the two non-blocking findings from the independent review of #501 (comment). Both change only
StickyWorkflowCache::appendTail, which is on the opt-in continuation v2 path. They would otherwise cost the server#1181 benchmark cold replays.What
last_sequence == after_sequencewith no events. That empty tail at the cached boundary now keeps the entry. Before,continues([])was false, so the entry was evicted and the run's next workflow task needed a cold replay. An empty tail that claims a differentlast_sequence, or that arrives at another boundary, still evicts.appendTailnow refreshesexpires_atasremember()does. An accepted v2 answer is the run's workflow task, so a chain of accepted steps longer than the TTL now keeps its cache. Before, the entry expired a TTL after the lastremember(), and the next workflow task was a forced cold replay.The worker guide and the
[Unreleased]CHANGELOG entry mention both.Tests
WorkerActivityContinuationV2Testadds three tests:testAnEmptyTailAtTheCachedBoundaryKeepsTheEntry;testAnAppendedTailRenewsTheEntrysTtl, which uses an injected clock;All three fail on main and pass here.
Replay corpus:
continuation-empty-tail-keeps-cache.jsonruns the newgolden.continuation-empty-tailscenario (tests/Support/ContinuationEmptyTailScenario.php). It also has a branch in the official runner and inReplayRegressionFixture. The worker's first workflow task gets an empty tail, and its second task replays the cache plus its suffix with no authoritative history read. On main the entry is evicted and history is refetched. The trusted runner rejects the new workflow type at both source revisions.validate-regression-corpus.py --base-ref origin/mainpasses locally.I ran these locally on PHP 8.3:
WorkerActivityContinuationV2Test(70),WorkerActivityContinuationTest,StickyHistorySuffixTestandReplayRegressionCorpusTestall pass, and PHPStan is clean. CI runs the full matrix.🤖 Generated with Claude Code