Isolate SaaS tenant runtime state per async execution - #4
Merged
OneClickPostFactory merged 9 commits intoSep 6, 2026
Merged
OneClickPostFactory merged 9 commits into
OneClickPostFactory merged 9 commits into
Conversation
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.
Purpose
Complete the process-global isolation part of D03 after the bounded overlap containment in PR #3.
The SaaS worker currently assigns tenant OpenAI/provider/media configuration through
withTenantRuntime. Those assignments target the sharedconfigobject, and Threads/LinkedIn/X also swap module-global token-persistence callbacks. The containment gate prevents overlapping drains in one isolate, but the target safety boundary is that async executions do not share tenant-specific runtime state at all.Changes
AsyncLocalStorage-backed runtime scope for Cloudflare SaaS execution.Preserved boundaries
Runtime invariant
processPendingSupabaseJobs()remains serial. Tenant mutation is therefore restored between jobs inside a drain, while overlapping Worker invocations receive independent async-local stores. PR #3's exclusive run gate remains defence-in-depth rather than the sole tenant-isolation mechanism.Acceptance evidence required
The full upstream
npm run cigate must pass on exact heade20fdae11f5660c8560ed6d6283e8e659a78e83b, including the new runtime-scope regression.The regression requires:
Merge order
PR #2 -> PR #3 -> this PR.
This branch is stacked on PR #3 head
ee377775030d27117b2568bc10426da8304c7a24. Until the earlier PRs merge, GitHub will also show their commits in this PR.