Skip to content

perf(gateway): streamline config reload comparison - #152279

Merged
steipete merged 1 commit into
mainfrom
codex/perf-r2-config-diff-20260918
Sep 19, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/perf-r2-config-diff-20260918

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Config reload comparison repeatedly scans refinement prefixes and allocates child result arrays even when those operations cannot affect the result.

User Impact

Config comparison performs less repeated work while preserving the exact changed-path ordering and reload decisions, including duplicate dotted paths and whole-section reload boundaries.

Why This Change Was Made

The existing diff owner now appends into one result array, prepares plain-object facts once, and examines refinement prefixes only when one side is an object. Array structural comparison, root labels and derived Talk-owner handling stay unchanged. No cache, trie, configuration policy or persistence change is introduced. The private accumulator helper adds eight net production lines.

Evidence

Baseline and candidate each passed the same 599 Gateway tests across config reload, transcript reload policy and Telegram reload policy. The complete changed-file gate and independent Codex P2 review passed. Separately retained untimed captures preserve exact ordered paths and complete typed reload plans for 13 full comparison cases and 1,352 edge cases; an independent offline audit passed.

Seven fixed rounds retained 182 batch observations and 1,198,400 timed comparison calls. Ordinary clone/leaf/bulk mean wall time changed from 0.202/0.207/0.219 ms per call to 0.020/0.019/0.022 ms; corresponding process CPU changed from 170.3/168.7/177.0 microseconds to 19.2/18.2/18.8 microseconds. Whole-section add/remove and larger fixtures also improved in aggregate.

All adverse samples remain: tiny no-op mean wall time increased from 0.523 to 0.626 microseconds, and Talk's candidate-first subset increased 17.49% despite a favorable overall mean. Eleven adverse paired wall/CPU observations were retained. The test-suite wall time also grew on the loaded shared host and is not used as evidence of function performance.

These are warm owner-boundary observations with shared-host scheduling/GC effects, not end-to-end Gateway latency or allocation measurements. Full parity was asserted before timing and captured separately; timed loops consumed path lengths rather than retaining every result graph.

@clawsweeper

clawsweeper Bot commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: S maintainer Maintainer-authored PR labels Sep 18, 2026
@steipete
steipete marked this pull request as ready for review September 19, 2026 00:02
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 19, 2026
@clawsweeper

clawsweeper Bot commented Sep 19, 2026

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 18, 2026, 8:07 PM ET / September 19, 2026, 00:07 UTC.

ClawSweeper review

What this changes

The PR reduces repeated work during Gateway configuration comparison by collecting changed paths in one array and avoiding unnecessary refinement-prefix scans.

Merge readiness

⛔ Blocked before merge - 1 item remains

Keep open: this is a focused optimization absent from current main and the latest release. Source review found no introduced correctness defect, and the protected maintainer label rules out automated closure.

Priority: P3
Reviewed head: f8a63de87d41e36489692f1346e02e4805760992

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, behavior-preserving optimization with relevant existing coverage and clearly bounded reported performance evidence.
Proof confidence 🌊 off-meta tidepool Not applicable: The maintainer-authored internal optimization is exempt from the external-contributor proof gate. Its body reports comparison-owner parity and benchmark results, with explicit shared-host limitations; no material authority change requires additional proof.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The maintainer-authored internal optimization is exempt from the external-contributor proof gate. Its body reports comparison-owner parity and benchmark results, with explicit shared-host limitations; no material authority change requires additional proof.
Evidence reviewed 7 items Introduced change preserves comparison semantics: The complete introduced diff retains key traversal order, duplicate paths, undefined-value handling, structural array equality, root labeling, and the existing Talk projection. Only result accumulation and redundant predicate work change.
Optimization remains absent from current main: Fetched main still scans refinement prefixes before object classification and allocates recursive child result arrays.
Latest release comparison: The supplied latest release, v2026.9.4, also contains the older recursive-array implementation.
Findings None None.
Security None None.

How this fits together

The Gateway compares previous and candidate configuration snapshots to identify changed settings. Its reload planner uses those paths to select hot updates, subsystem reloads, or a Gateway restart.

flowchart LR
  A[Previous configuration] --> C[Compare configuration]
  B[Candidate configuration] --> C
  D[Registered reload boundaries] --> C
  C --> E[Ordered changed paths]
  E --> F[Reload planner]
  F --> G[Hot update or restart]
Loading

Before merge

  • Resolve merge risk (P1) - The reported microbenchmark improvements do not establish end-to-end Gateway latency gains; this review did not independently execute the benchmarks or tests.
Agent review details

Security

None.

PR surface

Source +8. Total +8 across 1 file.

View PR surface stats
Area Files Added Removed Net
Source 1 29 21 +8
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 1 29 21 +8

Review metrics

None.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Retain the existing comparison and reload-policy owners while reducing temporary allocations and unnecessary scans without changing their output contract.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Retain the existing comparison and reload-policy owners while reducing temporary allocations and unnecessary scans without changing their output contract.

Do we have a high-confidence way to reproduce the issue?

Not applicable: this proposes a performance optimization rather than a broken-behavior fix. Repeated scans and intermediate arrays are evident in current source; timing results were not independently reproduced.

Is this the best way to solve the issue?

Yes: a private accumulator and reused object classifications narrowly reduce work while preserving the exported interface and existing reload decisions.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 4d27b1a65874.

Labels

Label changes:

  • add P3: This is an internal performance improvement that preserves existing configuration and reload behavior.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The maintainer-authored internal optimization is exempt from the external-contributor proof gate. Its body reports comparison-owner parity and benchmark results, with explicit shared-host limitations; no material authority change requires additional proof.

Label justifications:

  • P3: This is an internal performance improvement that preserves existing configuration and reload behavior.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The maintainer-authored internal optimization is exempt from the external-contributor proof gate. Its body reports comparison-owner parity and benchmark results, with explicit shared-host limitations; no material authority change requires additional proof.

Evidence

What I checked:

  • Introduced change preserves comparison semantics: The complete introduced diff retains key traversal order, duplicate paths, undefined-value handling, structural array equality, root labeling, and the existing Talk projection. Only result accumulation and redundant predicate work change. (src/gateway/config-diff.ts:7, f8a63de87d41)
  • Optimization remains absent from current main: Fetched main still scans refinement prefixes before object classification and allocates recursive child result arrays. (src/gateway/config-diff.ts:17, 4d27b1a65874)
  • Latest release comparison: The supplied latest release, v2026.9.4, also contains the older recursive-array implementation. (src/gateway/config-diff.ts:17, 3a9d69db306c)
  • Existing behavioral coverage: Existing comparison tests cover nested changes, equal and changed object arrays, duplicate dotted paths, whole-section boundaries, and derived Talk owner changes. These assertions remain applicable without implementation-coupled test changes; they were inspected, not executed. (src/gateway/config-reload.test.ts:136, f8a63de87d41)
  • Production reload integration: The live reloader compares current and candidate snapshots using registered refinement prefixes. The unchanged planner consumes the resulting paths; this patch introduces no alternate policy owner, configuration setting, persistence format, or authorization decision. (src/gateway/config-reload.ts:636, f8a63de87d41)
  • Reported validation and performance limits: The captured PR body reports 599 tests passing for both versions, ordered-path and reload-plan parity across 13 comparison cases and 1,352 edge cases, and 1,198,400 timed calls. It explicitly retains adverse samples and limits its claims to warm comparison-owner measurements on a shared host. These are contributor-reported results, not reviewer-executed validation. (f8a63de87d41)

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@steipete
steipete merged commit ca69b4d into main Sep 19, 2026
280 checks passed
@steipete
steipete deleted the codex/perf-r2-config-diff-20260918 branch September 19, 2026 00:37
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Sep 19, 2026
* commit 'ca69b4d25dfcd488acc6ba1d878e4b4252f40cd2': (325 commits)
  perf(gateway): streamline config reload comparison (#152279)
  fix(xai): reject invalid UTF-8 OAuth responses (#111737)
  fix(release): accept waived advisory performance evidence for stable publication (#152290)
  fix: deliver watcher results while other sessions are busy (#152287)
  perf(media): reuse attachment filename classification (#152274)
  refactor(build): reuse forwarded option scanning (#152293)
  chore(diagnostics-otel): revert unapproved duration-bucket merge (#152292)
  fix: stop chat media reads after access changes (#152219)
  fix(test): use Gateway WebSocket transport in network fixtures (#152143)
  improve: retain quota refresh evidence from successful CI runs (#152173)
  improve(gateway): reduce memory used by session selection (#152260)
  perf(agents): use keyed subagent capability lookups (#152263)
  refactor(matrix): centralize media metadata assembly (#149128)
  chore(ui): refresh control ui locales (#152276)
  feat: open Crabbox apps beside the conversation (#152094)
  refactor: simplify worker and model fallback handling (#152268)
  perf(codex): reconcile session catalogs incrementally (#152257)
  fix(ui): keep submitted prompts visible across session startup (#152241)
  perf(sessions): move automatic maintenance database work to workers (#148630)
  fix: preserve reply metadata through outbound preparation (#152231)
  ...
vincentkoc added a commit that referenced this pull request Sep 19, 2026
* commit '912b21b98581c0be3baad87fe3686b64d69fffeb': (191 commits)
  perf(process): reduce allocation while processing command output (#152261)
  fix(ui): collapse duplicate previews when a page opens in multiple tabs (#152281)
  fix(test): run local Gateway tests behind protected exec egress (#152318)
  fix(node-host): avoid blocking configuration reads (#151411)
  fix(qa-lab): prevent Evidence Archive filters from overflowing (#152123)
  test: stabilize Docker scheduler signal fixtures on macOS (#152301)
  fix(ui): close stuck submenus when moving between menu rows (#152317)
  fix(ui): preserve question drafts and pending submissions (#152096)
  fix(release): recognize 7.34 fs-safe contract (#152326)
  chore: retire CLAUDE.md files
  fix(ui): release queued input after completed chat runs (#152299)
  improve(tooling): reduce commit formatting resource use (#152297)
  feat: show mentioned sessions in Involving me (#152083)
  perf(tasks): reuse prepared audit summaries (#152294)
  fix(daemon): preserve LaunchAgent rollback bytes and modes (#152195)
  fix: stop chat layout changes from loading extra history (#151726)
  perf(gateway): streamline config reload comparison (#152279)
  fix(xai): reject invalid UTF-8 OAuth responses (#111737)
  fix(release): accept waived advisory performance evidence for stable publication (#152290)
  fix: deliver watcher results while other sessions are busy (#152287)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gateway Gateway runtime maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant