Move the service and its env file into the Gitea stack, remove the separate deploy directory and the unused /opt operator-access scripts, and keep the operational guide in OKF_Nuxt/pr-agent.md.
4.5 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. |
|
draft |
|
|
|
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
- Bot user
pr-agentis a collaborator with write permission onCV_Website/CV_Site_Nuxt. Its personal access token is scoped toread:repository,write:issueandread:user. - The repository webhook sends
push,issues,pull_requestandissue_commentevents, with JSON content type and the shared secret. - Gitea's
[webhook] ALLOWED_HOST_LISTincludesprivate:3000. Without it, Gitea's default egress policy refuses deliveries to the Docker network.
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.