Skip to content

Revert "perf(state): omit unchanged entries from transcript commit receipts (#184215)" - #184276

Merged
steipete merged 1 commit into
mainfrom
steipete/revert-184215
Oct 26, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/revert-184215

Conversation

@steipete

@steipete steipete commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Reverts #184215 (e512f2a).

What Problem This Solves

#184215 removed the unchanged session entry from transcript commit receipts and restored it on the host with structuredClone(reference.entry). Before it, the host only deserialized that entry once from the worker message; structuredClone serializes and deserializes on the main thread, so main-thread copying of the entry roughly doubled. On Team that is now a top-10 main-thread allocation row under streaming load, costing more than the receipt bytes it saved on the worker.

Dropping the clone is not a safe quick fix: the preimage is the replica's frozen hot state and the clone keeps public outcomes from aliasing it (a consumer mutating the outcome entry would throw in strict ESM). That needs a full consumer audit, so this restores the previous behavior now.

Evidence

  • Team r222 (build e512f2a, includes perf(state): omit unchanged entries from transcript commit receipts #184215) stress allocation profile, 30 s under 8 streaming sessions, 2,835 MB sampled: new row structuredClone@js_transferable < restoreSessionActorCommittedOutcome < (anon)@session-actor-durable = 33.55 MB / 30 s on the main thread.
  • This is a pure git revert (same 7 files, −316/+4); it restores the previous receipt projection exactly. Focused session-actor receipt tests run in CI.

Follow-up

Re-land only as a separate PR with (1) a consumer audit proving the restored entry is never mutated, returning the frozen preimage without a clone, and (2) a main-thread allocation A/B under streaming load.

…ceipts (#184215)"

This reverts commit e512f2a.

Team r222 stress profile: the host-side structuredClone in
restoreSessionActorCommittedOutcome costs 33.55 MB/30 s on the main thread,
more than the receipt bytes it saved. Re-land only with a consumer audit and a
main-thread allocation A/B.
@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 complete

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

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-26T06:09:19.083761Z 6d7a61a 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: M labels Oct 26, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 26, 2026
@clawsweeper

clawsweeper Bot commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR restores full session entries in transcript commit receipts and removes host-side entry reconstruction.

Example: Append a transcript event while retaining an unchanged session entry containing a 32 KiB skills snapshot.

  • Before: The worker omits the entry and the host reconstructs it with structuredClone.
  • After: The worker sends the complete detached entry through the existing receipt transport.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) A focused, exact rollback with no identified defect; performance confidence remains limited to source inspection and the reported pre-revert profile.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored rollback is outside the ordinary contributor-proof gate; the supplied streaming profile supports the diagnosis but does not demonstrate an after-revert result.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Performance · Worth it: Yes · Fix scope: Complete
User problem: Streaming sessions incur additional main-thread allocation while reconstructing unchanged session entries.
Reason: The maintainer-authored rollback explicitly prioritizes main-thread work over receipt-byte savings and defers the broader consumer audit.

Regression provenance

Possible regression — suspected (reviewed change). No predecessor PR is attributed.

Merge readiness

✅ Ready for maintainer review

Keep this PR open: the maintainer-directed revert exactly restores the prior receipt implementation, and no introduced correctness or security defect was found.

Priority: P2
Reviewed head: 6d7a61a97c0b18a0a8a2465cf3cf536761b5588e

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: No after-revert streaming allocation comparison is supplied; the existing profile describes the optimized build before rollback.
Agent review details

How this fits together

The durable session actor executes mutations in the database worker and sends committed outcomes to the host for publication, observers, and replica installation.

flowchart LR
  A[Transcript append command] --> B[Database worker mutation]
  B --> C[Complete committed receipt]
  C --> D[Native receipt transport]
  D --> E[Host settlement checks]
  E --> F[Publications and observers]
  F --> G[Session replica]
Loading

Technical review

Best possible solution:

Restore complete worker receipts now and revisit entry omission only after a consumer audit and streaming allocation comparison.

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

Current-main source confirms the additional host clone on matching unchanged-entry appends, and the maintainer reports its allocation profile; the overall performance regression was not independently reproduced.

Is this the best way to solve the issue?

The exact revert is the smallest complete rollback using existing receipt owners and preserves detached outcomes without introducing an unaudited frozen-entry alias.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 5f71bbf09e6a.

Provenance checked

  • Receipt projection, reconstruction, associated tests, benchmark, and documentation changes intended behavior with a stated reason (e512f2a: Reduce unchanged-entry receipt transport while restoring detached entries before consumers run.)

Testing

Proof path: none.

Security

None.

Evidence

What I checked:

  • Exact restoration: The introduced diff removes receipt projection and reconstruction together; comparison with the parent of the reverted optimization produces no differences across the seven affected paths. (src/config/sessions/session-actor-receipt.ts:108, 6d7a61a97c0b)
  • Maintainer rollback decision: The full PR body reports a streaming allocation profile attributing 33.55 MB of sampled main-thread allocation to entry reconstruction and explicitly chooses rollback pending a consumer audit and allocation comparison. (6d7a61a97c0b)
  • Original optimization and accepted tradeoff: perf(state): omit unchanged entries from transcript commit receipts #184215 reduced receipt bytes using detached host reconstruction; this PR deliberately restores the larger payload to remove that main-thread clone. (e512f2ad391e)
  • Settlement and isolation remain owned: The worker passes the complete outcome to the existing capture owner, which detaches inline facts or serializes oversized outcomes; host native-settlement, transfer identity, command identity, and admission checks remain intact. (src/config/sessions/session-actor.worker.ts:609, 6d7a61a97c0b)
  • Current main still contains the optimization: Fetched main retains both the receipt projector and host reconstruction, so the rollback remains distinct work. (src/config/sessions/session-actor-sqlite.ts:348, 5f71bbf09e6a)
  • Outstanding check is PR context: The failed PR-context check requests problem and evidence sections that are present in the current body; its annotations establish no source defect. PostgreSQL conformance and the aggregate CI gate remain pending. (.github/workflows/real-behavior-proof.yml:14, 6d7a61a97c0b)

Likely related people:

  • Peter Steinberger: Raw commit 6f8748a adds src/config/sessions/session-actor-sqlite.ts:297 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 6f8748ad8898; files: src/config/sessions/session-actor-sqlite.ts)
  • Vitor Cepeda Lopes: Raw commit ca0a172 adds src/config/sessions/session-actor-sqlite.ts:234 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: ca0a172d2927; files: src/config/sessions/session-actor-sqlite.ts)

PR surface

Source -59, Tests -43, Docs -7, Other -203. Total -312 across 7 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 3 4 63 -59
Tests 2 0 43 -43
Docs 1 0 7 -7
Config 0 0 0 0
Generated 0 0 0 0
Other 1 0 203 -203
Total 7 4 316 -312

Labels

Label changes:

  • add P2: A bounded performance rollback addresses reported recurring main-thread allocation without evidence of a broken user workflow.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P2: A bounded performance rollback addresses reported recurring main-thread allocation without evidence of a broken user workflow.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed October 26, 2026, 2:24 AM ET / 06:24 UTC.

@steipete
steipete merged commit a7e0b82 into main Oct 26, 2026
152 of 154 checks passed
@steipete
steipete deleted the steipete/revert-184215 branch October 26, 2026 06:31
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 27, 2026
…ceipts (openclaw#184215)" (openclaw#184276)

This reverts commit 5401484.

Team r222 stress profile: the host-side structuredClone in
restoreSessionActorCommittedOutcome costs 33.55 MB/30 s on the main thread,
more than the receipt bytes it saved. Re-land only with a consumer audit and a
main-thread allocation A/B.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. scripts Repository scripts size: M 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