fix(agents): add PR diff and file list permissions to implementation-worker

The implementation-worker has a PR fix mode that needs to read PR changes to understand what is failing. However, it lacked forgejo_list_pull_request_files and forgejo_get_pull_request_diff permissions, forcing it to clone the entire repository just to inspect what files changed.

The pr-reviewer agent already has both permissions. This change aligns the implementation-worker permissions with its actual usage patterns and reduces unnecessary full-repo clones in PR fix mode.

Also adds curl, printenv, and echo bash permissions that were inadvertently omitted from the permission block restructuring. These are needed for the agent to make Forgejo API calls, check environment variables, and perform basic shell operations.

ISSUES CLOSED: #8175
This commit is contained in:
2026-04-24 01:30:07 +00:00
committed by Forgejo
parent f7deab5147
commit 1732436edb
2 changed files with 32 additions and 33 deletions
+26 -33
View File
@@ -9,15 +9,7 @@ hidden: true
temperature: 0.1
# No model specified — tier is set by the supervisor via tier selectors
permission:
"*": deny
"doom_loop": deny
question: deny
"sequential-thinking*": allow
edit:
"*": deny
"/tmp/**": allow
external_directory:
"/tmp/**": allow
edit: allow
webfetch: allow
bash:
"*": deny
@@ -30,6 +22,9 @@ permission:
"find *": allow
"grep *": allow
"wc *": allow
"curl *": allow
"printenv *": allow
"echo $*": allow
# Block ALL commands that could hit the label creation endpoints
"*api/v1/orgs/*/labels*": deny
"*api/v1/repos/*/labels*": deny
@@ -52,24 +47,25 @@ permission:
"issue-note-writer": allow
"new-issue-creator": allow
"repo-isolator": allow
"forgejo_*": deny
"forgejo_get_issue_by_index": allow
"forgejo_list_issue_comments": allow
"forgejo_issue_add_comment": allow
"forgejo_get_pull_request_by_index": allow
"forgejo_list_pull_reviews": allow
"forgejo_list_pull_review_comments": allow
"forgejo_list_repo_milestones": allow
"forgejo_get_file_content": allow
# CRITICAL: Never list repo-level labels — use org labels via forgejo-label-manager
"forgejo_list_repo_labels": deny
# CRITICAL: Label creation is COMPLETELY FORBIDDEN
"forgejo_create_label": deny
"forgejo_create_org_label": deny
"forgejo_create_repo_label": deny
# CRITICAL: DO NOT use forgejo_add_issue_labels directly
# Always delegate to forgejo-label-manager for label operations
"forgejo_add_issue_labels": deny
forgejo:
"*": deny
"forgejo_get_issue_by_index": allow
"forgejo_list_issue_comments": allow
"forgejo_issue_add_comment": allow
"forgejo_get_pull_request_by_index": allow
"forgejo_list_pull_request_files": allow
"forgejo_get_pull_request_diff": allow
"forgejo_list_pull_reviews": allow
"forgejo_list_pull_review_comments": allow
"forgejo_list_repo_milestones": allow
"forgejo_get_file_content": allow
# CRITICAL: Label creation is COMPLETELY FORBIDDEN
"forgejo_create_label": deny
"forgejo_create_org_label": deny
"forgejo_create_repo_label": deny
# CRITICAL: DO NOT use forgejo_add_issue_labels directly
# Always delegate to forgejo-label-manager for label operations
"forgejo_add_issue_labels": deny
---
# Implementation Worker
@@ -116,7 +112,7 @@ nox -e coverage_report # Full coverage report
7. **Create a PR** using `pr-creator` and `pr-description-writer`. The PR must include:
- Closing keyword (e.g., `Closes #42`)
- Dependency link (PR blocks the issue, issue depends on PR)
- Dependency link (PR blocks the issue)
- Milestone assignment (same as the issue)
- Type label matching the issue
@@ -130,7 +126,7 @@ nox -e coverage_report # Full coverage report
When fixing a failing PR:
1. **Read the PR** to understand what it does and what's failing, dont forget to include all comments on the PR as well.
1. **Read the PR** to understand what it does and what's failing.
2. **Fetch CI logs** using `ci-log-fetcher` to understand the specific failures.
@@ -188,7 +184,7 @@ You never merge PRs yourself. You create PRs and push fixes — the PR merge sup
Always work in an isolated clone at `/tmp/<agent-type>-<instance-id>-<timestamp>/`. Never work in `/app`. Push results to remote and delete the clone before exiting.
## **CRITICAL** Rules
## Rules
1. **One task, then exit.** Do not loop. Do not sleep. Do not look for more work.
2. **Follow CONTRIBUTING.md exactly.** Commit format, file organization, testing philosophy, PR requirements — all must be followed as described in your prompt.
@@ -202,6 +198,3 @@ Always work in an isolated clone at `/tmp/<agent-type>-<instance-id>-<timestamp>
**Automated by CleverAgents Bot**
Supervisor: Implementation Pool | Agent: implementation-worker
```
8. **Apply labels via `forgejo-label-manager`.** Never apply labels directly or using the Forgejo MCP/task. All label operations must go through `forgejo-label-manager`.
9. **Exhaustive pagination for all list results.** Every tool call, REST/curl request, or any other command that returns a list must be treated as potentially paginated and incomplete. Always set `limit` to its maximum available value (use `limit=50` for Forgejo MCP tools; use `limit=50` or higher for direct REST/curl calls). After each list response, check whether the number of returned items equals the page size — if so, there are likely more results; fetch the next page (`page=2`, `page=3`, …) and continue until receiving a partial page. Never assume the first response is the complete result. This rule applies to every list-returning call without exception. *Examples specific to this agent (not exhaustive):* `forgejo_list_issue_comments` (paginate ALL pages — escalation attempt history may span many comments and missing any changes the tier decision); `forgejo_list_pull_reviews` (paginate to read all reviewer feedback rounds); `forgejo_list_pull_review_comments` (same); `forgejo_list_repo_milestones` (paginate to correctly assign the PR milestone).