Skip to content

perf(worker): trim unused actor admission replica metadata - #184018

Merged
steipete merged 1 commit into
mainfrom
steipete/perf-untyped-worker-object-messages-20261026
Oct 26, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/perf-untyped-worker-object-messages-20261026

Conversation

@steipete

@steipete steipete commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Actor worker admissions repeatedly clone replica metadata that their live grant handlers never consume.

User Impact

A small reduction in worker-message bytes and allocation during session activity, with no user-visible behavior change or migration.

Why This Change Was Made

Narrow the existing authority projection to the exact physical/session target and complete session entry. Replica version, write token, and dependency IDs remain in full read results and committed receipts; expected-version checks stay in the worker command. Live authority and operation-publication checks still run at both transaction boundaries. No new cache, protocol mechanism, or configuration.

Runtime production delta: −3 LOC. Required reproducible benchmark tooling adds 134 LOC; the requested non-test/non-doc diff including that tooling is +131 LOC (139 additions, 8 deletions). The standalone benchmark’s usage is in its header. No shared performance README change.

Evidence

The existing actor admission regression fails on the baseline: 407 framing bytes, exceeding its <32-byte budget beyond target and entry. With the fix, all 28 actor tests pass, including stale-version rejection, native receipt recovery, and fresh-message authority revocation. Core typecheck, changed-file lint/format, export-name collision guard, and both import-closure guards pass (22 closure tests).

Independent subagent review (autoreview route unavailable): fresh-context Codex review found no actionable P0–P2 findings. The autoreview helper refused the requested provider because it did not match operator configuration; configuration was not changed. GitHub’s separate Codex review also completed on this exact head with no findings.

Native owner measurement

The committed scripts/perf/session-actor-admission-measure.ts reads one actual row from an isolated synthetic Gateway, then measures the production authority projection plus native MessageChannel cloning. The row contains 31,461 serialized bytes.

Per admission Baseline Candidate Change
Serialized envelope bytes 32,303 31,855 −448 B (−1.39%)

Five alternating AB/BA pairs completed on the fixed PR head: 5,000 operations per arm per pair, 25,000 per arm per mode, after 1,000 warmups per process. Timing is untraced; allocation uses a separate collected-object sampling pass. Both CPU and allocation improved in every pair. This is a small allocation win; CPU is owner-thread sender/receiver cost on a busy Mac, not a whole-Gateway throughput claim.

Mean per 5,000 admissions Baseline Candidate Absolute / relative delta
Thread CPU 550.167 ms 504.395 ms −45.772 ms / −8.32%
Sampled allocation 347,554,930 B 343,698,194 B −3,856,736 B / −1.11%
Paired measurements and host load
Pair CPU ms base → candidate Allocation bytes base → candidate Timing host load base → candidate Allocation host load base → candidate
1 (AB) 606.108 → 508.978 347,615,024 → 343,557,560 71.48 → 65.30 73.10 → 75.32
2 (BA) 498.397 → 489.650 347,914,400 → 343,986,176 66.54 → 71.30 79.49 → 65.78
3 (AB) 520.426 → 500.867 347,311,480 → 343,577,800 73.40 → 67.75 64.70 → 65.29
4 (BA) 537.864 → 488.439 347,032,296 → 342,873,104 69.92 → 65.21 73.40 → 79.34
5 (AB) 588.039 → 534.040 347,901,448 → 344,496,328 70.63 → 78.08 77.14 → 77.02

Host load is the one-minute load average measured per arm. An earlier incomplete campaign was interrupted by checkout recovery and excluded in full; the table is the fresh five-pair campaign. GC observer output from this short synchronous harness is not a GC acceptance measurement.

The lane's pure-deletion fast path applies: no multi-pair ten-minute Gateway A/A campaign and no whole-Gateway latency claim. The real Gateway run below establishes frequency and attribution. No production Gateway was load-tested.

Refined untyped-message attribution

Baseline built Gateway: 10,800 synthetic sessions, 128 MiB transcripts, 40 enabled plugins, four WebSocket clients, four concurrent mock-provider turns with tools/native subagents, sidebar/list/history/search churn. The refined window was 120.016 seconds, four rounds. Scratch sender instrumentation records field names and call-site stacks, never payload contents, and is not committed. Sizes use V8 serialization and are wire-size estimates, not allocated heap bytes. Ordinary SQLite replies are identified by their separate typed request and omitted from this table.

Sender → receiver / owner Messages MiB/min
Worker → main: actor transaction admission 366 5.089
Worker → main: actor commit admission 310 4.345
Main → worker: provider prompt serialization 62 4.340
Worker → main: entry-patch commit admission 308 1.609
Main → worker: shared-state reads 157 1.399
Main → worker: database admission arrays 381 0.313
Worker → main: other prepare admissions 1,060 0.180
Worker → main: memory diagnostics 309 0.167
Main → worker: prompt-history fingerprints 20 0.149
Worker → main: other transaction admissions 1,045 0.138

The actor's complete entry remains necessary for policy checks and dominates its residual payload. Provider prompt/history inputs are consumed by hashing/encoding. Entry-patch and database-admission owners are unchanged. This PR removes only unused fields at the existing actor projection owner; it does not claim to eliminate the larger residual.

@clawsweeper

clawsweeper Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review in progress

ClawSweeper is reviewing this revision. This supersedes any previous blocked status.

View the workflow run.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-26T00:58:28.404553Z bd56367 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation scripts Repository scripts size: S labels Oct 26, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 26, 2026
@steipete
steipete merged commit 1dee1c2 into main Oct 26, 2026
141 of 142 checks passed
@steipete
steipete deleted the steipete/perf-untyped-worker-object-messages-20261026 branch October 26, 2026 01:28
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. docs Improvements or additions to documentation scripts Repository scripts size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant