Repository navigation
fix: workspace sync changes LF files when Git autocrlf is enabled - #140683
Conversation
Disable newline conversion at the shared Git apply owner without changing user configuration, journal representation, or publication behavior. Preserve LF and CRLF bytes through forward application and recovery. The real-Git matrix reproduces LF-to-CRLF conversion on pre-fix main. All ten publication/recovery tests pass with the fix; changed checks and fresh isolated P0 review pass. Split from #132180.
|
🦞👀 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. Reviewed September 6, 2026, 11:08 PM ET / September 7, 2026, 03:08 UTC. ClawSweeper reviewWhat this changesPreserves worker workspace file bytes during synchronization and recovery by disabling Git newline conversion for patch application and extending LF/CRLF regression coverage. Merge readiness✅ Ready for maintainer review The fix remains necessary on inspected main, and no actionable patch defect was found. The prior review’s draft-only blocker is resolved; the broader source PR remains separately open. Priority: P2 Review scores
Verification
How this fits togetherThe Gateway reconciles worker-produced files into the local workspace while preserving local conflicts. Its shared Git patch command applies accepted changes and restores journal snapshots during recovery. flowchart TD
A[Worker result files] --> B[Workspace reconciliation]
C[Local files and base manifest] --> B
B --> D[Raw Git patch]
D --> E[Apply without newline conversion]
E --> F[Updated local workspace]
G[Recovery journal] --> D
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +3, Tests +20. Total +23 across 2 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep byte preservation in the shared patch owner, with command-local Git settings and regression coverage for both application and recovery. Do we have a high-confidence way to reproduce the issue? Yes: applying LF worker files with inherited core.autocrlf=true reaches Git’s newline conversion on inspected main; the PR reports a failing-before/passing-after real-Git matrix. This review verified the source path without executing it. Is this the best way to solve the issue? Yes: the command-local override repairs both apply and recovery at their shared owner while preserving user Git configuration, journal format, and conflict policy. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against e517cb04e902. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
Land-ready at The real-Git pre-fix matrix reproduced LF-to-CRLF conversion under Commands: Exact-head CI is green. Native review artifacts validated and Production +4/−1; tests +78/−58. No permission, schema, journal-format, or user Git configuration changes. This lands only the byte-preservation slice; the original node-session PR remains open for the rest of the split series. |
|
Merged via squash.
|
…aw#140683) Disable newline conversion at the shared Git apply owner without changing user configuration, journal representation, or publication behavior. Preserve LF and CRLF bytes through forward application and recovery. The real-Git matrix reproduces LF-to-CRLF conversion on pre-fix main. All ten publication/recovery tests pass with the fix; changed checks and fresh isolated P0 review pass. Split from openclaw#132180.
Related: #132180 — first independent replacement from the node-session completion series. The original remains open until the remaining parts are landed or otherwise accounted for.
What Problem This Solves
Fixes an issue where users synchronizing worker workspace results would receive LF files rewritten as CRLF when inherited Git configuration enables
core.autocrlf. That changes the worker's bytes even though workspace reconciliation is meant to preserve them exactly.Why This Change Was Made
Disable newline conversion only for the shared Git patch-application command used by forward sync and recovery.
--no-indexplus disabled repository discovery already excludes repository attributes and filters, but does not prevent inherited Git newline conversion.This two-file slice preserves conflict handling, publication outcomes, journal representation, bounds, and user/global Git configuration. It does not include node approval/publication, process lifetime, finalization batching, or other work from the original PR.
User Impact
LF and CRLF content now retain their exact bytes through workspace application and journal recovery, regardless of inherited
core.autocrlf=true,input, orfalse. No new configuration, schema, public protocol, or enablement step is introduced.Evidence
ae2f990dccb7ef7cfd289fd117afc728cc6d078a, the six-row real-Git matrix failed forautocrlf=truewith LF: the observedworker\nbytes gained a carriage return. The other five rows passed. This was a test-only patch before the production change.workspace-reconcile-publication.test.tspassed, including LF/CRLF application and recovery, definitive/indeterminate publication failures, and current-main scratch-cleanup behavior.node scripts/run-vitest.mjs src/gateway/worker-environments/workspace-reconcile-publication.test.ts -t 'raw bytes'before the production fix; then the same file without a filter.node scripts/check-changed.mjs -- src/gateway/worker-environments/workspace-reconcile-recovery.ts src/gateway/worker-environments/workspace-reconcile-publication.test.tspassed.GIT_CONFIG_COUNTsettings override configuration files but are themselves overridden by command-localgit -coptions. The regression exercises the actual Git process rather than mocking its conversion.Production LOC: +4/−1 (net +3). Tests: +78/−58. The production growth is the necessary command-local override and a comment explaining why
--no-indexalone was insufficient. The existing indeterminate-publication test became the six-row matrix; no test-only production seam was added.Provenance: the current patch-application module's affected lines are blamed to the workspace-divergence repair, #111244, authored and merged by @steipete on July 19, 2026 (commit). The same omission is present in stable tag
v2026.9.2. This identifies the current module's provenance, not an independently established earlier introduction date.