Forgejo tools to edit and delete the agent's own comments #259
No reviewers
Labels
No labels
Agent
Ignore
Agent
In Progress
Agent
Planned
Agent
Planning
Agent
Ready
Agent
Triage
Compat
Breaking
Kind
Bug
Kind
Documentation
Kind
Enhancement
Kind
Feature
Kind
Security
Kind
Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
lucas/omp-deck!259
Loading…
Reference in a new issue
No description provided.
Delete branch "agent/issue-254-comment-edit-tools"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Adds the two comment-maintenance tools from #254 so the agent can correct itself on a public repository.
What
forgejo_update_comment— replaces the body of a comment the agent's own Forgejo account posted, on an issue or a pull request, plain or inline review comment.forgejo_delete_comment— deletes such a plain comment. Refuses inline review comments: Forgejo'sDELETE /issues/comments/{id}filters on the plain comment type and answers204without deleting, so an unchecked delete would report a success that never happened.Both resolve the comment first (
GET /issues/comments/{id}, falling back to the PR's review comments when that answers204) and hard-refuse anything written by someone else. Forgejo authorisesPATCH/DELETEfor the poster or any user with write access — which the deck's token has — so the ownership check has to live in the tools; it compares againstforgejo.agent_username, now carried onForgejoToolContext.Availability
forgejo_update_commentforgejo_delete_commentNo webhook loop guard needed:
classifyForgejoDeliveryalready dropsediteddeliveries whose sender is the agent (self-edited).Verification
bun test— 1630 pass, 1 fail;bun run typecheck— one error. Both are the pre-existing breakage ofmainfiled as #258 (dispatcher.tscalls the removedthis.swapLabels), reproduced on a pristine checkout ofmainbefore this branch.apps/server/src/forgejo/tools/comments.test.tscovers the pure ownership/target helpers; the policy, permission-filter, idea-mode and tool-inventory suites were extended for both tools.main, so it has noforgejo_update_commentto call. Worth doing before merge, in particular the inline-comment edit path and the204resolution behaviour on this instance's Forgejo version (the route/status claims come from v15.0.9 sources).Closes: #254
3323b680ddto532531d859