Loading
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:
- Adds
description_editstosave_work_iteminput schema: an array of{old_str, new_str}replacements applied sequentially to the current description, requiring eachold_strto match exactly once (consistent withadd_commit). - Adds
expected_updated_attosave_work_item: an optimistic concurrency guard that refuses the update if the work item has been modified since the timestamp returned byget_work_item. - Keeps
descriptionanddescription_editsmutually exclusive. - 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.rbChangelog: added