Repository navigation
fix(acp): keep Unicode replay within its byte budget - #124476
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: blocked before merge. Reviewed September 6, 2026, 5:00 AM ET / 09:00 UTC. ClawSweeper reviewWhat this changesCorrect ACP session-history byte accounting across runtime writes, legacy imports, and upgrade repair, with regression tests and retention documentation. Merge readiness⛔ Blocked before merge - 1 item remains This PR remains necessary: current main and the latest release retain inconsistent character-based accounting. Earlier findings are addressed, supplied boundary proof is sufficient, and no new blocking defect was found. The documented retention tradeoff has already been accepted. Priority: P2 Review scores
Verification
How this fits togetherThe ACP bridge connects editor clients to OpenClaw and stores replayable session updates in shared SQLite state. Retention accounting determines whether a client receives complete recorded history or falls back to the Gateway transcript. flowchart TD
A[Editor session updates] --> B[ACP bridge]
B --> C[UTF-8 byte accounting]
D[Legacy import and upgrade repair] --> C
C --> E[SQLite replay history]
E --> F{Complete retained history?}
F -->|Yes| G[Exact event replay]
F -->|No| H[Transcript fallback]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +36, Tests +196, Docs +20. Total +252 across 10 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain the unified accounting and atomic repair under the accepted retention policy, preserving canonical replay bytes and the existing upgrade lifecycle. Do we have a high-confidence way to reproduce the issue? Yes, from source: current main counts Unicode with string lengths and subtracts SQLite character counts; repeated metadata writes and a Unicode payload crossing the byte cap expose the inconsistency. No local runtime reproduction was executed. Is this the best way to solve the issue? Yes. A shared per-field byte estimator and transaction-owned rebuild repair all affected producers without changing schema, configuration, canonical JSON, or eviction order. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against f5d4d6bf53a8. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (9 earlier review cycles; latest 8 shown)
|
997e913 to
4a068bd
Compare
4a068bd to
079c331
Compare
Apply consistent UTF-8 accounting to runtime deltas, importer retries and versioned repair while preserving canonical event text. Retain existing caps and eviction order; repaired histories may use transcript fallback sooner. Co-authored-by: lijing <[email protected]>
|
Merged via squash.
|
…penclaw#124476) Co-authored-by: lijing <[email protected]> Co-authored-by: Peter Steinberger <[email protected]>
What Problem This Solves
Fixes an issue where ACP replay history containing Unicode could exceed its byte budget and repeated metadata writes could distort stored totals. Older derived estimates also remained wrong after upgrading, and a partial UTF-8 conversion could still mix byte additions with SQL character subtraction.
Why This Change Was Made
Use one per-field UTF-8 accounting owner for runtime writes, Doctor imports, and existing-row repair. Metadata updates apply the difference between old and new byte counts; appends add only the new event. Repair streams canonical event text and atomically rebuilds every derived total without reserializing or deleting history.
Maintainer decision, September 5: accepted the accounting and retention correction, including repair of nonzero estimates and earlier application of existing limits to undercounted Unicode history. Schema, version, configuration, caps, eviction order, and canonical replay bytes remain unchanged. The existing app-version/Doctor repair lifecycle owns backfill; replacing a same-version build does not automatically trigger it. Reverting needs no migration but restores inconsistent accounting and cannot recover already evicted history.
The remaining ClawSweeper retention-risk item is resolved by honoring that accepted correction: later eviction can remove historic tool-call/system-notice events that transcript fallback cannot reconstruct. We retain the existing cap and eviction order rather than silently preserving an undercount.
This expands @coaiMax's original UTF-8 fix across the affected owners while preserving the original commit ancestry and credit.
User Impact
ACP history consistently uses the existing 16 MiB UTF-8 retained-content budget, including row overhead. Corrected Unicode history may truncate sooner on its next ordinary write and use transcript fallback when loaded. Repair itself preserves identifiers, timestamps, sequences, event JSON formatting, and all replay rows.
Evidence
70940793461136fa91464bbc7155dd3bf9f8e683. The final main refresh preserves all eight executable/test blobs and includes the canonical upstream CI fixture corrections; exact-head CI is green.