You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* feat: add comment-on-work-item safe output tool
Add a new safe output tool that allows agents to comment on existing
Azure DevOps work items. This is the ADO equivalent of gh-aw's
add-comment tool.
Features:
- Agent provides work_item_id and body (markdown comment text)
- Required 'target' field in frontmatter scopes which work items
can be commented on: wildcard, specific ID(s), or area path prefix
- max field (default: 1) limits comments per run
- Area path targets validated via ADO API at Stage 2
- Compile-time validation ensures target is specified
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* refactor: remove redundant area: prefix from comment-on-work-item target field
The target field type system already disambiguates naturally:
- number → single work item ID
- array of numbers → list of IDs
- "*" → wildcard
- any other string → area path prefix
The area: prefix was unnecessary since no other string variant
could collide with area paths.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* fix: close access-control bypass and enforce max for comment-on-work-item
Three fixes for comment-on-work-item:
1. Silent access-control bypass: the None arm in execute_impl now
uses expect() instead of if-let on area_path_prefix(), making
any mismatch between allows_id and area_path_prefix a hard
panic rather than a silent pass-through.
2. max never enforced: Stage 1 (mcp.rs) no longer hardcodes max=1
via write_safe_output_file_with_maximum — it uses the unbounded
write_safe_output_file, matching update-work-item. Stage 2
(execute.rs) now enforces the configured max with the same
skip-and-continue pattern used by update-work-item.
3. Default config is wildcard: target is now Option<CommentTarget>
(default None). If tool_configs is missing or malformed at
runtime, execute_impl fails explicitly instead of silently
granting unrestricted access.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* fix: propagate write errors and harden comment-on-work-item
- update_work_item MCP handler: propagate write_safe_output_file
errors instead of silently discarding them with let _ =
- update_work_item MCP handler: remove redundant pre-sanitization;
the Sanitize trait impl handles this in Stage 2 via
execute_sanitized, matching the pattern other tools follow
- comment-on-work-item: use case-insensitive area path prefix
matching since ADO area paths are case-insensitive
- Add integration tests for comment-on-work-item compile-time
validation: requires target field, requires write SC, and
succeeds with both
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* fix: harden area path matching and improve code clarity
- Replace expect() with unreachable!() for the impossible branch
where allows_id returns None but area_path_prefix is also None
- Require path separator boundary in area path prefix matching so
prefix "4x4" does not accidentally match "4x4Production"
- Add comments explaining why max budget is consumed before
execution (prevents unbounded retries against failing endpoints)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* fix: restore Stage 1 sanitization for update-work-item and add fixture test
- Restore defense-in-depth sanitization in the update-work-item MCP
handler via result.sanitize_fields() before persisting to NDJSON,
using the Sanitize trait impl rather than field-by-field calls
- Add comment-on-work-item fixture (tests/fixtures/) and integration
test verifying compiled pipeline output includes the tool reference,
safeoutputs MCP, write SC, and has no unreplaced template markers
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* fix: require explicit target for update-work-item and fix Unicode boundary check
- update-work-item target is now Option<TargetConfig> (default None),
matching the comment-on-work-item pattern. Omitting target no longer
silently defaults to "*" (unrestricted). Both compile-time and
runtime validation reject missing target explicitly.
- Add validate_update_work_item_target compile-time check in both
standalone and 1ES compilers.
- Fix area path boundary check to use str slicing (ap[pf.len()..])
instead of byte indexing, which is sound because starts_with
guarantees pf.len() is a valid char boundary in ap.
- Add integration test for update-work-item missing target.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy file name to clipboardExpand all lines: AGENTS.md
+26Lines changed: 26 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -39,6 +39,7 @@ Alongside the correctly generated pipeline yaml, an agent file is generated from
39
39
│ ├── sanitize.rs # Input sanitization for safe outputs
40
40
│ └── tools/ # MCP tool implementations
41
41
│ ├── mod.rs
42
+
│ ├── comment_on_work_item.rs
42
43
│ ├── create_pr.rs
43
44
│ ├── create_wiki_page.rs
44
45
│ ├── create_work_item.rs
@@ -760,6 +761,31 @@ Safe output configurations are passed to Stage 2 execution and used when process
760
761
761
762
### Available Safe Output Tools
762
763
764
+
#### comment-on-work-item
765
+
Adds a comment to an existing Azure DevOps work item. This is the ADO equivalent of gh-aw's `add-comment` tool.
766
+
767
+
**Agent parameters:**
768
+
- `work_item_id`- The work item ID to comment on (required, must be positive)
769
+
- `body`- Comment text in markdown format (required, must be at least 10 characters)
770
+
771
+
**Configuration options (front matter):**
772
+
- `max` - Maximum number of comments per run (default: 1)
773
+
- `target` - **Required** — scoping policy for which work items can be commented on:
774
+
- `"*"`- Any work item in the project (unrestricted, must be explicit)
775
+
- `12345`- A specific work item ID
776
+
- `[12345, 67890]`- A list of allowed work item IDs
777
+
- `"Some\\Path"`- Work items under the specified area path prefix (any string that isn't `"*"`, validated via ADO API at Stage 2)
778
+
779
+
**Example configuration:**
780
+
```yaml
781
+
safe-outputs:
782
+
comment-on-work-item:
783
+
max: 3
784
+
target: "4x4\\QED"
785
+
```
786
+
787
+
**Note:** The `target` field is required. If omitted, compilation fails with an error. This ensures operators are intentional about which work items agents can comment on.
0 commit comments