Skip to content

fix(mcp): allow negated edit clauses in external run_task guard (#1914) - #1917

Closed
justrach wants to merge 1 commit into
mainfrom
fix/run-task-guard-negation
Closed

justrach wants to merge 1 commit into
mainfrom
fix/run-task-guard-negation

Conversation

@justrach

Copy link
Copy Markdown
Owner

Fixes #1914

Summary

  • Replace the flat whole-word hasWord scan in requestsLocalEdit (src/mcp_run_task_guard.zig) with a pure clause-aware word scanner that tracks negation words (no, not, never, without, avoid, don't/don’t, doesn't, won't, cannot/can't, mustn't, shouldn't, zero, neither, nor, non, skip, forbid, prohibit) and resets negation at sentence boundaries (., !, ?, ;, newlines — without tripping on filenames like README.md) and contrast/directive conjunctions (but, however, instead, except, yet, please, only).
  • Explicit read-only prompts such as "No edits." or "Do not edit or modify any files." are no longer falsely rejected as local workspace edits, while positive edit requests and mixed clauses (e.g. "No edits to README.md, but update src/main.zig.") remain blocked and server --safe boundaries stay intact.

Tests

  • Added #1914: negated edit instructions are allowed for read-only external run_task while positive edits stay blocked in src/mcp_run_task_guard.zig — fails on main, passes with this fix.
  • Ran zig build unit (full unit suite), zig fmt --check, scripts/check-zig-lines.sh, and scripts/eval-tier1.sh (fmt, lines, spec, reach, build, shell, terminal, invariants, sdk).

@justrach

Copy link
Copy Markdown
Owner Author

Superseded by #1916 (already merged and released in v0.302.74.78).

@justrach justrach closed this Nov 20, 2026
@justrach
justrach deleted the fix/run-task-guard-negation branch November 20, 2026 18:53
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.

External run_task rejects read-only prompts that say “No edits”

1 participant