Codumentor logo Codumentor

Gitea PR Plugin

Gives the agent per-user Gitea pull-request tools — read PR details, diffs, and comments in chat, and (behind approval) post review comments and submit reviews on Gitea. Like Redmine, it authenticates as the calling user: each tool reads the user's personal Gitea access token from User Secrets at call time. There is no shared instance token.

Load user_secrets alongside this plugin.

Tools

ToolApprovalPurpose
gitea_list_prsnone (read)List open/recent PRs for a repo.
gitea_get_prnone (read)Fetch one PR's details (title, body, state, author).
gitea_get_pr_diffnone (read)Get the unified diff (truncated past max_pr_diff_bytes).
gitea_get_pr_filesnone (read)List changed files with patch hunks — the preferred entry point for large PRs.
gitea_get_pr_commitsnone (read)List commits in the PR.
gitea_get_pr_commentsnone (read)Read existing discussion comments.
gitea_post_pr_commentgitea.post_pr_commentPost a general (thread-level) PR comment.
gitea_post_line_commentgitea.post_line_commentPost a line-level review comment on a specific file/line.
gitea_submit_reviewgitea.submit_reviewSubmit an overall review verdict (comment / approve / request changes).

Write tools ask for approval before a comment or verdict lands on Gitea.

Who gets which half

Two gates, not one. target_agents (default all) decides whether the family is offered at all; write_target_agents (default main) then decides who gets the three write tools.

By default a subagent can fetch a PR and its diff but cannot comment or submit a verdict. Set write_target_agents: all if subagents should also write.

Ask the assistant to ground claims in actual diff lines (gitea_get_pr_diff / gitea_get_pr_files) and to cross-reference the ingested codebase.

Two review triggers

A posted-comment ledger tracks findings already posted on a PR so a re-review (for example after a later push) does not repeat comments.

Configuration

plugins:
  - module: codumentor.plugins.gitea_pr
    class: GiteaPRPlugin
    args:
      enabled: true
      base_url: "https://gitea.example.com"   # optional; falls back to config.auth.gitea.base_url
      api_token_secret: gitea_api_token       # per-user secret name (default)
      default_repo: "owner/repo"              # optional; lets "PR #42" resolve
      target_agents: all                      # main | subagent | all — the whole family
      write_target_agents: main               # same values, write tools only
      # Headless /review webhook — off by default
      auto_post_on_review_comment: false
      review_owner_user_id: "gitea-bot"       # service account for headless turns
      # auto_runnable_write_tools defaults to the two comment tools

base_url is required only when enabled: true and neither args.base_url nor config.auth.gitea.base_url is set.

Parameters

OptionTypeDefaultDescription
base_urlstringconfig.auth.gitea.base_urlBase URL of the Gitea instance.
api_token_secretstringgitea_api_tokenPer-user secret name holding the personal access token.
default_repostring(none)owner/repo used when a call omits the repository.
max_pr_diff_bytesint400000Truncate diffs larger than this.
request_timeout_sfloat30.0Per-request timeout in seconds.
target_agentsstringallmain \
write_target_agentsstringmainSame values, applied to the write tools only. Subagents keep the read half.
auto_post_on_review_commentboolfalseSpawn a headless turn from a /review webhook comment (and from PR opened / reopened / synchronize events).
auto_runnable_write_toolslist[string][gitea_post_line_comment, gitea_post_pr_comment]The only write tools a headless review may auto-run.
review_owner_user_idstring(none)Codumentor user id the headless turn runs as. Required when auto_post_on_review_comment is true.

Enabling the webhook also requires the shared webhooks: block (the same HMAC secret store the push webhook uses):

webhooks:
  enabled: true
  secrets:
    - "${CODUMENTOR_WEBHOOK_SECRET}"

Point Gitea at POST {api.external_url}/ops/webhook/gitea-pr with that secret. The endpoint authenticates every event even when auto_post_on_review_comment is off, so you can enable headless review later without reconfiguring Gitea.

Per-user setup

Each user adds their personal Gitea access token as a secret:

  1. In Gitea: Settings → Applications → Generate New Token (read repository scope for PR reads; add write issue/PR scope to post comments).
  2. In Codumentor: Settings → Extensions → User Secrets → Add, name it gitea_api_token (or whatever api_token_secret is set to), paste the token.

The User Secrets pane shows "Gitea API token — needed by Gitea PR" with set/unset state. When a tool runs without the secret set, it returns a clear, non-retryable message telling the user to add it — no network call is made.

Notes