Files
CV_Site_Nuxt/OKF_Nuxt/pr-agent.md
Noel Sabia 7ffc6d73b6
PR Check / Security scan (Snyk) (pull_request) Skipped
PR Check / Lint + typecheck (pull_request) Successful in 1m8s
PR Check / Secret scan (gitleaks) (pull_request) Successful in 6s
PR Check / Dependency audit (pull_request) Successful in 8s
PR Check / Dockerfile lint (droast) (pull_request) Successful in 5s
fix(ci): validate the release tag and query pending PRs by label
Both PR-Agent findings were confirmed. A tag at the merge commit now counts only when it is exactly v<manifest version>; foreign CI or annotation tags are logged and ignored. Pending release PRs are fetched through the autorelease: pending label filter instead of paging every closed PR, so a concurrent close cannot shift a page and hide one.

Also fail loudly on a merged PR without merge_commit_sha or a manifest without a version, instead of producing vundefined.

Rebased on main after the separate audit fix (e0c69c1); the dependency overrides and lockfile changes from the earlier local commit were dropped. Verified on the rebased tree: lint, typecheck, build, the exact audit command, actionlint and a live dry run.
2026-10-31 20:05:40 +01:00

5.0 KiB

type, title, description, tags, status, generated, verified, sources
type title description tags status generated verified sources
Reference PR-Agent operations The Gitea-side pull-request review service, its configuration in the Gitea compose stack, and the commands it answers.
pr-agent
gitea
operations
ci
ai
draft
by at
opencode-go/deepseek-v4.1-flash 2026-10-30T20:40:00Z
by at
human:noel not yet
id resource title
gitea-compose /home/noel/self-hosted/gitea/docker-compose.yml Gitea compose stack, pr-agent service
id resource title
install https://docs.pr-agent.ai/installation/gitea/ PR-Agent Gitea installation
id resource title
gitea-egress https://docs.gitea.com/administration/config-cheat-sheet#webhook Gitea webhook egress allowlist

What runs

PR-Agent is the pr-agent service inside the Gitea compose stack on server0. It listens on the internal gitea_gitea network at http://pr-agent:3000; no port is published. Gitea calls its signed webhook at /api/v1/gitea_webhooks, and the bot user pr-agent posts the results.

Piece Value
Service pr-agent in /home/noel/self-hosted/gitea/docker-compose.yml
Image pragent/pr-agent:0.49.0-gitea_app
Config /home/noel/self-hosted/gitea/pr-agent.env (mode 600)
Logs cd /home/noel/self-hosted/gitea && docker compose logs -f pr-agent
Restart cd /home/noel/self-hosted/gitea && docker compose up -d pr-agent
Upgrade bump the image tag in the compose file, then restart the service

The service is managed with the same access as the rest of the Gitea stack. The earlier plan for a separate /opt/pr-agent stack and a restricted agent account was not applied; those scripts were removed when the service moved into this stack. Hardening the Gitea stack's operator access is a separate change.

Gitea side

  1. Bot user pr-agent is a collaborator with write permission on CV_Website/CV_Site_Nuxt. Its personal access token is scoped to read:repository, write:issue and read:user.
  2. The repository webhook sends push, issues, pull_request and issue_comment events, with JSON content type and the shared secret.
  3. Gitea's [webhook] ALLOWED_HOST_LIST includes private:3000. Without it, Gitea's default egress policy refuses deliveries to the Docker network.

Known issue: "Failed to update PR description"

On PR #33 (2026-10-31) /describe posted Failed to update PR description before the reviewer guide. Comments work because the bot token has write:issue; editing the PR body is a repository-route write and needs write:repository as well. Add that scope to the pr-agent token and restart the service, or remove /describe from GITEA__PR_COMMANDS if the description update is not wanted. The review comment is still posted; this affects only the description sync.

Commands

Trigger What runs
PR opened or reopened /describe and /review automatically
New push to an open PR nothing; comment /review or /review -i
Comment /review, /improve, /ask that command

/review -i reviews only the commits added since the previous review. /improve stays on demand; adding it to the auto list would make a second model call and a second comment on every PR. Draft PRs are not skipped.

Configuration

pr-agent.env holds the deployment values. The repository never contains the token, webhook secret, or API key:

CONFIG__GIT_PROVIDER=gitea
GITEA__URL=http://gitea:3000
GITEA__WEB_URL=https://git.noelsabia.dev
GITEA__PERSONAL_ACCESS_TOKEN=...
GITEA__WEBHOOK_SECRET=...
CONFIG__MODEL=openai/glm-5.3-flash
CONFIG__FALLBACK_MODELS=["openai/glm-5.3"]
CONFIG__CUSTOM_MODEL_MAX_TOKENS=128000
OPENAI__API_BASE=https://opencode.ai/inference/go/openai/v1
OPENAI__KEY=...
LITELLM__EXTRA_HEADERS={"x-opencode-session":"pr-agent"}
GITEA__PR_COMMANDS=["/describe","/review"]

OpenCode Go requires the x-opencode-session header. The fallback keeps the openai/ prefix; a bare glm-5.3 is treated by LiteLLM as a provider-less model. CONFIG__CUSTOM_MODEL_MAX_TOKENS supplies the context limit; the effective review budget is capped by PR-Agent's default max_model_tokens of 32000.

The compose service:

pr-agent:
  image: pragent/pr-agent:0.49.0-gitea_app
  container_name: pr-agent
  restart: unless-stopped
  env_file:
    - ./pr-agent.env
  environment:
    PORT: "3000"
    GUNICORN_WORKERS: "2"
  mem_limit: 1g
  networks:
    - gitea
  healthcheck:
    test: ["CMD", "python", "-c", "import socket; socket.create_connection(('127.0.0.1', 3000), 3).close()"]
    interval: 30s
    timeout: 5s
    retries: 3
    start_period: 30s

Checks

A signed webhook from the Gitea container returns 200, and a direct glm-5.3-flash call returns a completion. A 403 in the Gitea webhook delivery log means the secret does not match or ALLOWED_HOST_LIST is missing; a 401 from PR-Agent means the signature and secret disagree. On a model failure, check docker compose logs pr-agent and confirm OPENAI__KEY is set in pr-agent.env.