Skip to content

perf(sessions): remove redundant snapshot walks - #171964

Merged
steipete merged 1 commit into
mainfrom
steipete/perf-micro-remaining-freeze-callers-20260919
Oct 14, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/perf-micro-remaining-freeze-callers-20260919

Conversation

@steipete

@steipete steipete commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Session commits repeatedly walk already detached internal snapshots and compute predicate columns that no reader consumes, adding main-thread allocation churn.

User Impact

No intended behavior change. Session publication and actor authorization do less work; storage formats, permissions, live authority checks, and public APIs stay unchanged.

Why This Change Was Made

Remove deep freezes while preparing committed entry publications and consuming detached SQLite actor admission/stale-result facts. Delete the actor replica's unused predicate-column cache, including three whole-entry stringify/scanner calls and its obsolete test assertions. SQLite writer and migration predicate derivation retains its existing malformed JSON and duplicate-key behavior.

Contextual ingress already bypasses the principal cache; skip serializing its unused cache key while retaining the live origin check. Prompt-history fingerprints still inspect mutable nested values because in-place mutation detection is a supported contract; existing prepared tool-schema fingerprints remain in use.

Production code: 30 net lines removed. No new cache or compatibility path.

Evidence

  • Independent subagent review (autoreview route unavailable): clean for P0–P2. Autoreview preflight refused the provider selector because it did not match the operator configuration; no configuration was changed.
  • Focused local actor, replica, entry-patch, and shared-auth-generation files: 71 tests passed (96.24 s wrapper wall time, including worker preparation; shared-auth 32.84 s, runtime-config files 58.37 s). The first attempt stopped during preparation when formatting changed a source; the unchanged rerun passed. Changed-file formatting/lint and git diff --check passed; PR CI owns broad validation. No Testbox/Crabbox lease.
  • Exact-head PR CI passed at 06bcec02394a4f1815dc80490bc450d860ad9c70; hosted review and both required CI gates passed. No failed CI or reruns.

Before/after measurement

Isolated Team sandbox, Node 26.8.2, synthetic 5,000 sessions / 6,000 retained runs, 4,641,595,392-byte agent DB and 11,812,864-byte state DB on both fresh fixtures. Existing allocation harness: transcript-broadcast-measure.ts --allocations --scenario chat.send --clients 1 --runs 1 --rounds 5 --chunks 100. Baseline fa48c5f72db55f1c0dc127b58e186e31861d4047; candidate 06bcec02394a4f1815dc80490bc450d860ad9c70. CPU affinity 64–127, MemoryMax 64G, nice 10 / idle I/O; own HOME/state/temp and loopback ports. Runtime builds were benchmark preparation only.

Two counterbalanced pairs (base→head, then head→base on their existing synthetic fixtures), ten measured turns per revision after warmups. All twenty turns completed one tool call/result and fourteen session events. Mean main-isolate sampled allocation below the targeted callers:

Allocation stack Before After
JSON predicate scanner 5.714 MB/turn 0
Publication deep freeze 1.576 MB/turn 0
Durable actor deep freeze 2.709 MB/turn 0.0165 MB/turn

Whole-turn mean allocation was 1.253→1.280 GB (+2.1%, sample SD 62/89 MB): neutral within observed run variability, not a whole-turn allocation improvement claim. The first pair rose 7.6%; the reverse-order pair fell 3.2%. Largest positive stack differences were in unchanged SQLite admission fanout/V8 allocation. Mean wall time was 4.543→4.405 s (-3.0%), main-thread CPU 3.456→3.291 s (-4.8%), and GC 73.57→62.24 ms (-15.4%); these are noisy profiled observations, not throughput guarantees. Allocation profiles include objects collected by minor/major GC at 32 KiB sampling.

The contextual-ingress unused cache-key deletion is not exercised by this chat.send fixture. Other stable-stringify work remains, including mutation-sensitive prompt fingerprints. This explicitly requested net deletion lands with neutral aggregate allocation and the targeted walks removed; no new cache or complexity is justified by these numbers.

@clawsweeper

clawsweeper Bot commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@steipete
steipete marked this pull request as ready for review October 14, 2026 08:24
@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: S labels Oct 14, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 14, 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-14T08:27:21.128535Z 06bcec0 Draft marked ready
ℹ️ 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.

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Security sensitive changes

This maintainer PR changes sensitive security components.

No secops approval is required. This comment is informational because the PR author has Maintain or Admin access.

  • Current SHA: 06bcec02394a4f1815dc80490bc450d860ad9c70
  • Maintainer: @steipete
  • Repository role: admin

These security sensitive changes were made:

  • src/gateway/auth-policy.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.

Carefully review these changes before merging.

@steipete
steipete merged commit ab42e91 into main Oct 14, 2026
207 checks passed
@steipete
steipete deleted the steipete/perf-micro-remaining-freeze-callers-20260919 branch October 14, 2026 08:41
vincentkoc added a commit that referenced this pull request Oct 14, 2026
…/plugin-memory-addon-presentation-20261014

* commit 'a8da8c92e3dbb21dd1441a30eb842fcd942e82b6': (52 commits)
  test(ui): await terminal reconnect fixture readiness (#171945)
  perf(gateway): retain only the requested ordered session page (#171968)
  test(gateway): cover automation run-alias placement lifecycle (#139313)
  fix(ci): retry FRV job listings with smaller pages after GitHub 5xx (#171952)
  fix(process): prevent false cleanup failures after CLI stdin closes (#171969)
  test(doctor): cover released updater advisory warnings (#157086)
  fix(ci): skip Testbox builds for known prose files (#171946)
  perf(sessions): remove redundant snapshot walks (#171964)
  fix(ci): skip plugin scaffold build for SDK instructions (#171944)
  fix(infra): preserve scheduler scope abort state after retirement
  fix: setup diagnostics can repair state without approval (#171960)
  perf(usage): avoid per-session admission churn during inventory (#171868)
  fix(ci): exclude documentation from extension lint scope (#171909)
  test(gateway): keep runtime-only compat flags out of live gateway config (#171953)
  docs: document ClawHub install telemetry opt-out (#114376)
  fix: recover completed chat replies after missed publication (#171766)
  refactor(ui): decouple session controller types from Lit (#171559)
  fix(gateway): settle worker reconciliation during busy shutdowns (#171843)
  fix(ci): ignore protocol prose in bundled check selection (#171908)
  fix(ui): align replacement lines and highlight inline diff edits (#171935)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant