OpenCode Go rejects requests without x-opencode-session, and LiteLLM needs the openai/ prefix on the fallback model. Supply the header through LITELLM__EXTRA_HEADERS, keep the prefixed fallback, and stop auto-running /improve so a PR gets one review plus /describe.
5.1 KiB
type, title, description, tags, status, generated, verified, sources
| type | title | description | tags | status | generated | verified | sources | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Decision | PR-Agent for Gitea reviews | A pinned PR-Agent webhook server on server0 reviews pull requests through a scoped Gitea bot user, replacing the per-PR opencode job. |
|
draft |
|
|
|
Decision
PR-Agent runs as pragent/pr-agent:0.49.0-gitea_app in a long-lived
container on server0, attached to the existing gitea_gitea Docker
network. It publishes no ports. Gitea delivers pull-request and comment
events to http://pr-agent:3000/api/v1/gitea_webhooks; the bot user
pr-agent posts the result with a scoped personal access token.
The opencode review job is removed from pr-checker.yml. PR-Agent runs
/describe and /review on pull request open/reopen and answers slash
commands in the conversation. Push-triggered re-review is disabled, so a
PR is reviewed once when it opens, not on every push.
The model is OpenCode Go's OpenAI-compatible endpoint:
model openai/glm-5.3-flash
fallback openai/glm-5.3
api base https://opencode.ai/inference/go/openai/v1
CONFIG__CUSTOM_MODEL_MAX_TOKENS=128000 supplies the context limit the
model table does not know; PR-Agent's default config.max_model_tokens
still caps the review budget at 32000.
OpenCode Go requires an x-opencode-session header. PR-Agent sends the
stable id pr-agent through LITELLM__EXTRA_HEADERS; without it the
provider rejects the request before it reaches the model.
Why
- One container replaces a per-PR CLI install, binary cache and prompt wrapper. The review path is then the same code for every PR.
- PR-Agent owns the Gitea webhook and comment plumbing, including the slash
commands (
/review,/improve,/ask) the repository previously had no way to trigger. - The webhook endpoint stays on the Docker network. Nothing new is exposed to the internet, and comment links still use the public Gitea URL.
- The image tag is pinned. A new PR-Agent release is a deliberate change, not a rollout underneath the repository.
Gitea configuration
- Bot user
pr-agentis a collaborator with write permission onCV_Website/CV_Site_Nuxt. The token scopes areread:repository,write:issueandread:user. Gitea has no comment-only collaborator role, so write is the narrowest role that can post comments and labels. [webhook] ALLOWED_HOST_LIST = private:3000is required: Gitea's default lax egress policy allows public targets but refuses private ones, and the webhook target is a Docker-network address. The API is reached athttp://gitea:3000;GITEA__WEB_URL=https://git.noelsabia.devkeeps published links on the public host.- The webhook sends
push,issues,pull_requestandissue_commentevents. Only the last two change behaviour today;pushis kept because PR-Agent may handle push commands in a later configuration. - Auto commands are
/describeand/review./improvestays available on demand; the default auto list would add a second model call and a second comment to every PR. - Secrets live only in
/home/noel/self-hosted/pr-agent/.env(mode 600) onserver0. The repository contains the compose file and an example env file, never the token or webhook secret.
Not verified
- The OpenCode Go API key was not present when this was committed, so no model call has completed. A dummy-key call now reaches the provider's authentication check instead of failing on the missing session header, so the remaining blocker is the credential. The first PR after the key is set is the real verification.
- Whether
glm-5.3-flashhandles PR-Agent's structured review output well enough.glm-5.3is configured as the fallback. - Whether two gunicorn workers and the 1 GB memory limit hold under concurrent reviews. The host has roughly 2.5 GB available with Gitea and its runner idle.
- Whether the default review prompt is specific enough for this repository.
A
.pr_agent.tomlwith project instructions is deliberately absent until the first real review shows what it misses.
Revisit when
- The first review fails, returns unstructured output, or misses the kind of finding the opencode prompt used to catch.
- A newer
gitea_appimage tag is worth taking; bump the tag and rundocker compose up -d. - Review volume makes the container's memory limit tight, or Gitea adds a role that can comment without push access.