Add edit_comment action to modify_reviews for comment task state transitions#39
Open
yan-xdt wants to merge 2 commits into
Open
Add edit_comment action to modify_reviews for comment task state transitions#39yan-xdt wants to merge 2 commits into
yan-xdt wants to merge 2 commits into
Conversation
Wraps POST /api/v11/comments/{id}/edit so agents can update a comment's
body and flip its taskState (open -> addressed -> verified), which was
previously unreachable via MCP (add_comment only accepts open|comment).
- models: EDIT_COMMENT action, TaskState addressed/verified, per-action
task_state validation (add_comment still restricted to open|comment),
edit_comment requires comment_id and at least one of body/task_state
- services: edit_comment() posting only provided fields
- handlers: dispatch branch (review_id not required; the endpoint is
comment-scoped)
- tools: expose action + extended task_state literal, doc updates
Co-Authored-By: Claude Fable 5 <[email protected]>
End-to-end testing against a production Swarm (API v11) showed the server accepts any taskState transition (including open -> verified directly), so describe open -> addressed -> verified as the documented convention rather than an enforced constraint, and note the 403 on editing another user's comment. Co-Authored-By: Claude Fable 5 <[email protected]>
Author
|
Validated this end-to-end against a production Swarm (API v11) with a real review, driving all calls through the MCP tools. Results:
🤖 Generated with Claude Code |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
modify_reviewscurrently exposesadd_comment(which Swarm's create-comment endpoint restricts totaskState=open|comment) but no way to edit a comment afterwards. As a result, the task workflow statesaddressedandverifiedare unreachable through the MCP server, even though the Swarm REST API supports them viaPOST /api/v11/comments/{id}/edit. Agent-driven review flows (author fixes a task -> reviewer verifies it) currently have to fall back to calling the Swarm API directly.Changes
EDIT_COMMENTaction;TaskStateextended withaddressed/verified; validation keepsadd_commentrestricted toopen|comment(matching the create-comment endpoint), andedit_commentrequirescomment_idplus at least one ofbody/task_state.review_idis not required foredit_commentsince the endpoint is comment-scoped.edit_comment()wrappingPOST /api/v11/comments/{id}/edit, sending only the fields provided (body,taskState,notify), following the same auth/response handling as the existing comment methods.edit_comment.edit_commentadded to themodify_reviewsaction literal;task_stateliteral extended, with descriptions noting Swarm's constraints (only the comment author may edit;open->verifiedrequires an intermediateaddressedstep).Notes
task_statevalidation onadd_comment, which now fails fast instead of letting Swarm reject the request.python -m py_compile; the change mirrors the existingadd_review_comment/mark_comment_as_readimplementation patterns.🤖 Generated with Claude Code