Repository navigation
perf(infra): name Knowledge workers and trim storage imports - #185169
Merged
Merged
Conversation
Contributor
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review in progressClawSweeper is reviewing this revision. This supersedes any previous blocked status. |
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. |
steipete
force-pushed
the
steipete/perf-unlabeled-worker-heaps-20261026
branch
from
October 26, 2026 23:36
c38bf97 to
0baea64
Compare
steipete
force-pushed
the
steipete/perf-unlabeled-worker-heaps-20261026
branch
from
October 26, 2026 23:55
0baea64 to
2eb95f9
Compare
github-actions Bot
pushed a commit
to Desicool/openclaw
that referenced
this pull request
Oct 27, 2026
…w#185169) * perf(infra): name Knowledge workers and trim storage imports * fix(infra): preserve worker bootstrap import boundaries * test(knowledge): explain lifecycle import isolation
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
Knowledge registry and per-store storage workers were counted as
other, hiding their memory footprint. Source and sealed worker entrypoints also missed the diagnostics allowlist when their filenames differed from normal builds.User Impact
Worker diagnostics identify Knowledge registry/storage workers by bounded script name. Each Knowledge storage worker loads fewer modules and retains less heap. Authorization, storage schema, worker lifetime, and worker heap limits are unchanged.
Why This Change Was Made
Use the existing tracked worker constructor for Knowledge. The transient Bun SQLite close probe and package-update integrity hasher retain their dependency-light native constructors: early-start configuration loading and package-swap recovery require those bootstrap boundaries, so they are explicitly excluded from this attribution change. Derive source/sealed aliases from the runtime entrypoint manifests and map them to canonical built labels; unknown names and eval sources still fold to
other.Knowledge owns native SQLite stores. Its four JSON predicates can use the existing Kysely function builder directly, eliminating the database-engine lifecycle import and its worker resolver entry. The generated runtime assets remain unchanged after preserving those bootstrap boundaries.
The non-test/non-doc diff is +511/−27 lines (net +484), including 464 lines of reproducible benchmark tooling. Runtime source is +20 lines, required to represent canonical manifest labels across launch forms; no cache or lifetime policy is added. Two benchmark scripts provide reproducible owner and real-Gateway evidence, with usage in their headers.
Evidence
Built Node 26.12.1 on macOS, baseline
c893f1e59c19d27db2a6b3289ecfc83b980fc7edversus that production source plus this diff. Two runs per arm, 40 synthetic provisioned stores and 2,000 warm operations per worker per run:The built arms ran B/B/C/C; they are not matched timing pairs. Candidate five-minute host load was roughly 69–70 versus 45–47, and unchanged registry warm CPU also increased 32.19%. Those CPU figures do not establish a regression or CPU neutrality. Module count, startup allocation and post-collection retention improved consistently. The empty mutation journal measures import/owner overhead, not populated-journal throughput.
A closer C/A/A/C source comparison (same workload, source-only baseline overlay) did not reproduce the built CPU increase: warm storage CPU was 4,373.184→4,198.502 ms (−3.99% mean; pairs −11.88%/+4.39%). Warm allocation was 571.873→589.321 MiB (+3.05%; pairs +4.10%/+2.01%). This is a small warm-allocation tradeoff for the measured cold-allocation and retained-module reduction, not a warm-throughput win. Total GC was 25.350→26.275 ms (+0.000462 ms/operation). Loop p99 was 6.814→7.621 ms (+0.807 ms; pair signs mixed), with 2,062/2,061→2,042/2,046 samples. Max GC pauses were 2.498/2.063→1.499/5.590 ms; major collections 0/0→0/1 are context only. The unchanged registry control's CPU moved +6.65%, allocation −0.009%. No adverse timing verdict is drawn from these noisy short windows; no A/A rejection campaign was needed. Source startup heap is not used as packaged-memory evidence.
The isolated built Gateway opened two real Knowledge stores and completed a mock-provider turn. Its diagnostics HTTP endpoint changed from four
otherworkers to oneregistry-worker.js, twostorage-worker.js, and one remainingother, with full 4/4 cohort sampling coverage. The cohort's final natural heap was 141.573→107.057 MiB. Whole-process RSS was 1,778.115→1,811.024 MiB and main heap 271.935→274.784 MiB; these single natural samples are context, not an RSS or throughput improvement claim. No production Gateway was touched. This cold-import/attribution change uses focused owner and Gateway proof rather than a long hot-path stress campaign.Commands:
The three source/sealed attribution cases fail on base (20 existing cases pass). The Knowledge import-boundary regression fails on base while its two SDK worker-entry cases pass. All 78 focused candidate assertions passed, including ingestion/history and mid-operation revocation; the first combined wrapper run ended with a source-stamp error because generated assets were refreshed during the invocation. Clean affected-check rerun: 63 tests passed across five files / three shards in 114.76 seconds, including both regression files, the close-probe lifecycle tests, and both import/PR closure guards. The changed Knowledge worker-entry file took 1.74 seconds wall time (about 0.35 seconds of tests).
Validation: runtime build, changed-file formatting/lint, export-name collision guard, and both closure guards passed. Exact-head CI run 40423492141 passed on
2eb95f9800d6b9f1b65e7e8ed9461fd757013c65, including the baseline ratchets and aggregate CI gate. Independent subagent review (autoreview route unavailable): clean after fixing cleanup ownership in the new Gateway probe. The configured Codex autoreview route was refused for an operator-provider mismatch; no operator configuration was changed.Initial PR CI caught two bootstrap import regressions from converting the close probe and update hasher to tracked constructors. Those conversions were removed, preserving their original contracts. Bare-Node Vite configuration loads for infra, logging, and process now pass; the package-recovery regression plus worker attribution, hasher, and probe tests passed (41 tests across four files, 49.32 seconds). The final correction received a clean independent scoped review.
The initial Linux Bun Knowledge schema run also failed its restored-file index-count assertion. A focused pinned-Bun replay passed all 10 tests, and the corrected-head Linux Knowledge configuration lane passed. The schema/identity owners were unchanged; the initial failure's cause was not established, and no retry-only CI run or schema change was used. GitHub Codex review completed on
0baea64c07d411bbc6887e4b485434f16bcc6dadwith no findings.The next CI run passed every test lane, build, type check, and lint check, but the mock-export ratchet required an isolation explanation on the deliberately throwing engine-import mock. Added that one comment: importing the real lifecycle module is precisely the regression the test rejects. The specific mock-export ratchet and formatting passed locally, and independent review found no issues. No baseline or assertion was relaxed.
The final head initially had no attached pull-request CI run despite being mergeable. The documented close/reopen recovery restored the trigger for this same PR; a delayed superseded run was cancelled, and replacement run 40423492141 passed. The branch was unchanged during recovery. This PR remains ready and unmerged for the lane lead.