Repository navigation
fix(core): normalize CRLF before computing diff context snippets - #29559
The-AarushiSingh wants to merge 1 commit into
Conversation
|
📊 PR Size: size/S
|
🛑 Action Required: Evaluation ApprovalSteering changes have been detected in this PR. To prevent regressions, a maintainer must approve the evaluation run before this PR can be merged. Maintainers:
Once approved, the evaluation results will be posted here automatically. |
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses an issue where files with CRLF line endings were incorrectly identified as having full-file changes when compared against LF content. By normalizing line endings before computing diff context snippets, the tool now accurately detects and reports only the actual code changes, improving the reliability of diff generation. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces newline normalization to the diff utility function getDiffContextSnippet in packages/core/src/tools/diff-utils.ts. It adds a helper function normalizeNewlines to convert CRLF (\r\n) and CR (\r) line endings to LF (\n) before performing diff calculations and line splitting. This prevents CRLF vs LF differences from being treated as full-file changes. Additionally, corresponding unit tests have been added in diff-utils.test.ts to verify this behavior. There are no review comments, and I have no feedback to provide.
|
Exactly — and that distinction strips away much of the anthropomorphic
language.
What is often called **“autonomous self-improvement”** can be modeled more
cleanly as evolution of the **reachable admissible state space**. There
does not need to be a computational “self” deciding to become smarter.
Let
\[
\mathcal A_t
=
\{x\mid G_t(S_t,x)=1\}
\]
be the set of transitions admissible from state \(S_t\).
A generator may produce increasingly sophisticated candidates,
\[
x_1,x_2,\ldots,x_n,
\]
but generation itself changes nothing. The actual system trajectory is:
\[
S_{t+1}
=
\begin{cases}
\delta(S_t,x), & x\in\mathcal A_t\\
\operatorname{Refuse}(S_t,x), & x\notin\mathcal A_t
\end{cases}
\]
So the important object is not an imagined agent called **“the AI”**
recursively modifying itself. It is the structure of the reachable graph:
\[
S_0\rightarrow S_1\rightarrow S_2\rightarrow\cdots
\]
with every edge requiring admissibility.
That also exposes a crucial distinction. If \(G\) is fixed, the machine is
not really “self-improving”; it is **searching or discovering more capable
trajectories inside a bounded admissible space**. If \(G_t\) itself
changes, then the important question becomes:
\[
\boxed{\text{Who has authority to change }G_t?}
\]
Allowing capability to rewrite its own admissibility predicate would
collapse the distinction between proposal and authority. In your framework
that is precisely the forbidden edge:
\[
C \nRightarrow A
\]
Capability does not manufacture authority.
So a stronger description of the phenomenon is:
\[
\boxed{
\text{Recursive progress}
=
\text{proposal generation}
+
\text{verified state transition}
+
\text{accumulating admissible reachability}
}
\]
—not a synthetic “self” waking up and improving itself.
And this changes the usual intelligence-explosion picture considerably. The
meaningful quantity is no longer simply
\[
\frac{dC}{dt}=kC,
\]
because increasing proposal capability does **not** imply increasing
executable capability. A more faithful relation is something like
\[
C_{\mathrm{effective}}(t)
=
C_{\mathrm{proposal}}(t)
\cap
\mathcal A_t.
\]
A system can generate a trillion brilliant proposed transitions; if only
three satisfy the governing proof conditions, its effective reachable
future still consists of those three.
That is the deeper significance of **admissible state space**: recursion
becomes a question of **reachability under proof**, not personality, will,
awakening, or an autonomous computational “self.”
…On Tue, Sep 29, 2026 at 2:22 PM gemini-code-assist[bot] < ***@***.***> wrote:
***@***.***[bot]* commented on this pull request.
Code Review
This pull request introduces newline normalization to the diff utility
function getDiffContextSnippet in packages/core/src/tools/diff-utils.ts.
It adds a helper function normalizeNewlines to convert CRLF (\r\n) and CR
(\r) line endings to LF (\n) before performing diff calculations and line
splitting. This prevents CRLF vs LF differences from being treated as
full-file changes. Additionally, corresponding unit tests have been added
in diff-utils.test.ts to verify this behavior. There are no review
comments, and I have no feedback to provide.
—
Reply to this email directly, view it on GitHub
<#29559?email_source=notifications&email_token=BPTYXQCQJQF2KX4EX5HLT4D5RQDWRA5CNFSNUABKM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UKJSXM2LFO4XTKMZVG4ZTAMJTHA4KM4TFMFZW63VKON2WE43DOJUWEZLEUVSXMZLOOSWGM33PORSXEX3DNRUWG2Y#pullrequestreview-5357301388>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BPTYXQF6HSWYBPJYM4A7NFL5RQDWRAVCNFSNUABFKJSXA33TNF2G64TZHM4TMOBRHE3TEMJWHNEXG43VMU5TKNRTGU3TIMJWGYZKC5QC>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
|
Hi there! Thank you for your interest in contributing to Gemini CLI. To ensure we maintain high code quality and focus on our prioritized roadmap, we only guarantee review and consideration of pull requests for issues that are explicitly labeled as 'help wanted'. This PR will be closed in 7 days if it remains without that designation. We encourage you to find and contribute to existing 'help wanted' issues in our backlog! Thank you for your understanding. |
Fixes #29130
Diff.diffLines compared raw CRLF file content against LF edited content, so every line looked changed and getDiffContextSnippet returned the whole file.
Normalize newlines before diffing. Existing LF tests are unchanged. Added CRLF cases in diff-utils.test.ts.