QwenLM / QwenLM/qwen-code

feat: add omission placeholder detector for edit and write tools

Open
#2,575 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
28k
Forks
3.1k
Avg merge
1d 2h
Merged PRs (30d)
714

Description

What

Add a detector that identifies when the model generates lazy placeholder text like (rest of methods ...), // unchanged code ..., or (rest of code ...) in edit and write_file tool calls. Block these at validation time to prevent accidental code deletion.

Why

Models (especially under context pressure) sometimes replace actual code with shorthand placeholders. Without detection, these placeholders get written to disk, silently deleting the code they replace. This is a safety net that catches the problem before it reaches the filesystem.

Ported from Google Gemini CLI's omissionPlaceholderDetector, adapted for Qwen Code's tool validation pattern.

Implementation

  • omissionPlaceholderDetector.ts: Normalizes whitespace/comments, matches against known omission prefixes (rest of, unchanged code, etc.) with ellipsis
  • edit.ts: Compares placeholders in new_string vs old_string — only blocks NEW placeholders not present in the original
  • write-file.ts: Blocks any content containing omission placeholders
  • 6 unit tests covering standalone lines, case insensitivity, multi-line, false positive avoidance

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading omissionPlaceholderDetector.ts, then inspect how edit.ts and write-file.ts validate tool calls. Use the six unit tests described in the issue to cover standalone, case-insensitive, multiline, and false-positive cases. Done means new omission placeholders are blocked, while placeholders already present in old_string are not newly rejected.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
cli, tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.