Skip to content

fix: bound diff_edit result context - #798

Merged
will-lamerton merged 1 commit into
Nano-Collective:mainfrom
RealBhupesh:codex/issue-795-diff-edit-preview
Aug 9, 2026
Merged

fix: bound diff_edit result context#798
will-lamerton merged 1 commit into
Nano-Collective:mainfrom
RealBhupesh:codex/issue-795-diff-edit-preview

Conversation

@RealBhupesh

Copy link
Copy Markdown
Contributor

Summary

  • replace diff_edit's full-file response with three lines of context around each changed region
  • merge nearby context windows and report accurate omitted-line ranges
  • cap unusually large previews at 4,000 characters while retaining a summary of every changed region
  • add regression coverage for large files, separated and out-of-order blocks, and oversized multi-block edits

Why

diff_edit returned the entire modified file after a successful edit. On large files this duplicated content already present in the conversation, consumed unnecessary context, and increased latency. The tool now returns only the information needed to verify the edit and directs the model to read_file with a narrow range when more context is needed.

Closes #795

Validation

  • pnpm exec ava source/tools/file-ops/diff-edit.spec.tsx (19 tests passed)
  • pnpm run test:all (6,258 tests passed, 1 skipped)
  • Type checking, lint, formatting, Knip, and dependency audit passed as part of the full suite
  • pnpm exec changeset status
  • git diff --check

Note: Semgrep was not installed locally, so the repository's optional Semgrep step was skipped by its test script.

@will-lamerton
will-lamerton merged commit 689f4d9 into Nano-Collective:main Aug 9, 2026
10 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] diff_edit echoes back the entire file the model just edited

2 participants