Add description_edits and expected_updated_at to MCP save_work_item

What does this merge request do and why?

Currently, save_work_item requires sending the entire work item description even when an agent only needs to edit a small part (like a table row or sentence). For long descriptions, this is token-expensive and prone to clobbering concurrent human edits.

This MR:

  1. Adds description_edits to save_work_item input schema: an array of {old_str, new_str} replacements applied sequentially to the current description, requiring each old_str to match exactly once (consistent with add_commit).
  2. Adds expected_updated_at to save_work_item: an optimistic concurrency guard that refuses the update if the work item has been modified since the timestamp returned by get_work_item.
  3. Keeps description and description_edits mutually exclusive.
  4. Disallows both on create_work_item.

References

Closes #635910

How to set up and validate locally

bundle exec rspec spec/services/mcp/tools/work_items/save_work_item_service_spec.rb spec/services/mcp/tools/work_items/update_work_item_tool_spec.rb spec/services/mcp/tools/work_items/create_work_item_tool_spec.rb ee/spec/services/ee/mcp/tools/work_items/save_work_item_service_spec.rb ee/spec/lib/ai/tool_rules/governable_tools_container_spec.rb

Changelog: added

Merge request reports

Loading
Loading