Repository navigation
fix: restore Git backups containing Unicode line separators - #188522
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: needs maintainer review before merge. What this changesRead Git backup records at LF boundaries so Unicode line and paragraph separators remain intact. Example: Restore a backup containing the TEXT key "line\u2028separator" and value "paragraph\u2029separator", with literal separator characters.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Regression provenancePossible regression — probable (reviewed change; failure trace). No predecessor PR is attributed. Merge readiness✅ Ready for maintainer review Keep open: this PR repairs a confirmed backup restoration defect still present on main, with no actionable correctness findings. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherGit backup verification and restoration materialize committed artifacts, load their records into private SQLite staging, validate integrity and digests, and publish a fresh restore target. flowchart LR
A[Backup CLI] --> B[Committed Git artifacts]
B --> C[UTF8 decoding and LF framing]
C --> D[Private SQLite staging]
D --> E[Integrity and manifest checks]
E --> F[Fresh restore target]
Technical reviewBest possible solution: Land LF-only framing in the existing codec while preserving UTF-8 text, original-byte hashes, bounded batches, and verified publication. Do we have a high-confidence way to reproduce the issue? The LF-writing encoder, current-main reader, inspected Node framing expression, and independent official-release failure traces establish the mechanism; this read-only review executed no target code. Is this the best way to solve the issue? The defect is record splitting inside valid JSON strings; the required invariant is one LF-delimited record per parse, and the patch restores it using the existing decoder and restore owner without unnecessary machinery. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 7d9677ce36db. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +15, Tests +1, Other +2. Total +18 across 3 files. Added test files: 0. View PR surface stats
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel changes: No label changes. Label justifications:
Rating scale6/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. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (1 earlier review cycle)
Reviewed October 30, 2026, 3:38 PM ET / 19:38 UTC (Revision 2). |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Published 10.10 follow-up: the Unicode-separator restoration defect is still present in the shipped reader. The description now links the exact published-tag code and separates this issue from the release's unrelated backup improvements. I also recorded synthetic verify/restore compatibility checks on the installed 10.10 packages on macOS and Linux using an isolated LF-framing helper, with exact TEXT-byte preservation and corruption rejection. That is additional compatibility evidence, not a new exact-head PR run or a production restore. The existing exact-candidate CLI proof and review remain unchanged. Please consider the focused reader fix for maintainer review; there is no Gateway-wide workaround in this PR. |
…#188522) Git backup restore and verify now handle saved text containing Unicode line and paragraph separators (U+2028/U+2029) without rewriting the backup. The backup format and SQLite publication checks are unchanged (fixes openclaw#188519). Co-authored-by: dubr1k <[email protected]>
|
Independent verification on main The existing synthetic SQLite dump/restore round trip preserves literal U+2028 in a key and U+2029 in a value, including the original bytes checked through Only synthetic fixtures were used. This verifies current source, not inclusion in a particular published package or restoration of a production backup. |
…#188522) Git backup restore and verify now handle saved text containing Unicode line and paragraph separators (U+2028/U+2029) without rewriting the backup. The backup format and SQLite publication checks are unchanged (fixes openclaw#188519). Co-authored-by: dubr1k <[email protected]> (cherry picked from commit f6d1e4c) Release adaptation: LF-only JSONL framing using existing strict UTF-8 decoder; byte hash, SQLite decode and batching unchanged. Exclude allocation record and unrelated later allocation retirement. Follow-up dispositions: d6ded18 chore(ci): drop retired test-lines allocation records (2/3) (openclaw#197656) Validation: Direct framing experiment: Node readline splits one U+2028/U+2029 JSON row into 3 invalid lines; LF parser preserves exact row. Full restore regression blocked during compiled-worker setup (quickjs/lancedb, then markdown package dependency resolution); not restore proof. diff --check passes. Co-authored-by: RomneyDa <[email protected]> (cherry picked from commit 6d5145708500b492af7ba91ccc0d2f67dcd06439) (cherry picked from commit 78fbd01c6544cbd5d0e8ec6d230cb273b4c3b3a2)
Closes #188519
Related: #145938
What Problem This Solves
Fixes Git backup restoration failing when saved text contains Unicode line or paragraph separators.
User Impact
Operators can restore and verify existing Git backups containing U+2028/U+2029 without rewriting their backups. The backup format and SQLite publication checks remain unchanged; no migration is required.
Why This Change Was Made
The backup writer produces LF-delimited JSON, but
node:readlinealso splits at Unicode separators on the tested runtime. Read records at LF boundaries with the existing streaming UTF-8 decoder instead. Keep hashing the original byte chunks and inserting rows in bounded batches.Published 2026.10.10: restoration gap remains
The published tag still constructs a
node:readlinereader and parses each emitted record as JSON. The Unicode-separator regression covered by this PR remains reproducible in the shipped 10.10 reader. The release's other backup improvements do not establish that this framing defect is fixed.This PR changes record framing only. It preserves the existing backup format, raw-byte hashes, bounded inserts, integrity checks, and fresh-database publication. It remains separate from the Codex/WebChat fixes in #188698 and #188526; no Gateway preload or runtime-wide workaround is proposed here.
Evidence
Additional stable 2026.11.1 compatibility check — November 7, 2026
The source change applies cleanly to the stable 2026.11.1 codec and produces the same candidate used in the isolated package checks. The unchanged stable reader fails verify/restore on literal U+2028/U+2029 while its ASCII control passes. With LF-only framing, verify and fresh-target restore both pass on Node 24.22.1 and Bun 1.4.3 for ASCII, Unicode records larger than 1 MiB, and a record/chunk-boundary fixture. Hash mismatch, invalid UTF-8, incorrect row count, and an existing restore target are rejected without publishing a partial target. This is additional shipped-release compatibility evidence, separate from the exact PR-head CLI proof below; it does not claim a new execution of this PR head.
Current main
2e13c52cstill constructs thenode:readlinereader, so this remains an outstanding source fix. The branch is mergeable at the time of this check; no unrelated rebase or runtime-wide preload is added.Additional published-release check — November 3, 2026
The official 10.10 reader failed on a synthetic backup containing literal U+2028/U+2029. An isolated, explicitly scoped verify/restore helper applying the same LF-framing correction in memory passed against the installed 10.10 packages on macOS and Linux. Fresh synthetic restores preserved the exact SQLite TEXT bytes, and integrity checks passed. Corrupted data or manifest hashes were rejected without publishing a target; an existing target was preserved.
This is compatibility evidence for the framing correction on shipped 10.10, not a new exact-head CLI run of this PR. The helper is external to the proposed patch and is not loaded into Gateway. No production database was restored. The exact-candidate CLI proof and CI evidence remain below.
Unterminated string in JSON; with the fix, byte-level SQLite comparisons and manifest verification pass.git diff --checkpass.b195f61511f9310d9a4dd416e517fb9ec0755f4d, P0–P2: no actionable findings. The reviewer inspected the diff and supplied UTF-8/cleanup context; test execution was performed separately.The shipped CLI was built at
ea07e82(pnpm build, exit 0, 4m 16s). Bothbackup git verifyandbackup git restoreexit 0 on the same unchanged, committed synthetic backup containing literal U+2028/U+2029. Independent SQLite reads preserve the exact TEXT bytes; integrity and foreign-key checks pass. A modified table with its original manifest is rejected by both commands (exit 1, hash mismatch), and restore publishes no target.GitHub CI, dependency review, and security-sensitive review gates pass on this head. All databases and state used for CLI proof were disposable and isolated; no production restoration or release qualification is claimed.
Redacted CLI proof on the exact candidate