feat(world-local): support Hook minimum retention#2866
Draft
NathanColosimo wants to merge 7 commits into
Draft
Conversation
Contributor
🦋 Changeset detectedLatest commit: f37fa91 The changes in this PR will be included in the next version bump. This PR includes changesets to release 18 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Contributor
🧪 E2E Test Results✅ All tests passed Summary
Details by Category✅ 💻 Local Development
✅ 📦 Local Production
✅ 🐘 Local Postgres
✅ 🪟 Windows
✅ 📋 Other
❌ Some E2E test jobs failed:
Check the workflow run for details. |
NathanColosimo
force-pushed
the
codex/hook-retention-core
branch
from
July 9, 2026 23:16
87b6bd9 to
bd33c10
Compare
NathanColosimo
force-pushed
the
codex/hook-retention-local
branch
from
July 9, 2026 23:16
697002e to
d6a289a
Compare
NathanColosimo
force-pushed
the
codex/hook-retention-local
branch
from
July 10, 2026 17:12
01ebb5f to
5baad78
Compare
NathanColosimo
force-pushed
the
codex/hook-retention-local
branch
from
July 10, 2026 17:21
5baad78 to
67ed50a
Compare
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
Contributor
|
Deployment failed with the following error: |
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
experimental_minRetentionin the Local WorldhookRetentionWorld capabilitydispose()is calledStacked on #2865, which defines and documents the core API and event contract.
This PR does not add an external token-release API. That can be designed separately; explicit
hook.dispose()remains the immediate release path for the owning workflow.Implementation
Local World already stores a file for atomic Hook-token ownership. This PR adds the absolute
tokenRetentionUntilvalue to that record instead of introducing a second retained-only entity.Terminal cleanup keeps the Hook and ownership record only while retention remains. The configured time is a minimum: an active run keeps its Hook valid even after that time. Once both the run is terminal and retention has ended, Hook lookup treats it as unavailable and the next claimant removes the stale files before taking ownership.
Completion, failure, and cancellation all reuse the same terminal cleanup path. A cancelled run therefore has the same retention behavior without separate cancellation logic.
Filesystem locks make each read-delete-write replacement atomic. This matters when multiple
createStorage()instances or Node processes share one data directory; JavaScript execution within one process does not serialize those independent instances.Verification
@workflow/world,@workflow/errors,@workflow/core,workflow, and@workflow/world-localbuilds@workflow/coresuitehookMinRetentionWorkflow - terminal Hook cannot resume and its token stays unavailableFocused coverage includes cancellation and terminal retention across all Hook read APIs, event-log recovery, active runs past the retention boundary, replacement across storage instances, explicit disposal, and same-Hook retry stability.