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
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.
134 lines
5.0 KiB
Markdown
134 lines
5.0 KiB
Markdown
---
|
|
type: Reference
|
|
title: PR-Agent operations
|
|
description: The Gitea-side pull-request review service, its configuration in the Gitea compose stack, and the commands it answers.
|
|
tags: [pr-agent, gitea, operations, ci, ai]
|
|
status: draft
|
|
generated: { by: opencode-go/deepseek-v4.1-flash, at: 2026-10-30T20:40:00Z }
|
|
verified: { by: human:noel, at: not yet }
|
|
sources:
|
|
- id: gitea-compose
|
|
resource: /home/noel/self-hosted/gitea/docker-compose.yml
|
|
title: Gitea compose stack, pr-agent service
|
|
- id: install
|
|
resource: https://docs.pr-agent.ai/installation/gitea/
|
|
title: PR-Agent Gitea installation
|
|
- id: gitea-egress
|
|
resource: https://docs.gitea.com/administration/config-cheat-sheet#webhook
|
|
title: 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:
|
|
|
|
```ini
|
|
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:
|
|
|
|
```yaml
|
|
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`.
|