Repository navigation
Conversation
Contributor
|
🦞👀 Pull request received. I will update this pull request when review starts. |
steipete
marked this pull request as ready for review
October 31, 2026 21:54
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
deleted the
steipete/perf-micro-responses-prefix-fingerprint-rehash-20260919
branch
October 31, 2026 22:14
Contributor
Author
|
Merged via squash.
|
github-actions Bot
pushed a commit
to Desicool/openclaw
that referenced
this pull request
Nov 1, 2026
…189796) * perf(agents): reuse Responses history prefix hash state * test(agents): type Responses observer fixture options
This was referenced Nov 16, 2026
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
Long OpenAI Responses conversations repeatedly encode and hash their entire history while validating persisted replay state, increasing request CPU and garbage collection as the conversation grows.
User Impact
Immutable text history now hashes only newly appended entries. Request bytes, persisted SHA-256 fingerprints, restart compatibility, and prompt-cache identity remain unchanged; no configuration or storage migration is needed.
Why This Change Was Made
The fingerprint is persisted, so a hash-of-entry-hashes would change its contract. The fingerprint owner instead keeps weakly owned SHA state at immutable prefix boundaries and validates the ordered entry identity chain before extending it. Rewrites, branches, and replacement compaction state invalidate incompatible checkpoints.
Read-only diagnostic/prompt observers and unchanged text sanitation now preserve the converter's existing immutable publications. Genuine payload hooks still receive editable copies. Validated saved compaction state publishes data-free entry identities without retaining decoded windows or image URLs.
A linear identity walk remains. Mutable inputs, image-bearing sanitation output, and reconstructed inline-compaction assistant tails can stop prefix reuse; their suffix retains the original hashing behavior. This does not remove independent compaction validation or request serialization.
Evidence
pnpm check:changed --staged --base HEADand the full rerun exposed the inherited dead export below plus test fixture typing/lint errors, now repaired. Core production typechecking, all test-type shards (including the repaired package shard), core/script lint, and 58 affected tests pass; the observer-option typing repair additionally passes all 22 transport tests. All remaining guards completed successfully; the dead-export finding is the only unresolved local failure.d3d314c01e500d2952aff2695ca5ca214343bb15. Native preparation preserved that head.publishPluginSourceSnapshotis unused in production. The exact parent680003ae23115f5ad68a34808a0f44265427916dreproduces the same sole production Knip finding. It was introduced by8e6129a813f88f1eb145a979c39d141cd8437c93(feat(plugins): publish installed source snapshots #189624), whose new export has test consumers only. This patch does not touch that owner. Main independently repaired this regression ina6a2378739fc116e8b44bac495d6b62463134683(fix(plugins): remove test-only snapshot publisher #189770) while this lane ran; final main-source inspection confirms the wrapper is removed.Synthetic fixture: 20 interleaved sessions, approximately 2 KiB per history entry, five one-entry appends per session, actual request preparation/sanitation. Five counterbalanced A1/A2 rounds per owner; ten samples of 100 warm calls. CPU is process CPU; allocation uses V8 sampling including GC-collected objects. No production data or live provider traffic.
At 2,000 entries: CPU −94.5%, allocation −99.94%. A/A median CPU controls were 6,230/6,194 µs before and 343/327 µs after. Cold first-hash CPU was flat or improved; cold allocation grew 3.4–3.6%. A separate retention probe measured approximately 245 KB additional heap at 2,000 entries and confirmed weak input collection. These are fingerprint-owner measurements, not Gateway latency or prompt-cache hit-rate claims.
Reproduce with
scripts/perf/responses-prefix-fingerprint-measure.tsagainst a saved baseline owner. Acceptance: identical legacy digests, no historical encoding on immutable append, lower warm CPU/allocation, and disclosed cold/retained-state cost. Host: Node 26.12.1, macOS, 32 logical CPUs; shared-host timing noise is covered by A/A controls.Production net +178 LOC, tests +290, benchmark +210. The growth preserves exact persisted hashes and immutable ownership through the existing observer/sanitation/compaction boundaries; no schema-hash cache or new persisted state was added. Author simplification pass complete.