Skip to content

fix(mcp): allow negated no-edit instructions in run_task guard (#1914) - #1918

Closed
justrach wants to merge 1 commit into
mainfrom
fix/1914-run-task-no-edits
Closed

justrach wants to merge 1 commit into
mainfrom
fix/1914-run-task-no-edits

Conversation

@justrach

Copy link
Copy Markdown
Owner

Fixes #1914

Symptom

External run_task calls with read-only prompts containing phrases such as No edits. were refused before dispatch with refused detour to external MCP tool mcp__...__run_task for a local workspace edit:.

Root cause

v0.302.74.76:src/mcp_run_task_guard.zig:58 (requestsLocalEdit) matched edit keywords via bare word lookup without tracking clause-local negation.

Fix

  • Replace the bare hasWord loop in requestsLocalEdit (src/mcp_run_task_guard.zig) with a zero-allocation clause/negation token scanner that ignores negated edit keywords (e.g. No edits., Do not edit or modify, without making any file edits, no-edit) while continuing to refuse positive edit requests in the same or another clause and preserving --safe / external server boundaries.
  • Add unit regression coverage (#1914: explicit no-edit instructions are allowed while positive local edits remain guarded) covering both HTTP (server_owned_external) and --safe boundaries.

Verification

  • zig build unit -Dtest-filter="#1909" -Dtest-filter="#1914"
  • scripts/eval-tier1.sh --only fmt,lines,spec,reach,build,shell,terminal,invariants,sdk (all 3,952 declared tests compiled in, all Zig sources <= 600 LOC)
  • zig build test -j4 (all 68/68 test steps passed cleanly)

@justrach

Copy link
Copy Markdown
Owner Author

Superseded by #1916.

@justrach justrach closed this Nov 21, 2026
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