Merge remote-tracking branch 'origin/main' into feat/docs_registrys
PR Check / Security scan (Snyk) (pull_request) Skipped
PR Check / Lint + typecheck (pull_request) Successful in 1m6s
PR Check / Secret scan (gitleaks) (pull_request) Successful in 6s
PR Check / Dependency audit (pull_request) Failing after 8s
PR Check / Dockerfile lint (droast) (pull_request) Successful in 5s
PR Check / Security scan (Snyk) (pull_request) Skipped
PR Check / Lint + typecheck (pull_request) Successful in 1m6s
PR Check / Secret scan (gitleaks) (pull_request) Successful in 6s
PR Check / Dependency audit (pull_request) Failing after 8s
PR Check / Dockerfile lint (droast) (pull_request) Successful in 5s
# Conflicts: # OKF_Nuxt/log.md
This commit is contained in:
commit
c00db55f98
12 files changed
+388
-255
No files matched your search
@@ -3,7 +3,7 @@ type: Decision
|
||||
title: AI code review setup
|
||||
description: The review job runs opencode with a cheap medium-effort opencode-go model, env-only auth, a read-only permission set, and posts only reviews that end with a verdict line.
|
||||
tags: [decision, ci, ai, opencode, security]
|
||||
status: draft
|
||||
status: deprecated
|
||||
generated: { by: opencode-go/glm-5.3-flash, at: 2026-10-18T16:05:00Z }
|
||||
verified: { by: human:noel, at: not yet }
|
||||
sources:
|
||||
@@ -15,6 +15,10 @@ sources:
|
||||
title: OpenCode Go plan documentation
|
||||
---
|
||||
|
||||
> Superseded by [PR-Agent for Gitea reviews](pr-agent.md) on 2026-10-30.
|
||||
> The opencode job was removed from `pr-checker.yml`; this document remains
|
||||
> as the record of the earlier setup and the failures it fixed.
|
||||
|
||||
# Decision
|
||||
|
||||
The review job installs opencode v2 from the dedicated v2 installer,
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
# Decisions
|
||||
|
||||
* [PR pipeline layering](pr-pipeline-layering.md) - What runs pre-commit, what runs in Gitea Actions, what the AI review does, and the cost rule that decides.
|
||||
* [AI review setup](ai-review-setup.md) - Plan model, env-only auth against prompt injection, read-only agent, and the verdict line as the posting gate.
|
||||
* [PR-Agent for Gitea reviews](pr-agent.md) - A pinned webhook server replaces the per-PR opencode job; internal-only, scoped bot, OpenCode Go model.
|
||||
* [AI review setup (opencode)](ai-review-setup.md) - Superseded 2026-10-30; kept for the env-only auth and verdict-gate reasoning.
|
||||
* [Vulnerability audit policy](vulnerability-audit-policy.md) - Blocking audit, reviewed ignore-list for unfixable advisories, and the pnpm-11 settings home.
|
||||
* [Release engineering](release-engineering.md) - release-please in manifest mode, conventional commits as input, message format enforced at commit time.
|
||||
* [Snyk paused and secrets policy](snyk-paused-and-secrets-policy.md) - Why the job is skipped rather than deleted, and the token scopes every workflow secret needs.
|
||||
|
||||
@@ -0,0 +1,119 @@
|
||||
---
|
||||
type: Decision
|
||||
title: PR-Agent for Gitea reviews
|
||||
description: A pinned PR-Agent service inside the Gitea compose stack reviews pull requests through a scoped Gitea bot user, replacing the per-PR opencode job.
|
||||
tags: [decision, ci, ai, gitea, pr-agent, security]
|
||||
status: draft
|
||||
generated: { by: opencode-go/deepseek-v4.1-flash, at: 2026-10-30T20:00: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: operations
|
||||
resource: OKF_Nuxt/pr-agent.md
|
||||
title: PR-Agent operations and configuration
|
||||
- id: pr-checker
|
||||
resource: .gitea/workflows/pr-checker.yml
|
||||
title: PR Check workflow, opencode job removed
|
||||
- id: install
|
||||
resource: https://docs.pr-agent.ai/installation/gitea/
|
||||
title: PR-Agent Gitea installation
|
||||
- id: images
|
||||
resource: https://hub.docker.com/r/pragent/pr-agent
|
||||
title: Published gitea_app image tags
|
||||
- id: gitea-egress
|
||||
resource: https://docs.gitea.com/administration/config-cheat-sheet#webhook
|
||||
title: Gitea webhook egress allowlist
|
||||
---
|
||||
|
||||
# Decision
|
||||
|
||||
PR-Agent runs as `pragent/pr-agent:0.49.0-gitea_app` in a long-lived
|
||||
container on `server0`, as the `pr-agent` service in the Gitea compose
|
||||
stack. It attaches to the existing `gitea_gitea` Docker network and
|
||||
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 service
|
||||
definition lives in `/home/noel/self-hosted/gitea/docker-compose.yml`; the
|
||||
operator guide is [PR-Agent operations](../pr-agent.md).
|
||||
|
||||
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:
|
||||
|
||||
```text
|
||||
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-agent` is a collaborator with write permission on
|
||||
`CV_Website/CV_Site_Nuxt`. The token scopes are `read:repository`,
|
||||
`write:issue` and `read: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:3000` is 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 at
|
||||
`http://gitea:3000`; `GITEA__WEB_URL=https://git.noelsabia.dev` keeps
|
||||
published links on the public host.
|
||||
* The webhook sends `push`, `issues`, `pull_request` and `issue_comment`
|
||||
events. Only the last two change behaviour today; `push` is kept because
|
||||
PR-Agent may handle push commands in a later configuration.
|
||||
* Auto commands are `/describe` and `/review`. `/improve` stays 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/gitea/pr-agent.env` (mode
|
||||
600) on `server0`. The repository contains the decision and the operator
|
||||
guide, never the token, webhook secret or model key.
|
||||
|
||||
# Evidence
|
||||
|
||||
* 2026-10-30: a direct `glm-5.3-flash` call through the handler returned
|
||||
`OK`, and `/review` on PR #28 posted a PR Reviewer Guide through the Gitea
|
||||
comment API. The key is set only in `gitea/pr-agent.env`.
|
||||
|
||||
# Not verified
|
||||
|
||||
* Whether the model finds the same class of issues as the opencode prompt on
|
||||
larger diffs. The first review found none; `glm-5.3` remains 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.toml` with project instructions is deliberately absent until
|
||||
a 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_app` image tag is worth taking; bump the tag in the Gitea
|
||||
compose file and run `docker compose up -d pr-agent` from that directory.
|
||||
* Review volume makes the container's memory limit tight, or Gitea adds a
|
||||
role that can comment without push access.
|
||||
@@ -26,8 +26,8 @@ Every pull request is checked by three layers, ordered by cost:
|
||||
in one job (one install, cached pnpm store), gitleaks over full
|
||||
history, pnpm audit (blocking), droast Dockerfile lint, Snyk
|
||||
(currently disabled).
|
||||
3. **AI code review** (per PR push): opencode with a plan-covered model,
|
||||
verdict-based, posted as a PR comment.
|
||||
3. **AI code review** (on PR open, or on a slash command): the PR-Agent
|
||||
webhook server, posted as a PR comment.
|
||||
|
||||
The split rule: anything that finishes in seconds and auto-fixes goes in
|
||||
pre-commit; anything slow, network-bound or quota-bound goes in CI; anything
|
||||
@@ -45,15 +45,16 @@ already passed the deterministic gates.
|
||||
|
||||
# Caching
|
||||
|
||||
Two caches, both served by the runner's own cache server (no external
|
||||
service, entries stay on the home server):
|
||||
One cache, served by the runner's own cache server (no external service,
|
||||
entries stay on the home server):
|
||||
|
||||
* **pnpm store**, keyed on the store layout version (v11) and a `sha256sum`
|
||||
of `pnpm-lock.yaml`. Installs hardlink from the store instead of
|
||||
downloading tarballs again. The key is built in a shell step because
|
||||
`hashFiles()` evaluates empty in this act runner.
|
||||
* **opencode binary**, keyed on the pinned CLI version (`~/.opencode/bin`).
|
||||
Small next to the model call, but it removes a network fetch per review.
|
||||
|
||||
The opencode binary cache is gone with the opencode job. PR-Agent is a
|
||||
long-running container on `server0`, so a review no longer downloads a CLI.
|
||||
|
||||
Lint and typecheck also share one job: same image, same lockfile, same
|
||||
install. Splitting them duplicated the install and made both compete for
|
||||
@@ -71,6 +72,10 @@ exposure in the review setup — each fixed where it was cheapest.
|
||||
|
||||
# Failure modes deliberately designed against
|
||||
|
||||
The opencode-specific rows are historical since the review moved to
|
||||
[PR-Agent](pr-agent.md); they are kept because the failure classes still
|
||||
apply to any review implementation.
|
||||
|
||||
| Failure seen | Guard now in place |
|
||||
|---|---|
|
||||
| Error logs posted as review comments | Posting gate is the output contract (a `VERDICT:` line), not the exit code |
|
||||
|
||||
Reference in new issue
Block a user