Skip to content

Patched files have mixed line endings on Windows #1

@ctkm-aelf

Description

@ctkm-aelf

Auto-mirrored from upstream for the consensus-loop backlog. Do not edit the section below by hand.

Upstream: openai#4003
Area / crate: codex-apply-patch (codex-rs/apply-patch)
Why selected: high impact (51 👍), deterministic, single-crate, unit-testable without Windows.

Acceptance criteria

  • Patch application must preserve each file's existing newline style: LF-only files stay LF, CRLF files stay CRLF.
  • Add unit tests in codex-apply-patch that apply a patch to CRLF content and assert CRLF is preserved, plus an LF control case.
  • No changes outside codex-rs/apply-patch unless strictly required.

Original upstream report (openai#4003)

When codex makes changes to files, it does not adhere to the line endings in the file but appears to always use Unix-style LF. On Windows with files using CRLF, this leads to inconsistent line endings in the file. When opening these files in Visual Studio, for example, VS warns about this fact and asks whether line endings should be normalized.

Expected behavior: codex should use LF line endings if the file already uses LF, and CRLF endings if the file already uses CRLF.

Repro platform: Windows NT 10.0.26120 x64, Codex 0.39.0.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcrnd:human:autoController may continue without maintainer intervention.crnd:lifecycle:managedItem is managed by consensus-loop.crnd:phase:implementingImplementation worker is active.upstream-backlogMirrored from openai/codex for the consensus-loop backlog

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions