Guard coverage: classify create_agent_task as read-write and blocked#3139
Guard coverage: classify create_agent_task as read-write and blocked#3139
create_agent_task as read-write and blocked#3139Conversation
…pported) Agent-Logs-Url: https://github.com/github/gh-aw-mcpg/sessions/375134d9-0241-4dd0-bd71-841099bfb1d7 Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
create_agent_task as read-write and blocked
There was a problem hiding this comment.
Pull request overview
Adds guard coverage for gh agent-task create by classifying create_agent_task as a read-write operation and unconditionally blocking it, while ensuring repo-visibility secrecy is applied during labeling.
Changes:
- Classify
create_agent_taskas"read-write"and add it to the unconditional blocklist. - Apply repo-visibility secrecy for
create_agent_taskin tool label rules. - Add a unit test asserting
create_agent_taskis read-write and blocked.
Show a summary per file
| File | Description |
|---|---|
| guards/github-guard/rust-guard/src/tools.rs | Adds create_agent_task classification (read-write + blocked) and a unit test for the classification/blocking. |
| guards/github-guard/rust-guard/src/labels/tool_rules.rs | Adds labeling rule to apply repo-visibility secrecy for create_agent_task prior to blocked integrity override in label_resource. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 2/2 changed files
- Comments generated: 3
| "issue_write", | ||
| "sub_issue_write", | ||
| "update_gist", | ||
| // Pre-emptive entries for anticipated future MCP tools (no equivalent tool today) |
There was a problem hiding this comment.
The comment says these are “pre-emptive entries … (no equivalent tool today)”, but create_agent_task is an actual supported tool name being classified/blocked in this PR. Please reword this header comment so it doesn’t imply the tool doesn’t exist (it’s misleading for future readers reviewing guard coverage).
| // Pre-emptive entries for anticipated future MCP tools (no equivalent tool today) | |
| // Additional guarded read-write operations, including supported tool mappings that remain blocked |
| !is_write_operation("create_agent_task"), | ||
| "create_agent_task should not be in WRITE_OPERATIONS (it is in READ_WRITE_OPERATIONS)" |
There was a problem hiding this comment.
The test asserts !is_write_operation("create_agent_task"), which bakes in the current implementation detail that read-write ops are excluded from is_write_operation. Since is_write_operation is only used as part of operation classification (and could reasonably be broadened to include read-write ops in the future), consider removing this assertion or instead asserting that the labeled operation is "read-write" / that it’s not explicitly listed in WRITE_OPERATIONS.
| !is_write_operation("create_agent_task"), | |
| "create_agent_task should not be in WRITE_OPERATIONS (it is in READ_WRITE_OPERATIONS)" | |
| !WRITE_OPERATIONS.contains(&"create_agent_task"), | |
| "create_agent_task should not be explicitly listed in WRITE_OPERATIONS (it is in READ_WRITE_OPERATIONS)" |
| // === Copilot coding-agent task (blocked: unsupported agent operation) === | ||
| "create_agent_task" => { | ||
| // Creates a Copilot coding-agent job that modifies repo branches and opens a PR. | ||
| // Blocked via is_blocked_tool(); secrecy applied so the resource is correctly | ||
| // classified before the integrity override in label_resource. | ||
| // S = S(repo); I = blocked (override applied in label_resource) | ||
| secrecy = apply_repo_visibility_secrecy(&owner, &repo, repo_id, secrecy, ctx); | ||
| } |
There was a problem hiding this comment.
apply_tool_labels now has a dedicated create_agent_task arm to apply repo-visibility secrecy, but there’s no unit test exercising this new labeling behavior. Please add a test (similar to test_apply_tool_labels_transfer_repository_secrecy_inherits_repo_visibility in labels/mod.rs) to ensure the create_agent_task arm is hit and continues to apply repo-visibility secrecy as intended.
gh agent-task create(POST copilot-api/agents/swe/v1/jobs/{owner}/{repo}) had no guard entry despite causing real repo mutations (branch creation + PR). Per agent instructions, this operation is read-write (reads task context, writes branch/PR) and unsupported (unconditionally blocked).tools.rs"create_agent_task"toREAD_WRITE_OPERATIONS— operation is classified as"read-write"inlabel_resource"create_agent_task"tois_blocked_tool()— DIFC evaluator always denies it viablocked_integrityoverride, consistent withtransfer_repository,archive_repository, etc.labels/tool_rules.rscreate_agent_taskapplying repo-visibility secrecy before theblocked_integrityoverride kicks in atlabel_resourceWarning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
example.com/tmp/go-build2534278610/b340/launcher.test /tmp/go-build2534278610/b340/launcher.test -test.testlogfile=/tmp/go-build2534278610/b340/testlog.txt -test.paniconexit0 -test.timeout=10m0s /tmp/go-build2534278610/b223/vet.cfg flib/difflib.go 64/src/runtime/cgo x_amd64/compile(dns block)invalid-host-that-does-not-exist-12345.com/tmp/go-build2534278610/b322/config.test /tmp/go-build2534278610/b322/config.test -test.testlogfile=/tmp/go-build2534278610/b322/testlog.txt -test.paniconexit0 -test.timeout=10m0s rev-�� ternal/engine/wazevo/backend/isa/amd64/abi_entry_amd64.s(dns block)nonexistent.local/tmp/go-build2534278610/b340/launcher.test /tmp/go-build2534278610/b340/launcher.test -test.testlogfile=/tmp/go-build2534278610/b340/testlog.txt -test.paniconexit0 -test.timeout=10m0s /tmp/go-build2534278610/b223/vet.cfg flib/difflib.go 64/src/runtime/cgo x_amd64/compile(dns block)slow.example.com/tmp/go-build2534278610/b340/launcher.test /tmp/go-build2534278610/b340/launcher.test -test.testlogfile=/tmp/go-build2534278610/b340/testlog.txt -test.paniconexit0 -test.timeout=10m0s /tmp/go-build2534278610/b223/vet.cfg flib/difflib.go 64/src/runtime/cgo x_amd64/compile(dns block)this-host-does-not-exist-12345.com/tmp/go-build2534278610/b349/mcp.test /tmp/go-build2534278610/b349/mcp.test -test.testlogfile=/tmp/go-build2534278610/b349/testlog.txt -test.paniconexit0 -test.timeout=10m0s go_.�� @v1.1.3/ascii/eq-errorsas @v1.1.3/ascii/va-ifaceassert x_amd64/vet -I /tmp/go-build132/usr/bin/runc -I x_amd64/vet -I g_.a 0098554/b151/ x_amd64/vet -o /dev/null(dns block)If you need me to access, download, or install something from one of these locations, you can either: