feat(opencode): Add issue-manager agent and related skill #53

Merged
martin merged 2 commits from opencode/agent/issue-manager into main 2026-11-10 19:43:04 +00:00
Owner
No description provided.
martin self-assigned this 2026-11-08 16:50:50 +00:00
martin force-pushed opencode/agent/issue-manager from 7e9cd160c9
Some checks failed
ci/woodpecker/pr/pr-review Pipeline was canceled
to 2e6b3d1043
All checks were successful
ci/woodpecker/pr/pr-review Pipeline was successful
2026-11-10 19:42:57 +00:00
Compare
martin merged commit 5068591abf into main 2026-11-10 19:43:04 +00:00
martin deleted branch opencode/agent/issue-manager 2026-11-10 19:43:04 +00:00
Member

Review Summary

This PR adds a global issue-manager agent, an /add-issue command, a forgejo-issues skill with shared conventions, and permission wiring in default.nix so coding agents get approval-gated issue writes while plan/explore stay read-only. The overall design is thoughtful: permission ordering follows OpenCode's last-match-wins rules (deny forgejo_* first, then re-allow reads), the specialist keeps label-admin tools that coding agents explicitly deny, general correctly re-denies subagents to counteract the global * ask rule, and the command/agent prose consistently treats issue content as untrusted and avoids parallel backlogs.

Findings worth addressing before merge:

  1. set_labels fallback is likely unreachable for the specialist. The skill documents a full-label-set replacement via set_labels when incremental removal fails, but issue-manager.md only allows forgejo_add_issue_labels / forgejo_remove_issue_labels. If set_labels is a separate MCP tool (common in Forgejo/Gitea APIs), the catch-all deny in the agent frontmatter blocks the exact fallback the skill prescribes.

  2. Destructive Forgejo operations are unconditionally allowed on issue-manager. Comment/attachment deletion, label deletion, and especially reset_issue_time (wipes all entries, including other users') have no tool-level ask gate. The agent body scopes this to the user's request, but the only defense against prompt injection via untrusted issue bodies is the system prompt. Consider ask for delete/reset tools.

  3. plan/explore do not regain their shipped deny posture. Global {action: "*", resource: "*", effect: "ask"} is appended after shipped agent policies and before agent-config rules, so plan's shipped "deny edits except ~/.opencode/plan" already resolves to ask for project files. readOnlyIssuePermissions was the opportunity to restore an edit deny (with a plan-file exception); without it, plan can still modify project files with one approval.

  4. Minor: execute: allow in issueSkillPermissions removes the global Code Mode ask gate for every agent that receives issue permissions, including read-only plan/explore. Nested tools remain permission-checked, so impact is limited, but confirm this is intentional.

Validation note: shell tooling was unavailable in this environment, so just fmt / nix flake check / a host build could not be run. Please run just fmt and a dry build of an OpenCode-enabled host before merging.


*🤖 Review by opencode (opencode/mimo-v2.6-flash-free) — verdict: changes

# Review Summary This PR adds a global `issue-manager` agent, an `/add-issue` command, a `forgejo-issues` skill with shared conventions, and permission wiring in `default.nix` so coding agents get approval-gated issue writes while plan/explore stay read-only. The overall design is thoughtful: permission ordering follows OpenCode's last-match-wins rules (deny `forgejo_*` first, then re-allow reads), the specialist keeps label-admin tools that coding agents explicitly deny, `general` correctly re-denies subagents to counteract the global `* ask` rule, and the command/agent prose consistently treats issue content as untrusted and avoids parallel backlogs. Findings worth addressing before merge: 1. **`set_labels` fallback is likely unreachable for the specialist.** The skill documents a full-label-set replacement via `set_labels` when incremental removal fails, but `issue-manager.md` only allows `forgejo_add_issue_labels` / `forgejo_remove_issue_labels`. If `set_labels` is a separate MCP tool (common in Forgejo/Gitea APIs), the catch-all `deny` in the agent frontmatter blocks the exact fallback the skill prescribes. 2. **Destructive Forgejo operations are unconditionally `allow`ed on `issue-manager`.** Comment/attachment deletion, label deletion, and especially `reset_issue_time` (wipes all entries, including other users') have no tool-level `ask` gate. The agent body scopes this to the user's request, but the only defense against prompt injection via untrusted issue bodies is the system prompt. Consider `ask` for delete/reset tools. 3. **`plan`/`explore` do not regain their shipped deny posture.** Global `{action: "*", resource: "*", effect: "ask"}` is appended after shipped agent policies and before agent-config rules, so plan's shipped "deny edits except `~/.opencode/plan`" already resolves to `ask` for project files. `readOnlyIssuePermissions` was the opportunity to restore an `edit` deny (with a plan-file exception); without it, plan can still modify project files with one approval. 4. **Minor:** `execute: allow` in `issueSkillPermissions` removes the global Code Mode `ask` gate for every agent that receives issue permissions, including read-only plan/explore. Nested tools remain permission-checked, so impact is limited, but confirm this is intentional. Validation note: shell tooling was unavailable in this environment, so `just fmt` / `nix flake check` / a host build could not be run. Please run `just fmt` and a dry build of an OpenCode-enabled host before merging. --- *🤖 Review by opencode (opencode/mimo-v2.6-flash-free) — verdict: **changes** <!-- forgejo-opencode-review -->
clank-bot left a comment

Code review findings from opencode.

Code review findings from opencode. <!-- forgejo-opencode-review -->
@ -0,0 +66,4 @@
- {action: forgejo_edit_org_label, resource: '*', effect: allow}
- {action: forgejo_delete_org_label, resource: '*', effect: allow}
- {action: forgejo_add_issue_labels, resource: '*', effect: allow}
- {action: forgejo_remove_issue_labels, resource: '*', effect: allow}
Member
[bug] The shared skill (SKILL.md ~line 59) tells agents to fall back to a `set_labels` full replacement when incremental removal of an inherited org label fails, but this allowlist only covers `forgejo_add_issue_labels` and `forgejo_remove_issue_labels`. If `set_labels` is a separate MCP tool (e.g. `forgejo_set_issue_labels`), the frontmatter catch-all `deny` blocks the specialist from the very fallback the skill prescribes. Verify the actual forgejo-mcp tool name and add an allow rule (or reword the skill if the operation only exists as a parameter of `forgejo_update_issue`, which is already allowed).
<!-- forgejo-opencode-review --> [bug] The shared skill (SKILL.md ~line 59) tells agents to fall back to a `set_labels` full replacement when incremental removal of an inherited org label fails, but this allowlist only covers `forgejo_add_issue_labels` and `forgejo_remove_issue_labels`. If `set_labels` is a separate MCP tool (e.g. `forgejo_set_issue_labels`), the frontmatter catch-all `deny` blocks the specialist from the very fallback the skill prescribes. Verify the actual forgejo-mcp tool name and add an allow rule (or reword the skill if the operation only exists as a parameter of `forgejo_update_issue`, which is already allowed).
@ -0,0 +89,4 @@
- {action: forgejo_list_my_tracked_times, resource: '*', effect: allow}
- {action: forgejo_add_issue_time, resource: '*', effect: allow}
- {action: forgejo_delete_issue_time_entry, resource: '*', effect: allow}
- {action: forgejo_reset_issue_time, resource: '*', effect: allow}
Member
[security] Destructive operations — `forgejo_reset_issue_time` (deletes every time entry, including other users'), `forgejo_delete_issue_comment`, `forgejo_delete_issue_attachment`, and `forgejo_delete_*_label` — are granted with `effect: allow` and no tool-level `ask` gate. The system prompt scopes them to the user's request and warns about untrusted issue bodies, but prompt injection delivered through issue/comment content the agent is instructed to read has no permission-layer backstop. Consider `effect: ask` for delete/reset tools while keeping the routine create/update/comment paths auto-allowed for bulk work.
<!-- forgejo-opencode-review --> [security] Destructive operations — `forgejo_reset_issue_time` (deletes every time entry, including other users'), `forgejo_delete_issue_comment`, `forgejo_delete_issue_attachment`, and `forgejo_delete_*_label` — are granted with `effect: allow` and no tool-level `ask` gate. The system prompt scopes them to the user's request and warns about untrusted issue bodies, but prompt injection delivered through issue/comment content the agent is instructed to read has no permission-layer backstop. Consider `effect: ask` for delete/reset tools while keeping the routine create/update/comment paths auto-allowed for bulk work.
@ -11,0 +62,4 @@
effect = "allow";
}
{
action = "execute";
Member
[security] `issueSkillPermissions` bundles `{action: "execute", resource: "*", effect: "allow"}`, so every agent that receives issue permissions (build, general, plan, explore) gets Code Mode without the global `ask` gate it would otherwise hit. Nested tools still enforce their own rules, so this is not a full bypass, but granting unconditional Code Mode to the read-only plan/explore agents deserves an explicit confirmation that it is intentional for MCP tool discovery rather than an accident of co-locating `execute` with the skill allow.
<!-- forgejo-opencode-review --> [security] `issueSkillPermissions` bundles `{action: "execute", resource: "*", effect: "allow"}`, so every agent that receives issue permissions (build, general, plan, explore) gets Code Mode without the global `ask` gate it would otherwise hit. Nested tools still enforce their own rules, so this is not a full bypass, but granting unconditional Code Mode to the read-only plan/explore agents deserves an explicit confirmation that it is intentional for MCP tool discovery rather than an accident of co-locating `execute` with the skill allow.
@ -193,1 +280,4 @@
effect = "deny";
}
];
plan.permissions = readOnlyIssuePermissions;
Member
[security] `plan.permissions = readOnlyIssuePermissions` (and `explore.permissions`) does not restore the shipped read-only edit posture. OpenCode loads base policy, then shipped agent policy, then global rules, then agent-config rules; the pre-existing global `{action: "*", resource: "*", effect: "ask"}` therefore overrides plan's shipped "deny edits except `~/.opencode/plan`" down to `ask` for arbitrary project files. Since this PR is defining the plan/explore permission set, add an `edit` deny (with an exception for `~/.opencode/plan/**`) to `readOnlyIssuePermissions` so plan cannot modify project files even with a single approval.
<!-- forgejo-opencode-review --> [security] `plan.permissions = readOnlyIssuePermissions` (and `explore.permissions`) does not restore the shipped read-only edit posture. OpenCode loads base policy, then shipped agent policy, then global rules, then agent-config rules; the pre-existing global `{action: "*", resource: "*", effect: "ask"}` therefore overrides plan's shipped "deny edits except `~/.opencode/plan`" down to `ask` for arbitrary project files. Since this PR is defining the plan/explore permission set, add an `edit` deny (with an exception for `~/.opencode/plan/**`) to `readOnlyIssuePermissions` so plan cannot modify project files even with a single approval.
Author
Owner

The review findings were addressed in #61.

  • set_labels is an update_issue field in forgejo-mcp 3.3.0, not a separate MCP tool. The skill and agent text now name update_issue with set_labels; no new permission is required.
  • The destructive delete/reset tools on issue-manager are now ask-gated.
  • plan and explore now deny edits; only plan retains the ~/.opencode/plan/** exception.
  • Code Mode now requires approval for read-only agents; build and general keep the existing allow.

Validation: just fmt, nix eval of the desktop OpenCode permissions, and a dry-run Home Manager activation passed. The full desktop build is currently blocked by an unrelated hyprland-qtutils removal.

The review findings were addressed in #61. - `set_labels` is an `update_issue` field in forgejo-mcp 3.3.0, not a separate MCP tool. The skill and agent text now name `update_issue` with `set_labels`; no new permission is required. - The destructive delete/reset tools on `issue-manager` are now `ask`-gated. - `plan` and `explore` now deny edits; only `plan` retains the `~/.opencode/plan/**` exception. - Code Mode now requires approval for read-only agents; `build` and `general` keep the existing allow. Validation: `just fmt`, `nix eval` of the desktop OpenCode permissions, and a dry-run Home Manager activation passed. The full desktop build is currently blocked by an unrelated `hyprland-qtutils` removal.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Personal/nixos-configuration!53
No description provided.