Skip to content

fix(agent-core): refuse multi-line empty Edit deletions - #2511

Open
mangeshraut712 wants to merge 2 commits into
MoonshotAI:mainfrom
mangeshraut712:cursor/fix-edit-refuse-large-delete-7813
Open

fix(agent-core): refuse multi-line empty Edit deletions#2511
mangeshraut712 wants to merge 2 commits into
MoonshotAI:mainfrom
mangeshraut712:cursor/fix-edit-refuse-large-delete-7813

Conversation

@mangeshraut712

Copy link
Copy Markdown
Contributor

Summary

Test plan

  • pnpm exec vitest run test/tools/edit.test.ts in packages/agent-core (23 passed)
  • pnpm exec vitest run test/app/edit/tools/edit.test.ts in packages/agent-core-v2 (26 passed)

Fixes #2427

@changeset-bot

changeset-bot Bot commented Aug 1, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 744fcd0

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@moonshot-ai/agent-core Patch
@moonshot-ai/kimi-code Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 097b1774d0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/agent-core-v2/src/app/edit/editService.ts Outdated
Comment thread packages/agent-core-v2/src/app/edit/editService.ts
@pkg-pr-new

pkg-pr-new Bot commented Aug 1, 2026

Copy link
Copy Markdown
pnpm dlx https://pkg.pr.new/@moonshot-ai/kimi-code@2f08cd7
npx https://pkg.pr.new/@moonshot-ai/kimi-code@2f08cd7

commit: 2f08cd7

@cursor
cursor Bot force-pushed the cursor/fix-edit-refuse-large-delete-7813 branch from 097b177 to eb224a2 Compare August 1, 2026 18:20
@mangeshraut712

Copy link
Copy Markdown
Contributor Author

Rebased onto latest main and refreshed the agent-core-v2 inline tools_snapshot hashes for the new Edit allow_large_delete field (fixes the shard-2 snapshot mismatches).

CI is currently stuck in action_required (fork workflow re-approval after the force-push). A maintainer click on "Approve and run workflows" should unblock it — local edit + snapshot tests pass.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 380b0df96d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .changeset/edit-refuse-large-delete.md

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a17e3b9f8c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/agent-core-v2/src/agent/tools/edit/edit.ts
@cursor
cursor Bot force-pushed the cursor/fix-edit-refuse-large-delete-7813 branch from 2f08cd7 to 51cc962 Compare August 30, 2026 13:10
@mangeshraut712

Copy link
Copy Markdown
Contributor Author

Rebased onto latest main — merge conflicts are gone. CI is waiting on Approve and run workflows from a maintainer (fork PR).

@cursor
cursor Bot force-pushed the cursor/fix-edit-refuse-large-delete-7813 branch from c6652fd to 1a45ffa Compare September 2, 2026 05:34
@mangeshraut712

Copy link
Copy Markdown
Contributor Author

Rebased onto latest main. Mergeability is MERGEABLE / UNSTABLE — GitHub still needs a maintainer to approve fork-PR workflows so CI can run.

@mangeshraut712

Copy link
Copy Markdown
Contributor Author

rebase it

Guard Edit against accidental +0/−N wipeouts when new_string is empty
across 3+ lines unless allow_large_delete is set. Strengthen the
old_string-not-found recovery guidance so the model rereads a large
enough region instead of looping short Reads (fixes MoonshotAI#2427).
@cursor
cursor Bot force-pushed the cursor/fix-edit-refuse-large-delete-7813 branch from 1a45ffa to 744fcd0 Compare September 4, 2026 05:06
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.

Edit 失败后陷入死循环:反复"Edit 失败 → 重读 → 再失败",并逐步删空了被编辑文件的多个章节

1 participant