feat: add omission placeholder detector for edit and write tools
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 ellipsisedit.ts: Compares placeholders innew_stringvsold_string— only blocks NEW placeholders not present in the originalwrite-file.ts: Blocks any content containing omission placeholders- 6 unit tests covering standalone lines, case insensitivity, multi-line, false positive avoidance
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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