Repository navigation
perf(gateway): share pending staged workspace manifest reads - #183128
Merged
Merged
Conversation
Join identical staged-result reads while their worker operation remains pending. Keep independent inputs and cancellation domains separate, and invalidate join admission around result-ref mutations so later readers observe published or deleted refs.
Contributor
|
🦞👀 Pull request received. I will update this pull request when review starts. |
Contributor
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
github-actions Bot
pushed a commit
to Desicool/openclaw
that referenced
this pull request
Oct 25, 2026
…w#183128) * perf(gateway): share pending staged workspace manifest reads Join identical staged-result reads while their worker operation remains pending. Keep independent inputs and cancellation domains separate, and invalidate join admission around result-ref mutations so later readers observe published or deleted refs. * test(gateway): support single-worker staged read regression
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.
What Problem This Solves
Concurrent readers of the same staged workspace result each submit a complete manifest load. Forking one source workspace into distinct sessions is one path that permits this overlap: the target sessions have independent owners, while both read the same source checkpoint.
Change
Join matching pending staged-manifest reads at the existing result-ref owner. Identity includes the complete root/ref/build-cache input, current directory, a digest of the complete captured environment, and the exact cancellation signal. Different requests remain independent. Worker-context calls continue through their existing host-exchange owner.
The ref owner invalidates the pending lookup before and after its writes, including failed writes. Already admitted readers retain their outcome; later readers cannot join a pre-mutation result, and old settlement cannot evict a newer operation. Success and failure both remove entries. There is no completed-result cache or extra Git lookup.
This is separate from #183087 and does not change its two-await tree-input fix. It addresses staged-result read overlap; no reduction of recovery journal memory or of the previously observed 215 MiB tree-input holder is claimed.
Evidence
The regression holds the real worker at Git I/O while interleaving ten staged reads. Six distinct identities cover differing root, ref, build-cache inputs, environment, and signal; repeated identical calls arrive between them.
cat-file commitreads for ten overlapping callersThe first assertion fails on the base with
expected 10 to be 6and passes with the fix. Additional regressions prove deletion during a held read, conditional cleanup after old settlement, cancellation isolation, and retry after failure. Independent validation of staged output, byte authentication, linked-worktree ref ordering, and Git history remains covered by the existing tests.Validation: the initial 26-test run passed across
workspace-result-staging.reads.test.ts,workspace-result-staging.concurrent.test.ts,workspace-result-ref-mutation.test.ts, andworkspace-result-history.test.ts(77.78 seconds Vitest; 97.99 seconds including wrapper and cold artifact preparation). The test-only follow-up at5dd6eb3d68dereleases the old read before waiting for the next worker, avoiding a single-worker test deadlock. All 16 tests in the changed reads file passed again in 50.83 seconds, including the mutation regression with both one and three compute workers (561 and 598 ms). Together with the unchanged 11 sibling tests from the earlier run, this covers 27 distinct tests. Scoped core oxlint (--tsconfig config/tsconfig/oxlint.core.json), gateway-other test typecheck (test/tsconfig/tsconfig.core.test.gateway-other.json), changed-file oxfmt, export-name collision guard, andgit diff --checkpassed; affected gates were rerun for the follow-up. Fresh independent autoreviews of the production change and test follow-up found no actionable P0–P2 findings. Final head5dd6eb3d68de72641506b2bc2fdf2357c785dbcfis fully green: 66 passing checks, 56 skipped, no pending or failed checks. Both the CI aggregate and maintainer aggregate passed. The completed exact-head review reports no findings. No merge was performed; the lead owns landing.Production delta: +57 lines. The added owner state is needed to eliminate duplicate work while preserving cancellation domains and mutable-ref invalidation; it retains only unfinished promises and releases each on settlement. Test delta: +166 lines. No schema, public configuration, dependency, or timeout policy changes.