Compare commits

..
23 Commits
Author SHA1 Message Date
Noel Sabia 258b03e458 fix(ci): reconcile stale release-please state before the action
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) Failing after 9s
PR Check / Dockerfile lint (droast) (pull_request) Successful in 4s
PR #22 kept autorelease: pending after its head branch was deleted. Gitea rewrites head.ref to refs/pull/22/head, so the action cannot tag it and every later run then aborts with 'There are untagged, merged release PRs outstanding' - no new release PR is ever opened.

Add a reconciliation step that marks a pending PR tagged when its tag already exists, and recreates the tag from the manifest at the merge commit when the branch is gone and the tag is missing.
2026-10-31 19:42:38 +01:00
Noel e29927bef7 Merge pull request 'chore(deps): update dependency @iconify-json/material-symbols to v1.2.97' (#30) from renovate/iconify-json-material-symbols-1.x-lockfile into main
release-please / release-please (push) Successful in 5s
2026-10-31 04:02:27 +00:00
Noel 06508be0e0 chore(deps): update dependency @iconify-json/material-symbols to v1.2.97
PR Check / Security scan (Snyk) (pull_request) Skipped
PR Check / Lint + typecheck (pull_request) Successful in 1m13s
PR Check / Secret scan (gitleaks) (pull_request) Successful in 7s
PR Check / Dependency audit (pull_request) Failing after 9s
PR Check / Dockerfile lint (droast) (pull_request) Successful in 5s
2026-10-31 04:02:25 +00:00
Noel 8f4eb24e77 Merge pull request 'feat(ci): replace opencode review with PR-Agent' (#28) from feat/pr-agent into main
release-please / release-please (push) Successful in 5s
Reviewed-on: #28
2026-10-30 20:59:30 +00:00
Noel 6dfa2c8aa6 Merge branch 'main' into feat/pr-agent
PR Check / Security scan (Snyk) (pull_request) Skipped
PR Check / Lint + typecheck (pull_request) Successful in 1m11s
PR Check / Secret scan (gitleaks) (pull_request) Successful in 6s
PR Check / Dependency audit (pull_request) Successful in 9s
PR Check / Dockerfile lint (droast) (pull_request) Successful in 4s
2026-10-30 20:40:02 +00:00
Noel 8b7d9bce81 Merge pull request 'ci(renovate): authenticate github.com release note lookups' (#29) from fix/renovate-release-notes into main
release-please / release-please (push) Successful in 5s
Reviewed-on: #29
2026-10-30 20:39:49 +00:00
Noel Sabia da28885588 refactor(deploy): run PR-Agent inside the Gitea compose stack
PR Check / Security scan (Snyk) (pull_request) Skipped
PR Check / Lint + typecheck (pull_request) Canceled after 22s
PR Check / Secret scan (gitleaks) (pull_request) Canceled after 0s
PR Check / Dependency audit (pull_request) Canceled after 0s
PR Check / Dockerfile lint (droast) (pull_request) Canceled after 0s
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.
2026-10-30 21:39:31 +01:00
Noel Sabia 723c38d2e3 ci(renovate): authenticate github.com release note lookups
PR Check / Security scan (Snyk) (pull_request) Skipped
PR Check / Lint + typecheck (pull_request) Failing after 21s
PR Check / Secret scan (gitleaks) (pull_request) Successful in 6s
PR Check / Dependency audit (pull_request) Failing after 9s
PR Check / Dockerfile lint (droast) (pull_request) Successful in 5s
PR Check / AI code review (opencode) (pull_request) Failing after 13s
Renovate fetches changelogs and release notes from github.com. Anonymous
requests are rate-limited, so the first run skipped them and printed the
"no github.com credentials" warning in the PR body.

RENOVATE_GITHUB_COM_TOKEN now comes from a repository secret. It is
independent of RENOVATE_TOKEN: any github.com account with read-only
access is enough, and no scopes are needed for public repositories.
2026-10-30 21:35:25 +01:00
Noel Sabia 636a65dd05 docs(pr-agent): record the first successful review
PR Check / Security scan (Snyk) (pull_request) Skipped
PR Check / Lint + typecheck (pull_request) Successful in 1m10s
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
The key is wired into the live server .env; glm-5.3-flash returned OK and /review on PR #28 posted a PR Reviewer Guide.
2026-10-30 21:28:05 +01:00
Noel Sabia a43134ad83 fix(ci): repair PR-Agent model routing
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 7s
PR Check / Dependency audit (pull_request) Successful in 8s
PR Check / Dockerfile lint (droast) (pull_request) Successful in 5s
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.
2026-10-30 21:14:15 +01:00
Noel Sabia 3eac73255f fix(deps): sync lockfile and pin patched seroval
The merge of main updated package.json to @nuxt/icon 2.6.2 without the lockfile, so frozen installs aborted. Regenerate the lockfile and force seroval 1.6.11 for GHSA-f86p-h4j2-7qgj and GHSA-9wx9-5pv9-3349.
2026-10-30 21:14:12 +01:00
Noel Sabia b84d353dcb docs(pr-agent): document the OpenCode Go session header
PR Check / Security scan (Snyk) (pull_request) Skipped
PR Check / Lint + typecheck (pull_request) Failing after 23s
PR Check / Secret scan (gitleaks) (pull_request) Successful in 6s
PR Check / Dependency audit (pull_request) Failing after 10s
PR Check / Dockerfile lint (droast) (pull_request) Successful in 4s
2026-10-30 21:11:19 +01:00
Noel Sabia f5810960a8 chore(deploy): add least-privilege PR-Agent operator access
PR Check / Security scan (Snyk) (pull_request) Skipped
PR Check / Lint + typecheck (pull_request) Failing after 19s
PR Check / Secret scan (gitleaks) (pull_request) Successful in 6s
PR Check / Dependency audit (pull_request) Failing after 9s
PR Check / Dockerfile lint (droast) (pull_request) Successful in 5s
2026-10-30 21:09:19 +01:00
Noel 679c0b4858 Merge branch 'main' into feat/pr-agent
PR Check / Security scan (Snyk) (pull_request) Skipped
PR Check / Lint + typecheck (pull_request) Failing after 20s
PR Check / Secret scan (gitleaks) (pull_request) Successful in 6s
PR Check / Dependency audit (pull_request) Failing after 9s
PR Check / Dockerfile lint (droast) (pull_request) Successful in 5s
2026-10-30 20:05:32 +00:00
Noel efb73378e9 Merge pull request 'chore(deps): update dependency @nuxt/icon to v2.6.2' (#27) from renovate/nuxt-icon-2.x into main
release-please / release-please (push) Successful in 4s
2026-10-30 20:01:55 +00:00
Noel a8355d976b chore(deps): update dependency @nuxt/icon to v2.6.2
PR Check / Security scan (Snyk) (pull_request) Skipped
renovate/artifacts Artifact file update failure
PR Check / Lint + typecheck (pull_request) Failing after 22s
PR Check / Secret scan (gitleaks) (pull_request) Successful in 6s
PR Check / Dependency audit (pull_request) Failing after 9s
PR Check / Dockerfile lint (droast) (pull_request) Successful in 4s
PR Check / AI code review (opencode) (pull_request) Failing after 12s
2026-10-30 20:01:53 +00:00
Noel 214ec46fed Merge pull request 'chore(deps): update node:26-slim docker digest to 18f03e4' (#26) from renovate/node-26-slim into main
release-please / release-please (push) Successful in 4s
2026-10-30 20:01:50 +00:00
Noel c332c195a9 chore(deps): update node:26-slim docker digest to 18f03e4
PR Check / Security scan (Snyk) (pull_request) Skipped
PR Check / Lint + typecheck (pull_request) Successful in 1m12s
PR Check / Secret scan (gitleaks) (pull_request) Successful in 6s
PR Check / Dependency audit (pull_request) Failing after 9s
PR Check / Dockerfile lint (droast) (pull_request) Successful in 5s
PR Check / AI code review (opencode) (pull_request) Failing after 15s
2026-10-30 20:01:48 +00:00
Noel Sabia c626cc9c1d feat(ci): replace opencode review with PR-Agent
PR Check / Security scan (Snyk) (pull_request) Skipped
PR Check / Lint + typecheck (pull_request) Canceled after 45s
PR Check / Secret scan (gitleaks) (pull_request) Canceled after 0s
PR Check / Dependency audit (pull_request) Canceled after 0s
PR Check / Dockerfile lint (droast) (pull_request) Canceled after 0s
Run PR-Agent as a pinned webhook server on the Gitea Docker network and review on PR open plus slash commands. The per-PR opencode installer and verdict-posting step are removed.

The server-side .env stays outside the repository; deploy/pr-agent/ holds the compose definition and operator notes.
2026-10-30 21:00:53 +01:00
Noel a129e89aec Merge pull request 'ci(renovate): enable Renovate on Gitea with automerge' (#25) from feat/add_renovate into main
release-please / release-please (push) Successful in 5s
Reviewed-on: #25
2026-10-30 19:51:32 +00:00
Noel Sabia 2497d91cf7 ci(renovate): enable Renovate on Gitea with automerge
PR Check / Security scan (Snyk) (pull_request) Skipped
PR Check / Lint + typecheck (pull_request) Successful in 1m11s
PR Check / Secret scan (gitleaks) (pull_request) Successful in 6s
PR Check / Dependency audit (pull_request) Failing after 9s
PR Check / Dockerfile lint (droast) (pull_request) Successful in 6s
PR Check / AI code review (opencode) (pull_request) Successful in 32s
Gitea has no hosted Renovate, so the repository runs the official image
from a scheduled Gitea Actions workflow. The platform settings stay in the
workflow environment because Renovate accepts them only in the self-hosted
config, not in renovate.json.

renovate.json keeps the repository config minimal: schema plus
automerge=true, which also covers major updates. The bot account and the
RENOVATE_TOKEN secret are the remaining manual steps.
2026-10-30 20:33:09 +01:00
Noel 9ecf504843 Merge pull request 'fix(ci): point changelog compare links at our Gitea' (#24) from fix/release-baseline into main
release-please / release-please (push) Successful in 8s
Reviewed-on: #24
2026-10-27 14:00:12 +00:00
Noel Sabia a2259df877 fix(ci): point changelog compare links at our Gitea
PR Check / Security scan (Snyk) (pull_request) Skipped
PR Check / Lint + typecheck (pull_request) Successful in 1m10s
PR Check / Dependency audit (pull_request) Successful in 9s
PR Check / Dockerfile lint (droast) (pull_request) Successful in 6s
PR Check / Secret scan (gitleaks) (pull_request) Successful in 6s
PR Check / AI code review (opencode) (pull_request) Successful in 22s
The generated CHANGELOG linked every release to
github.com/CV_Website/CV_Site_Nuxt, a host this repository does not live
on. release-please takes the compare host from the configuration, so it
is set now.

The decision record also gains the real reason no tag was ever created:
Gitea rewrites a merged PR's head.ref to refs/pull/<n>/head once the head
branch is deleted, and the Gitea build parses that field as the release
branch. BranchName.parse then fails and the release is dropped with a
logged error while the run still exits 0. The repository deleted every
merged branch; that default is off now, and the versions the manifest
already consumed have to be tagged by hand.
2026-10-27 12:20:28 +01:00
20 changed files with 733 additions and 274 deletions

No files matched your search

-226
View File
@@ -229,229 +229,3 @@ jobs:
# Dockerfile/base image checks are covered by the droast job
snyk code test \
--severity-threshold=high
# -------------------------------------------------------- ai code review --
review:
name: AI code review (opencode)
runs-on: ubuntu-latest
container: node:22-bookworm
# Draft PRs don't get a (paid) review yet. The event_name check is
# load-bearing: manual (workflow_dispatch) triggers - which exist to
# run the paused snyk job - must NOT launch a paid review, which on
# a dispatch event has no PR to post to.
if: ${{ github.event_name == 'pull_request' && !github.event.pull_request.draft }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Restore opencode binary
id: opencode-cache
# The installer writes to $HOME/.opencode/bin. Caching it saves the
# ~4s download+extract per run - small next to the model call, but
# free to keep. Key includes the pinned version, so bumping the
# version below invalidates the cached binary automatically.
# As above, a cache outage falls back to the installer.
continue-on-error: true
uses: actions/cache@v4.1.0
with:
path: ~/.opencode/bin
key: opencode-v2.0.32-${{ runner.os }}
- name: Install opencode CLI
if: steps.opencode-cache.outputs.cache-hit != 'true'
run: curl -fsSL https://opencode.ai/v2/install | bash -s -- -v 2.0.32
# v2 installer is required: the classic /install URL ships only
# OpenCode 1.x (resolved to v1.19.3 on arm64), which cannot resolve
# model variants like "#medium" and failed with ProviderModelNotFoundError.
# Version pinned (-v 2.0.32) so a breaking v2 release cannot fail
# the job mid-PR; bump deliberately, not automatically.
- name: Add opencode to PATH
# The installer appends the directory to $GITHUB_PATH itself, but that
# step is skipped on a cache hit. Add it unconditionally.
run: echo "$HOME/.opencode/bin" >> "$GITHUB_PATH"
- name: Get PR diff
run: |
# lockfile changes bloat the diff (175KB here) and are pointless to
# review - pnpm audit already covers dependencies. Excluding the
# lockfile also keeps the diff small enough to hand to the model.
# The diff goes to a file IN the workspace so the agent can read it
# with its file tools (passing 190KB as a CLI argument fails with
# "Argument list too long", MAX_ARG_STRLEN is 128KiB).
git diff --merge-base "origin/${{ github.base_ref }}" \
-- . ':(exclude)pnpm-lock.yaml' > .pr-review-diff.patch
wc -c .pr-review-diff.patch
- name: Run opencode review
env:
OPENCODE_API_KEY: ${{ secrets.OPENCODE_API_KEY }}
run: |
# opencode-go/claude-haiku-5-5#medium: cheap ($0.10/$0.50 per M
# tokens) and, unlike deepseek-v4.1-flash, it has a #medium
# reasoning variant - flash only exposes low/high/max, so every
# review there ran at maximum effort. #medium keeps the review
# competent without paying for max reasoning on each push.
# History: deepseek-v4-pro#max -> deepseek-v4.1-flash#max ->
# haiku-5-5#medium (2026-10-20). The pro endpoint failed two
# consecutive runs with "Upstream request failed: Endpoint is
# unavailable" before the flash switch; that fallback is recorded
# in OKF_Nuxt/open-questions.md. NOTE the provider prefix must be
# "opencode-go", NOT "opencode" (Zen is a different, pay-per-call
# provider and fails with 'Insufficient account funds').
#
# Auth is env-only: the CLI picks up OPENCODE_API_KEY from the
# environment (verified headless). Deliberately NO opencode.json:
# a config file in the checkout would hold the API key in
# plaintext, readable by the agent - a malicious PR diff could
# prompt-inject the agent into quoting the key in the review
# comment (publicly visible). Env vars are invisible to file reads.
# Permissions live in a global config OUTSIDE the checkout (no
# secrets in it, so nothing can leak). OpenCode v2 schema: the
# field is "permissions" (plural) - an ordered array of
# {action, resource, effect}; "bash" was renamed "shell" in v2.
# The singular v1 "permission" object is ignored by the v2 CLI
# (verified empirically: shell commands executed despite deny).
# Denying shell/edit/webfetch/websearch/external_directory means
# no headless permission prompts can hang or kill the run, and
# the reviewer physically cannot modify the repo or browse
# attacker-controlled URLs.
mkdir -p "$HOME/.config/opencode"
printf '{
"$schema": "https://opencode.ai/config.json",
"permissions": [
{ "action": "edit", "resource": "*", "effect": "deny" },
{ "action": "shell", "resource": "*", "effect": "deny" },
{ "action": "webfetch", "resource": "*", "effect": "deny" },
{ "action": "websearch", "resource": "*", "effect": "deny" },
{ "action": "external_directory", "resource": "*", "effect": "deny" }
]
}' > "$HOME/.config/opencode/opencode.json"
# --print-logs: surface auth/provider errors in the CI log instead
# of failing with an opaque exit code
EXIT_CODE=0
opencode run \
--print-logs \
--model opencode-go/claude-haiku-5-5#medium \
"You are a principal engineer performing a rigorous code review on a
pull request. You have tool access: read repo files for context when
the diff alone is ambiguous, but review ONLY code changed in this PR.
The full PR diff is in the file .pr-review-diff.patch in the repo
root. Read it first with your file tools.
pnpm-lock.yaml is deliberately excluded from that patch to keep it
small, not forgotten. It is committed in the PR, pnpm audit covers
the dependencies, and CI runs `pnpm install --frozen-lockfile`.
Do not report a missing lockfile or a frozen-install drift.
## Project context
- Stack: Nuxt 4 (Vue 3, TypeScript) SSR web app in the repo root.
Backend/API services are being added in Golang.
- Deployment target: a personal production CV website.
- Already covered by other CI jobs, do NOT repeat their findings:
ESLint (style), vue-tsc (types), gitleaks (secrets in git history),
pnpm audit (dependency CVEs), droast (Dockerfile lint).
- Your job is everything those tools CANNOT see: logic, security,
architecture, correctness.
## Nuxt / Vue / TypeScript focus
- SSR pitfalls: window/document/localStorage access without
<ClientOnly> or process.client guards; hydration mismatch risks
(Date.now(), Math.random(), locale formatting in render path).
- useAsyncData/useFetch: missing or colliding keys, duplicate
requests between server and client, wrong caching/refresh setup.
- Reactivity bugs: destructuring reactive objects losing reactivity,
missing await on async setup, watch on getters vs refs.
- Security: v-html with unsanitized data, user input flowing into
meta/URLs, open redirects, missing validation in /server/api and
Nitro route handlers, auth checks on both page and API level.
- Config hygiene: server-only runtime config (no NUXT_PUBLIC_
prefix) leaking secrets into the client bundle.
## Golang focus (when Go code is in the diff)
- Errors: unchecked errors, errors discarded, wrapping with %w,
sentinel vs typed errors, panic in library code.
- Concurrency: goroutine leaks (missing context cancellation),
data races (shared state without mutex/channel), WaitGroup
misuse, defer in loops.
- Resources: unclosed response bodies/files/rows, missing
timeouts on http.Client, unbounded buffering.
- Correctness: slice aliasing surprises, copy vs reference
semantics, nil map writes, integer truncation.
## Cross-cutting
- API contract mismatches between Nuxt frontend and Go backends
(field names, nullability, status codes, date formats).
- Missing authorization checks on new endpoints or pages.
- Secrets/credentials ending up in logs or client-visible output.
- Performance on the critical render path (heavy components,
unoptimized images, blocking Nitro middleware).
## Output format (strict)
Review the diff in .pr-review-diff.patch. For every finding:
[BLOCKER] file:line - what and why + concrete fix suggestion
[WARN] file:line - what and why + concrete fix suggestion
[NIT] file:line - optional improvement
BLOCKER = must fix before merge (security, data loss, broken
behavior). WARN = should fix soon. NIT = optional.
If a finding cannot be localized to a file, prefix [BLOCKER-GENERAL].
No compliments, no summaries of what the diff does, no style nits.
Keep it under 400 words unless there are more than 10 findings.
If the diff contains no reviewable code (docs/config only), say so
in one line.
End your response with a final verdict line, exactly one of:
VERDICT: APPROVE (no BLOCKER findings)
VERDICT: REQUEST_CHANGES (at least one BLOCKER)" \
> /tmp/review.md 2>&1 || EXIT_CODE=$?
# always show the output - never swallow the error text
cat /tmp/review.md
# The posting gate is the OUTPUT CONTRACT, not the exit code:
# a completed review always ends with a VERDICT line - error
# dumps never do. opencode can exit 1 on benign tool denials
# even after a full review, so a present verdict means post;
# anything else means the review did not complete.
# Anchored to the tail: the prompt itself contains VERDICT
# lines, so scanning the whole file could pass on echoed
# prompt text or injected quotes - only the last lines count.
if tail -n 5 /tmp/review.md | grep -qE '^VERDICT: (APPROVE|REQUEST_CHANGES)'; then
[ "$EXIT_CODE" -ne 0 ] && echo "::warning::opencode exited ${EXIT_CODE} but produced a valid verdict - posting review"
echo "Review completed with verdict."
else
# fail closed: no verdict = no review. exit 1 unconditionally -
# falling back to EXIT_CODE would exit 0 when opencode succeeded
# but produced no review, and the job would go green.
echo "::error::opencode produced no valid review (exit ${EXIT_CODE:-1}) - NOT posting this output as a review comment"
exit 1
fi
- name: Post review as PR comment
continue-on-error: true # token missing/expired must not fail the build
env:
GITEA_TOKEN: ${{ secrets.PR_GITEA_TOKEN }}
PR_NUMBER: ${{ github.event.pull_request.number }}
REPO: ${{ github.repository }}
# Gitea sets GITHUB_API_URL, e.g. https://gitea.example.com/api/v1
run: |
# re-verify the output contract here: never post anything that is
# not a completed review, regardless of how the previous step ended
if ! tail -n 5 /tmp/review.md | grep -qE '^VERDICT: (APPROVE|REQUEST_CHANGES)'; then
echo "::error::no verdict in review output - nothing to post"
exit 1
fi
# jq is not in the node image - use node for JSON encoding
BODY=$(node -e 'process.stdout.write(JSON.stringify(require("fs").readFileSync("/tmp/review.md","utf8")))')
HTTP_CODE=$(curl -s -o /tmp/comment-response.json -w "%{http_code}" \
-X POST \
-H "Authorization: token ${GITEA_TOKEN}" \
-H "Content-Type: application/json" \
-d "{\"body\": ${BODY}}" \
"${GITHUB_API_URL}/repos/${REPO}/issues/${PR_NUMBER}/comments")
echo "POST status: ${HTTP_CODE}"
cat /tmp/comment-response.json
case "$HTTP_CODE" in
200|201) echo "Review comment posted." ;;
*) echo "::error::Failed to post review comment (HTTP ${HTTP_CODE}) - check PR_GITEA_TOKEN scope and expiry" ;;
esac
+15
View File
@@ -49,6 +49,21 @@ jobs:
echo "created label: ${name}"
done
# The label fix above is not retroactive. PR #22 was merged with
# `autorelease: pending` but its head branch had already been deleted,
# so the action reports `Bad branch name: refs/pull/22/head`, creates no
# tag and leaves the label behind. Every later run then aborts with
# "There are untagged, merged release PRs outstanding" and never opens a
# new release PR - green, no tags. This step reconciles that state before
# the action runs: mark a pending PR tagged when its tag already exists,
# or recreate the tag when the head branch is gone and release-please
# therefore cannot. See scripts/reconcile-release-please.mjs and
# OKF_Nuxt/decisions/release-engineering.md.
- name: Reconcile stale release-please state
env:
GITEA_TOKEN: ${{ secrets.PR_GITEA_TOKEN }}
run: node scripts/reconcile-release-please.mjs
- uses: joaquinjsb/gitea-release-please-action@v4
with:
# One well-scoped token for all workflow API work (see
+47
View File
@@ -0,0 +1,47 @@
name: Renovate
# Renovate is not hosted for Gitea, so this repository runs it itself.
# The bot opens dependency PRs through the API; the PR pipeline checks them
# (a branch protection rule should require those checks before automerge).
#
# Manual setup: create a bot account with its full name and email set, give
# it write access to this repository, and store a token with
# repository read/write, issue read/write, user read and organization read
# as the RENOVATE_TOKEN Actions secret. Release notes also need a github.com
# token (any account, read-only, no scopes for public repositories) as the
# RENOVATE_GITHUB_COM_TOKEN secret.
on:
schedule:
# Daily at 04:00 UTC. Gitea only schedules workflows that exist on the
# default branch.
- cron: "0 4 * * *"
workflow_dispatch:
concurrency:
group: renovate
cancel-in-progress: false
jobs:
renovate:
name: Run Renovate
runs-on: ubuntu-latest
timeout-minutes: 30
# Pinned and multi-arch (the runner is arm64). The image installs the
# Node-based toolchain it needs on demand.
container: renovate/renovate:44.198.2
steps:
- name: Run Renovate
env:
RENOVATE_PLATFORM: gitea
# API root, not the web root. Renovate reads renovate.json from the
# default branch through this endpoint.
RENOVATE_ENDPOINT: https://git.noelsabia.dev/api/v1
RENOVATE_TOKEN: ${{ secrets.RENOVATE_TOKEN }}
# github.com is only used to fetch release notes and other public
# metadata. Anonymous requests are rate-limited, which is why the
# PR body warned that release notes were skipped.
RENOVATE_GITHUB_COM_TOKEN: ${{ secrets.RENOVATE_GITHUB_COM_TOKEN }}
# This workflow lives in the repository it updates, so scope the bot
# to it instead of every repository its account can see.
RENOVATE_REPOSITORIES: CV_Website/CV_Site_Nuxt
run: renovate
+2 -2
View File
@@ -16,7 +16,7 @@
# runner's arm64 and this workstation's x86_64.
# syntax: no BuildKit-only features used, so the default frontend suffices.
FROM node:26-slim@sha256:d62f13676d530f7edf97782729df69713c8ccfe6631e7f62f9ccab65968719a8 AS build
FROM node:26-slim@sha256:18f03e4b532a63baf09809fe8349c2171807f1818cb6c5230fb12aecd5beda65 AS build
# pnpm pinned to the same version as CI (pr-checker.yml pins major 11) and
# the local toolchain (11.26.0). Installed via npm from the node image - no
@@ -38,7 +38,7 @@ COPY . .
RUN pnpm build
FROM node:26-slim@sha256:d62f13676d530f7edf97782729df69713c8ccfe6631e7f62f9ccab65968719a8
FROM node:26-slim@sha256:18f03e4b532a63baf09809fe8349c2171807f1818cb6c5230fb12aecd5beda65
# pnpm is NOT installed in the runtime image: nothing here runs pnpm.
ENV NODE_ENV=production \
+1 -1
View File
@@ -1,4 +1,4 @@
FROM node:26-slim@sha256:d62f13676d530f7edf97782729df69713c8ccfe6631e7f62f9ccab65968719a8
FROM node:26-slim@sha256:18f03e4b532a63baf09809fe8349c2171807f1818cb6c5230fb12aecd5beda65
# Node no longer bundles pnpm (corepack and pnpm are both absent from this
# image), so install it. First instruction, so later changes reuse the layer.
+5 -1
View File
@@ -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,
+2 -1
View File
@@ -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.
+119
View File
@@ -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.
+11 -6
View File
@@ -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 |
+97 -16
View File
@@ -16,6 +16,9 @@ sources:
- id: workflow
resource: .gitea/workflows/release-please.yml
title: release-please workflow
- id: reconcile
resource: scripts/reconcile-release-please.mjs
title: release-please state reconciliation
---
# Decision
@@ -70,32 +73,110 @@ The workflow now creates both labels (`autorelease: pending`,
`autorelease: tagged`) before the action runs. Idempotent: it reads the
label list and creates only what is missing.
# Recovering a release that was merged without a label
# The head branch must survive the merge (2026-10-27)
Labels exist only from the fixed workflow onwards. PRs merged before that
still carry none, so tagging them is a one-time manual step:
The label fix was necessary but not sufficient. PR #22 carried
`autorelease: pending` when it was merged, and the run after it still
created no tag. From its log (task 475):
```sh
# add the pending label to the merged release PRs
for n in 20 21; do
curl -sS -X POST -H "Authorization: token $TOKEN" \
-H 'Content-Type: application/json' \
-d '{"labels":["autorelease: pending"]}' \
"https://git.noelsabia.dev/api/v1/repos/CV_Website/CV_Site_Nuxt/issues/$n/labels"
done
```
❯ Found pull request #22: 'chore: release main'
✖ Bad branch name: refs/pull/22/head
⚠ Expected 1 releases, only found 0
```
Then run the release-please workflow again (it now has
`workflow_dispatch`). It creates `v1.2.0` and `v1.3.0` from those PRs'
bodies and replaces the label with `autorelease: tagged`.
Gitea rewrites a merged PR's `head.ref` to `refs/pull/<n>/head` once the
head branch is deleted; the branch name survives only in `head.label`.
The Gitea build of release-please reads `head.ref`
(`BranchName.parse(mergedPullRequest.headBranchName)`, bundled at
`dist/index.js:15288`) and abandons the release when it is not a release
branch. GitHub keeps the branch name there, which is why the plugin's
assumption holds on GitHub and not here.
The repository deleted the head branch of every merged PR
(`default_delete_branch_after_merge: true`). It is `false` now, and a
release PR must be merged with its branch kept. The mechanism was
confirmed by comparison, not inference: while `fix/release_please` still
existed, PR #23 reported `head.ref = fix/release_please`; every PR whose
branch was gone reported `refs/pull/<n>/head`.
# A pending label outlives the branch and blocks every later release (2026-10-31)
Flipping `default_delete_branch_after_merge` to `false` only protects
branches deleted *after* the change. PR #22's branch was already gone, so
its `head.ref` stayed `refs/pull/22/head` and its `autorelease: pending`
label stayed attached. Run 143 (task 475, 2026-10-27, the run immediately
after #22 merged) shows the full deadlock:
```
❯ Found pull request #22: 'chore: release main'
✖ Bad branch name: refs/pull/22/head
...
✔ Building candidate release pull request for path: .
❯ Found pull request #22: 'chore: release main'
⚠ There are untagged, merged release PRs outstanding - aborting
::set-output:: prs_created=false
::set-output:: releases_created=false
```
The first block fails the tagging phase. The second finds the same
still-pending PR and aborts the propose phase, so no new release PR is
even opened. Every later run (145, 148, 151, 153, 162, 164, 167) has the
same shape. The hand-created `v1.4.0` tag restores the baseline (`found:
v1.4.0`) but does not clear the label, so it does not break the
deadlock. This is the current reason the pipeline is still healthy-looking
and tagless.
The workflow now reconciles that state before the action runs
(`scripts/reconcile-release-please.mjs`):
* merged + `autorelease: pending` + a tag already at the merge commit ->
replace the label with `autorelease: tagged`;
* merged + `autorelease: pending` + head branch gone + no tag -> create
the tag from the version recorded in the manifest at the merge commit
(the exact tag release-please would have made), then swap the label;
* merged + `autorelease: pending` + head branch still present -> leave
it; release-please tags it in the same run.
The step is idempotent and runs on every push to `main` and every manual
dispatch, so a deleted branch cannot silently poison the release pipeline
again. #20 and #21 are not labelled pending, so they do not block; their
tags remain the one-time manual recovery in the table below.
# Recovering the versions that never got a tag
The label alone cannot recover them — #20, #21 and #22 all lost their head
branch, so release-please skips them for the reason above. Creating those
tags is a one-time manual step:
| Version | Merge commit |
|---|---|
| `v1.1.0` | `67cf232` (#12) |
| `v1.2.0` | `4e8aa28` (#20) |
| `v1.3.0` | `08eb042` (#21) |
| `v1.4.0` | `0c937e6` (#22) |
`v1.0.0` is the bootstrap changelog entry from the configuration commit
`c89747e` (2026-10-18); no release PR produced it.
The manifest moved to 1.4.0 without any tag existing, so until a tag is
present release-please has no baseline: it reported "No latest release
found for path: ., component: , but a previous version (1.4.0) was
specified in the manifest" and would compute the next release from the
whole history.
# Not verified
* That the release phase tags correctly once the head branch survives a
merge. The next release cycle proves it.
* That the reconcile step's tag-creation fallback works with a live
token. Only the tag-already-exists path was exercised, in dry-run,
against the live PR #22. The fallback is written from the same Gitea
API shapes (`POST /tags`, `PUT /issues/{index}/labels`) the rest of the
workflow uses.
* That `RELEASE_PLEASE_TOKEN_CV_SITE_NUXT` carries the `write:issue`
scope the same way `PR_GITEA_TOKEN` needed it; the previous failure
was an immediate API rejection consistent with a scope problem.
* That the release phase tags correctly once the label is present. The
label path is now fixed at the source; the first recovery run proves it.
# Revisit when
+3 -1
View File
@@ -11,6 +11,7 @@ config files — the configs say what, these documents say why.
* [Open questions](open-questions.md) - What is still undecided for the Nuxt site.
* [Backend endpoints](backend-endpoints.md) - The smallest API the frontend needs from the Go gateway: health, chapters, metrics, knockdown, events.
* [Profile data](profile.md) - The LinkedIn export behind the terminal chapters, what is real vs mock, and how to refresh it.
* [PR-Agent operations](pr-agent.md) - The Gitea-side review service: configuration, commands, logs and model.
* [Future updates](future-updates.md) - Pipeline improvement backlog with effort estimates, not yet decided.
* [Update log](log.md) - History of changes to this bundle.
@@ -19,7 +20,8 @@ config files — the configs say what, these documents say why.
## CI/CD and releases (2026-10-18)
* [PR pipeline layering](decisions/pr-pipeline-layering.md) - Three layers: pre-commit for cheap deterministic checks, Gitea Actions for thorough ones, AI review for judgment.
* [AI review setup](decisions/ai-review-setup.md) - Plan model, env-only auth against prompt injection, read-only agent, verdict line as the posting gate.
* [PR-Agent for Gitea reviews](decisions/pr-agent.md) - A pinned review service inside the Gitea compose stack replaces the per-PR opencode job; internal-only, scoped bot, OpenCode Go model.
* [AI review setup (opencode)](decisions/ai-review-setup.md) - Superseded 2026-10-30; kept for the env-only auth and verdict-gate reasoning.
* [Vulnerability audit policy](decisions/vulnerability-audit-policy.md) - Blocking audit; reviewed ignore-list for unfixable advisories in pnpm-workspace.yaml.
* [Release engineering](decisions/release-engineering.md) - release-please in manifest mode; conventional commits enforced at commit time.
* [Snyk paused and secrets policy](decisions/snyk-paused-and-secrets-policy.md) - Quota-paused job kept in place; `write:issue` scope required on every workflow token.
+29
View File
@@ -1,5 +1,34 @@
# Update Log
## 2026-10-31 (release-please still never tagged: the stale pending label)
* **Fix**: [release-please.yml](../.gitea/workflows/release-please.yml) now runs [scripts/reconcile-release-please.mjs](../scripts/reconcile-release-please.mjs) before the action. The branch-deletion fix from 2026-10-27 only protects branches deleted after the setting changed; PR #22's branch was already gone, so its `autorelease: pending` label was never cleared. The action therefore finds #22 on every run, logs `Bad branch name: refs/pull/22/head`, creates no tag, and then aborts the propose phase with `There are untagged, merged release PRs outstanding` - `prs_created=false`, `releases_created=false`, exit code 0. Evidence: run 143 (task 475, immediately after #22 merged) and every run through 167 has that exact shape; the hand-created `v1.4.0` tag makes the baseline work (`found: v1.4.0`) but does not clear the label. The reconcile script marks a pending PR tagged when its tag already exists, and recreates the tag from the manifest at the merge commit when the head branch is gone and the tag is missing. A dry run against the live API correctly matches #22 to `v1.4.0` and proposes `autorelease: tagged`. See [Release engineering](decisions/release-engineering.md).
## 2026-10-30 (PR-Agent moved into the Gitea compose stack)
* **Refactor**: the `pr-agent` service now lives in `/home/noel/self-hosted/gitea/docker-compose.yml` with `/home/noel/self-hosted/gitea/pr-agent.env`. The separate `/home/noel/self-hosted/pr-agent` stack and the unused `/opt` operator-access scripts were removed; the service is managed with the Gitea stack.
* **Docs**: the operator README moved to [PR-Agent operations](pr-agent.md). The decision, index and update log point at the new topology.
* **Evidence**: after the move, the container is healthy, a signed webhook from the Gitea container returns 200, and a direct `glm-5.3-flash` call returns `OK`.
## 2026-10-30 (PR #28: lockfile and PR-Agent routing repaired)
* **Fix**: `pnpm-lock.yaml` - merging `main` left the lockfile at `@nuxt/icon` 2.6.0 while `package.json` asked for 2.6.2, so `pnpm install --frozen-lockfile` aborted in CI. The lockfile now resolves 2.6.2.
* **Fix**: `pnpm-workspace.yaml` - `seroval` 1.6.9 was the two moderate audit findings (GHSA-f86p-h4j2-7qgj, GHSA-9wx9-5pv9-3349). The patched 1.6.11 is forced through `overrides`; the blocking audit now reports only two low-severity advisories and passes the moderate gate.
* **Fix**: PR-Agent model routing - OpenCode Go rejects requests without `x-opencode-session`; `LITELLM__EXTRA_HEADERS` now supplies it, and the fallback keeps the `openai/` prefix. Auto commands are `/describe` and `/review`; `/improve` is on demand. A dummy-key call reaches the provider's auth check instead of failing on the missing header.
* **Evidence**: the key was wired into the live `.env`; a direct `glm-5.3-flash` call returned `OK`, and `/review` on PR #28 posted a PR Reviewer Guide (no findings). The failed-review comment was removed.
* **State**: the key is set only in `gitea/pr-agent.env`; the first `/review` posted on PR #28 with no findings.
## 2026-10-30 (PR-Agent replaces the opencode review job)
* **Decision**: [PR-Agent for Gitea reviews](decisions/pr-agent.md) - a pinned `pragent/pr-agent:0.49.0-gitea_app` container on `server0` reviews PRs through the Gitea bot user `pr-agent`; the endpoint stays on the `gitea_gitea` Docker network.
* **Update**: [pr-checker.yml](../.gitea/workflows/pr-checker.yml) - removed the `review` job, the opencode installer and the verdict-posting step. PR-Agent now runs `/describe` and `/review` on PR open/reopen and answers slash commands.
* **Creation**: `deploy/pr-agent/` (later removed; the service now lives in the Gitea compose stack) - compose service, example environment and operator README. The real `.env` lived only at `/home/noel/self-hosted/pr-agent/.env` (mode 600) on `server0`.
* **State**: the container is running and the webhook signature path is verified. Gitea gained `[webhook] ALLOWED_HOST_LIST = private:3000` (one restart, healthy) and the repository has a signed webhook. The OpenCode Go API key was still missing at commit time, so no model call or real review has run yet.
## 2026-10-27 (release-please still never tagged: the deleted head branch)
* **Fix**: [release-please-config.json](../release-please-config.json) gained `"changelog-host": "https://git.noelsabia.dev"` - the changelog compare links were generated against `github.com/CV_Website/CV_Site_Nuxt`, a host this repository does not live on. Root cause of the missing tags: **Gitea rewrites `head.ref` to `refs/pull/<n>/head` when the merged PR's branch is deleted**, and release-please parses that field as the release branch, so `BranchName.parse` fails and the release is dropped - silently, exit code 0. Evidence: run 143 (task 475) logs `✖ Bad branch name: refs/pull/22/head` right after `Found pull request #22`, then `Expected 1 releases, only found 0`; #22 did carry `autorelease: pending`. The repository deleted every merged branch (`default_delete_branch_after_merge: true`); it is `false` now. Four versions (1.1.0-1.4.0) were consumed by the manifest with no tag ever created, so the release baseline has to be restored by hand. See [Release engineering](decisions/release-engineering.md).
## 2026-10-24 (release-please never tagged: the missing labels)
* **Fix**: [release-please.yml](../.gitea/workflows/release-please.yml) - the workflow now creates `autorelease: pending` and `autorelease: tagged` before the action runs, and gained `workflow_dispatch` so a missed release can be replayed. Root cause: release-please finds merged release PRs **by label**, and Gitea resolves label names with `GetLabelIDsInRepoByNames`, a SQL `IN` filter that silently drops unknown names. The repository had no labels at all, so PRs #20 and #21 were merged unlabeled, every run found zero merged release PRs, created zero tags and opened the next release PR instead - reporting success each time. Evidence: run 137 green, 0 tags, 0 releases, `labels: []` on #20/#21/#22, and the repo's label list empty. See [Release engineering](decisions/release-engineering.md).
+2 -1
View File
@@ -16,7 +16,8 @@ generated: { by: opencode-go/glm-5.3-flash, at: 2026-10-18T12:41:52Z }
| Whether these decisions stay in this bundle or fold into the sibling `OKF_CV_Website` bundle, which already describes the frontend at design level | after the production image exists | None. |
| When and how often Snyk runs once re-enabled: weekly schedule, ready-for-review gate, or per-push | re-enabling the snyk job | Stay disabled. |
| Whether the AI review job should gate merges (required status check on the verdict) or stay advisory | branch protection setup | Advisory. The review comment is information; blocking merges on an AI verdict is a policy choice, not a technical one. |
| How the opencode CLI version in CI gets upgraded: manually bump the pinned 2.0.32, or automate when a new major appears | first review failure after an opencode release | Manual bump. Pinning exists so upgrades are decisions. |
| ~~How the opencode CLI version in CI gets upgraded~~ - **closed** (2026-10-30): the opencode job was removed; the review path is a pinned PR-Agent container. See [PR-Agent for Gitea reviews](decisions/pr-agent.md) | done | — |
| Whether `glm-5.3-flash` through PR-Agent produces acceptable reviews on this repository | first PR after the OpenCode Go key is set | Keep it; `glm-5.3` is the configured fallback. |
| ~~Whether the Go plan's per-model usage windows survive real review frequency, and which model the review should use~~ - **decided** (2026-10-20): review model is `opencode-go/claude-haiku-5-5#medium` in [pr-checker.yml](../.gitea/workflows/pr-checker.yml). Cheap per token, and it has a real `#medium` effort level; `deepseek-v4.1-flash` only exposes low/high/max, so it always paid for maximum reasoning. The earlier pro -> flash switch (two consecutive `Endpoint is unavailable` failures) is in the [log](../log.md) | done | — |
| Removing the two reviewed audit ignores when `node-forge` or `braces` ship patched releases | next dependency update round | Watch for new releases. |
+123
View File
@@ -0,0 +1,123 @@
---
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.
# 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`.
+1 -1
View File
@@ -20,7 +20,7 @@
},
"dependencies": {
"@iconify-json/material-symbols": "^1.2.95",
"@nuxt/icon": "2.6.0",
"@nuxt/icon": "2.6.2",
"@nuxtjs/i18n": "10.6.0",
"@nuxtjs/seo": "6.0.1",
"@nuxtjs/tailwindcss": "6.14.0",
+89 -18
View File
@@ -6,6 +6,7 @@ settings:
overrides:
postcss-selector-parser: 7.1.6
seroval: 1.6.11
importers:
@@ -13,10 +14,10 @@ importers:
dependencies:
'@iconify-json/material-symbols':
specifier: ^1.2.95
version: 1.2.95
version: 1.2.97
'@nuxt/icon':
specifier: 2.6.0
version: 2.6.0(@nuxt/schema@4.6.2)(confbox@0.3.1)(dotenv@17.4.2)(giget@3.3.1)(jiti@2.7.0)(magic-string@1.4.3)(oxc-parser@0.153.0)(rolldown@1.2.14)(unplugin@3.4.0(esbuild@0.28.2)(rolldown@1.2.14)(rollup@4.64.8)(vite@8.3.4(esbuild@0.28.2)(jiti@2.7.0)(terser@5.51.2)(yaml@2.9.1)))(vite@8.3.4(esbuild@0.28.2)(jiti@2.7.0)(terser@5.51.2)(yaml@2.9.1))(vue@3.5.44(typescript@5.9.3))
specifier: 2.6.2
version: 2.6.2(@nuxt/schema@4.6.2)(confbox@0.3.1)(dotenv@17.4.2)(giget@3.3.1)(jiti@2.7.0)(magic-string@1.4.3)(oxc-parser@0.153.0)(rolldown@1.2.14)(unplugin@3.4.0(esbuild@0.28.2)(rolldown@1.2.14)(rollup@4.64.8)(vite@8.3.4(esbuild@0.28.2)(jiti@2.7.0)(terser@5.51.2)(yaml@2.9.1)))(vite@8.3.4(esbuild@0.28.2)(jiti@2.7.0)(terser@5.51.2)(yaml@2.9.1))(vue@3.5.44(typescript@5.9.3))
'@nuxtjs/i18n':
specifier: 10.6.0
version: 10.6.0(@nuxt/schema@4.6.2)(db0@0.3.4)(dotenv@17.4.2)(esbuild@0.28.2)(giget@3.3.1)(ioredis@5.11.1(supports-color@10.2.2))(jiti@2.7.0)(rolldown@1.2.14)(rollup@4.64.8)(supports-color@10.2.2)(typescript@5.9.3)(vite@8.3.4(esbuild@0.28.2)(jiti@2.7.0)(terser@5.51.2)(yaml@2.9.1))(vue@3.5.44(typescript@5.9.3))
@@ -676,11 +677,11 @@ packages:
resolution: {integrity: sha512-bV0Tgo9K4hfPCek+aMAn81RppFKv2ySDQeMoSZuvTASywNTnVJCArCZE2FWqpvIatKu7VMRLWlR1EazvVhDyhQ==}
engines: {node: '>=18.18'}
'@iconify-json/material-symbols@1.2.95':
resolution: {integrity: sha512-n34GNbwe8We3LPXK2N8JuQewEQkITJiRsmX/0UYJsOyKzviVl22mNfLUiGGtXLKDPqxZa17q1Hg57zdA3BYa0w==}
'@iconify-json/material-symbols@1.2.97':
resolution: {integrity: sha512-MbE4QHrH4Z4eoerBFrzFSPqHw2NwVGwwOwGZdJym5l5N5loqEUThimlQpK9VJA6mvgWvj5jl43b8bZnqzOxNRQ==}
'@iconify/collections@1.0.754':
resolution: {integrity: sha512-5AJQgPgjBFGwsQGyDjySYvkzX2tU4GO+blKb1HExUuiha3rhvUvw5rvQxZ/WBX3YJFl4kqqV3gcjpdidsXhH/w==}
'@iconify/collections@1.0.758':
resolution: {integrity: sha512-i6z8ImaR9gH/Kj51H81JmGaX1K5OF+SuNZB4DxJwgdweZUBguMaL62EDFqIwF1V8xKfGrOJRB/tx4csYXaNl0w==}
'@iconify/types@2.0.0':
resolution: {integrity: sha512-+wluvCrRhXrhyOmRDJ3q8mux9JkKy5SJ/v8ol2tu4FVjyYvtEzkc/3pK15ET6RKg4b4w4BmTk1+gsCUhf21Ykg==}
@@ -1027,8 +1028,8 @@ packages:
vite-plugin-eslint2:
optional: true
'@nuxt/icon@2.6.0':
resolution: {integrity: sha512-cMT2gOK0AS8+CFI45Upz0Erzm9wud+iJ/eX/YeWbcw9UmSdU16PjbYyHpRKSALFHoSi3E7j7WRgT/KyU7UG7iA==}
'@nuxt/icon@2.6.2':
resolution: {integrity: sha512-eNVXbKzj1fmrkzcakkix8Pn/7lpd0I1b7xG0shjrlefr2wWIG3o0DrU9EvvT1BCf9UD33MAzoLF1l2Z99CKoTg==}
'@nuxt/kit@3.21.11':
resolution: {integrity: sha512-0Xi3tgwN77w43Q8GCPIrvWmF1J7Peehkts44E0uKNIml9lB8WoUn8YxyUjxBv47XtVR86NWoWALAT+/IEMHJEA==}
@@ -1064,6 +1065,36 @@ packages:
rolldown:
optional: true
'@nuxt/kit@4.6.3':
resolution: {integrity: sha512-djNup72hMvn7C9xp0/KAYeoY9uzbrPguv91SUBjEeSHh49kP/YI4BvxUVHP8sZd3kms5Ht+IZTJ6XAfm9hofKw==}
engines: {node: ^20.19.0 || >=22.12.0}
peerDependencies:
'@nuxt/schema': ^3.0.0 || ^4.0.0 || ^5.0.0-0
confbox: '>=0.1.0'
dotenv: '*'
giget: '>=3.1.0'
jiti: ^2.0.0
mlly: ^1.2.0
oxc-parser: '>=0.56.0'
rolldown: '>=1.0.0'
peerDependenciesMeta:
'@nuxt/schema':
optional: true
confbox:
optional: true
dotenv:
optional: true
giget:
optional: true
jiti:
optional: true
mlly:
optional: true
oxc-parser:
optional: true
rolldown:
optional: true
'@nuxt/nitro-server@4.6.2':
resolution: {integrity: sha512-mOiTpoiSG26/0UI4Nxfc4AK76UaCdpjObLPCF6NTDX9wL6Ed4/95AAVZKbEq7qxtNSla/8F+s8NSY6O1wpJ5bA==}
engines: {node: ^22.22.3 || ^24.15.0 || >=26.0.0}
@@ -3416,6 +3447,10 @@ packages:
resolution: {integrity: sha512-/8UvqAPU9DGTI9k4mxtf49U37Isfwr8Uts96+SBHIkFxPJnHS0Ew4f00sM4Scd8V8EjM0jUNtVDdv1kPdt35lg==}
engines: {node: '>= 4'}
ignore@7.0.14:
resolution: {integrity: sha512-wCBiZ77u1tuWde6G/nfOtLaCTYcFDU5yCzARzK10y+rLhzYoL7a7yEemcopcc2Mzow7gZOIjnV2ym1NYmdiJOQ==}
engines: {node: '>= 4'}
image-meta@0.2.2:
resolution: {integrity: sha512-3MOLanc3sb3LNGWQl1RlQlNWURE5g32aUphrDyFeCsxBTk08iE3VNe4CwsUZ0Qs1X+EfX0+r29Sxdpza4B+yRA==}
@@ -4671,8 +4706,8 @@ packages:
resolution: {integrity: sha512-GL2BWwVa6JydKO6l/ljVgjAZF4QJ3S7dWDWi53s5GZT8PJzD2fNxi67HANQGKAqPrwEpL5ba7gUBGi0Ls/sEoQ==}
engines: {node: '>=20.0.0'}
seroval@1.6.9:
resolution: {integrity: sha512-UeEzHwAK+yl0YLbsvROV1t5yMYEwZZ0CfKYxDvUgS2fO9Vxdf8djqVIB+OuVpuawRNPqw68LE1Du/GMsW2ZPqA==}
seroval@1.6.11:
resolution: {integrity: sha512-hpb6XnMCGN/A+79Uf8V7/iTGkyyyazNn5X0CoCAp7Uy9vT3RT8jZ9GLcnxGoVjg3P8AArbe4ZVHq6C8oT2a0kA==}
engines: {node: '>=10'}
serve-placeholder@2.0.2:
@@ -6068,11 +6103,11 @@ snapshots:
'@humanwhocodes/retry@0.4.3': {}
'@iconify-json/material-symbols@1.2.95':
'@iconify-json/material-symbols@1.2.97':
dependencies:
'@iconify/types': 2.0.0
'@iconify/collections@1.0.754':
'@iconify/collections@1.0.758':
dependencies:
'@iconify/types': 2.0.0
@@ -6561,15 +6596,16 @@ snapshots:
- vite
- webpack
'@nuxt/icon@2.6.0(@nuxt/schema@4.6.2)(confbox@0.3.1)(dotenv@17.4.2)(giget@3.3.1)(jiti@2.7.0)(magic-string@1.4.3)(oxc-parser@0.153.0)(rolldown@1.2.14)(unplugin@3.4.0(esbuild@0.28.2)(rolldown@1.2.14)(rollup@4.64.8)(vite@8.3.4(esbuild@0.28.2)(jiti@2.7.0)(terser@5.51.2)(yaml@2.9.1)))(vite@8.3.4(esbuild@0.28.2)(jiti@2.7.0)(terser@5.51.2)(yaml@2.9.1))(vue@3.5.44(typescript@5.9.3))':
'@nuxt/icon@2.6.2(@nuxt/schema@4.6.2)(confbox@0.3.1)(dotenv@17.4.2)(giget@3.3.1)(jiti@2.7.0)(magic-string@1.4.3)(oxc-parser@0.153.0)(rolldown@1.2.14)(unplugin@3.4.0(esbuild@0.28.2)(rolldown@1.2.14)(rollup@4.64.8)(vite@8.3.4(esbuild@0.28.2)(jiti@2.7.0)(terser@5.51.2)(yaml@2.9.1)))(vite@8.3.4(esbuild@0.28.2)(jiti@2.7.0)(terser@5.51.2)(yaml@2.9.1))(vue@3.5.44(typescript@5.9.3))':
dependencies:
'@iconify/collections': 1.0.754
'@iconify/collections': 1.0.758
'@iconify/types': 2.0.0
'@iconify/utils': 3.1.7
'@iconify/vue': 5.0.4(vue@3.5.44(typescript@5.9.3))
'@nuxt/devtools-kit': 3.4.4(@nuxt/schema@4.6.2)(confbox@0.3.1)(dotenv@17.4.2)(giget@3.3.1)(jiti@2.7.0)(magic-string@1.4.3)(mlly@1.8.2)(oxc-parser@0.153.0)(rolldown@1.2.14)(unplugin@3.4.0(esbuild@0.28.2)(rolldown@1.2.14)(rollup@4.64.8)(vite@8.3.4(esbuild@0.28.2)(jiti@2.7.0)(terser@5.51.2)(yaml@2.9.1)))(vite@8.3.4(esbuild@0.28.2)(jiti@2.7.0)(terser@5.51.2)(yaml@2.9.1))
'@nuxt/kit': 4.6.2(@nuxt/schema@4.6.2)(confbox@0.3.1)(dotenv@17.4.2)(giget@3.3.1)(jiti@2.7.0)(magic-string@1.4.3)(mlly@1.8.2)(oxc-parser@0.153.0)(rolldown@1.2.14)(unplugin@3.4.0(esbuild@0.28.2)(rolldown@1.2.14)(rollup@4.64.8)(vite@8.3.4(esbuild@0.28.2)(jiti@2.7.0)(terser@5.51.2)(yaml@2.9.1)))
'@nuxt/kit': 4.6.3(@nuxt/schema@4.6.2)(confbox@0.3.1)(dotenv@17.4.2)(giget@3.3.1)(jiti@2.7.0)(magic-string@1.4.3)(mlly@1.8.2)(oxc-parser@0.153.0)(rolldown@1.2.14)(unplugin@3.4.0(esbuild@0.28.2)(rolldown@1.2.14)(rollup@4.64.8)(vite@8.3.4(esbuild@0.28.2)(jiti@2.7.0)(terser@5.51.2)(yaml@2.9.1)))
consola: 3.4.2
fnv1a-64: 0.1.2
local-pkg: 1.2.1
mlly: 1.8.2
ohash: 2.0.12
@@ -6682,6 +6718,39 @@ snapshots:
- magic-string
- unplugin
'@nuxt/kit@4.6.3(@nuxt/schema@4.6.2)(confbox@0.3.1)(dotenv@17.4.2)(giget@3.3.1)(jiti@2.7.0)(magic-string@1.4.3)(mlly@1.8.2)(oxc-parser@0.153.0)(rolldown@1.2.14)(unplugin@3.4.0(esbuild@0.28.2)(rolldown@1.2.14)(rollup@4.64.8)(vite@8.3.4(esbuild@0.28.2)(jiti@2.7.0)(terser@5.51.2)(yaml@2.9.1)))':
dependencies:
consola: 3.4.2
defu: 6.1.7
destr: 2.0.5
errx: 0.2.2
exsolve: 1.1.3
ignore: 7.0.14
klona: 2.0.6
microdiff: 1.6.0
nostics: 1.3.0
package-manager-detector: 1.9.0
pathe: 2.0.3
rc9: 3.1.0
scule: 1.3.0
std-env: 4.3.0
tinyexec: 1.3.1
tinyglobby: 0.2.17
unctx: 3.0.1(magic-string@1.4.3)(oxc-parser@0.153.0)(rolldown@1.2.14)(unplugin@3.4.0(esbuild@0.28.2)(rolldown@1.2.14)(rollup@4.64.8)(vite@8.3.4(esbuild@0.28.2)(jiti@2.7.0)(terser@5.51.2)(yaml@2.9.1)))
verkit: 0.5.0
optionalDependencies:
'@nuxt/schema': 4.6.2
confbox: 0.3.1
dotenv: 17.4.2
giget: 3.3.1
jiti: 2.7.0
mlly: 1.8.2
oxc-parser: 0.153.0
rolldown: 1.2.14
transitivePeerDependencies:
- magic-string
- unplugin
'@nuxt/nitro-server@4.6.2(6cec1558c59214081a86fad4f67b8fb1)':
dependencies:
'@nuxt/kit': 4.6.2(@nuxt/schema@4.6.2)(confbox@0.3.1)(dotenv@17.4.2)(giget@3.3.1)(jiti@2.7.0)(magic-string@1.4.3)(mlly@1.8.2)(oxc-parser@0.153.0)(rolldown@1.2.14)(unplugin@3.4.0(esbuild@0.28.2)(rolldown@1.2.14)(rollup@4.64.8)(vite@8.3.4(esbuild@0.28.2)(jiti@2.7.0)(terser@5.51.2)(yaml@2.9.1)))
@@ -6815,7 +6884,7 @@ snapshots:
pkg-types: 2.3.3
postcss: 8.5.30
rolldown-string: 0.3.1(rolldown@1.2.14)
seroval: 1.6.9
seroval: 1.6.11
std-env: 4.3.0
ufo: 1.6.4
unenv: 2.0.0-rc.24
@@ -9109,6 +9178,8 @@ snapshots:
ignore@7.0.12: {}
ignore@7.0.14: {}
image-meta@0.2.2: {}
import-fresh@3.3.1:
@@ -10785,7 +10856,7 @@ snapshots:
serialize-javascript@7.1.2: {}
seroval@1.6.9: {}
seroval@1.6.11: {}
serve-placeholder@2.0.2:
dependencies:
+6
View File
@@ -21,6 +21,12 @@ overrides:
# the override when tailwindcss ships >= 7.1.6 itself (or the site moves
# to Tailwind v4).
postcss-selector-parser: 7.1.6
# GHSA-f86p-h4j2-7qgj and GHSA-9wx9-5pv9-3349 (moderate, 2026-10-30):
# seroval < 1.6.11 allows code/script injection through serialized output.
# Nuxt's vite-builder still resolves 1.6.9; the patched 1.6.11 is the
# smallest version that clears both advisories. Remove this when Nuxt ships
# a vite-builder that resolves >= 1.6.11 itself.
seroval: 1.6.11
minimumReleaseAgeExclude:
- '@rollup/rollup-darwin-x64@4.64.8'
- '@rollup/rollup-freebsd-arm64@4.64.8'
+1
View File
@@ -3,6 +3,7 @@
"release-type": "node",
"include-component-in-tag": false,
"separate-pull-requests": false,
"changelog-host": "https://git.noelsabia.dev",
"packages": {
".": {
"package-name": "CV_Site_Frontend",
+4
View File
@@ -0,0 +1,4 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"automerge": true
}
+176
View File
@@ -0,0 +1,176 @@
// Repairs the release-please state that its Gitea fork cannot recover from.
//
// Why this exists (evidence in OKF_Nuxt/decisions/release-engineering.md):
//
// Gitea rewrites a merged PR's `head.ref` to `refs/pull/<n>/head` when the
// head branch is deleted. The fork parses that field as the release branch,
// logs `Bad branch name`, creates no tag - and still exits successfully.
// The merged PR keeps `autorelease: pending`, so every later run aborts with
// `There are untagged, merged release PRs outstanding` and opens no new
// release PR. That is a permanent deadlock, not a transient failure.
//
// This script runs before the action and reconciles the state:
//
// * a merged pending PR whose merge commit already has a tag -> swap
// `autorelease: pending` for `autorelease: tagged` (the release exists,
// only the label is stale);
// * a merged pending PR whose head branch is gone and has no tag -> create
// the tag from the version recorded in the manifest at that merge commit.
// This is exactly the tag release-please would have made if the branch had
// survived; without it the PR blocks every future release;
// * a merged pending PR whose head branch still exists -> leave it alone,
// release-please tags it in the same run.
//
// Run locally against the public API with:
// DRY_RUN=1 node scripts/reconcile-release-please.mjs
// Reads work unauthenticated for a public repository; writes are skipped.
const API_URL = process.env.GITHUB_API_URL
const REPOSITORY = process.env.GITHUB_REPOSITORY
const TOKEN = process.env.GITEA_TOKEN
const DRY_RUN = process.env.DRY_RUN === '1' || process.argv.includes('--dry-run')
const PENDING = 'autorelease: pending'
const TAGGED = 'autorelease: tagged'
if (!API_URL || !REPOSITORY) {
console.error('::error::GITHUB_API_URL and GITHUB_REPOSITORY must be set')
process.exit(1)
}
if (!TOKEN && !DRY_RUN) {
console.error('::error::GITEA_TOKEN is required (or set DRY_RUN=1)')
process.exit(1)
}
const repoUrl = `${API_URL}/repos/${REPOSITORY}`
const api = async (path, init = {}) => {
const response = await fetch(`${repoUrl}${path}`, {
...init,
headers: {
Accept: 'application/json',
...(TOKEN ? { Authorization: `token ${TOKEN}` } : {}),
...(init.headers ?? {}),
},
})
const body = await response.text()
if (!response.ok) {
throw new Error(`${init.method ?? 'GET'} ${path} -> HTTP ${response.status}: ${body.slice(0, 300)}`)
}
return body ? JSON.parse(body) : null
}
// Gitea caps page size at 50. Follow pages until a short page ends the list.
const listAll = async (path) => {
const items = []
for (let page = 1; ; page++) {
const separator = path.includes('?') ? '&' : '?'
const batch = await api(`${path}${separator}limit=50&page=${page}`)
items.push(...batch)
if (batch.length < 50) return items
}
}
const replaceLabels = async (number, labels) => {
if (DRY_RUN) {
console.log(`[dry-run] #${number}: labels -> ${labels.join(', ')}`)
return
}
await api(`/issues/${number}/labels`, {
method: 'PUT',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ labels }),
})
}
const createTag = async (name, sha) => {
if (DRY_RUN) {
console.log(`[dry-run] create tag ${name} at ${sha}`)
return
}
await api('/tags', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ tag_name: name, target: sha, message: `Release ${name}` }),
})
}
const versionAt = async (sha) => {
const file = await api(`/contents/.release-please-manifest.json?ref=${sha}`)
if (!file?.content) throw new Error(`no manifest content at ${sha}`)
const manifest = JSON.parse(Buffer.from(file.content, 'base64').toString('utf8'))
// Single-package repository: the root path is ".". Keep a fallback so a
// future second package cannot silently produce `vundefined`.
return manifest['.'] ?? Object.values(manifest)[0]
}
const run = async () => {
const tags = await listAll('/tags')
const tagSha = new Map(tags.map(tag => [tag.commit?.sha, tag.name]))
const tagsByName = new Map(tags.map(tag => [tag.name, tag.commit?.sha]))
const pulls = await listAll('/pulls?state=closed')
const pending = pulls
.filter(pull => pull.merged_at)
.filter(pull => (pull.labels ?? []).some(label => label.name === PENDING))
.sort((a, b) => a.number - b.number)
if (pending.length === 0) {
console.log('No merged release PR is pending - nothing to reconcile.')
return
}
const failures = []
for (const pull of pending) {
const mergeSha = pull.merge_commit_sha
const headRef = pull.head?.ref ?? ''
const branchGone = headRef.startsWith('refs/pull/') || headRef === ''
const existingTag = tagSha.get(mergeSha)
const labels = (pull.labels ?? []).map(label => label.name)
if (existingTag) {
console.log(`#${pull.number}: ${existingTag} already points at merge commit ${mergeSha} - marking as tagged`)
const next = labels.filter(name => name !== PENDING)
if (!next.includes(TAGGED)) next.push(TAGGED)
await replaceLabels(pull.number, next)
continue
}
if (!branchGone) {
console.log(`#${pull.number}: head branch ${headRef} still exists - leaving it for release-please to tag`)
continue
}
// The branch is gone and no tag exists, so release-please will never get
// past `Bad branch name` for this PR. Recreate the tag it should have
// made, using the version the merged release PR wrote into the manifest.
try {
const version = await versionAt(mergeSha)
if (!version) throw new Error('manifest has no version for the root package')
const name = `v${version}`
if (tagsByName.has(name)) {
throw new Error(`${name} already exists at ${tagsByName.get(name)}, not at merge commit ${mergeSha}; refusing to move a release tag`)
}
console.log(`#${pull.number}: head branch is gone (${headRef}) - creating ${name} at ${mergeSha}`)
await createTag(name, mergeSha)
const next = labels.filter(label => label !== PENDING)
if (!next.includes(TAGGED)) next.push(TAGGED)
await replaceLabels(pull.number, next)
}
catch (error) {
failures.push(`#${pull.number}: ${error.message}`)
}
}
if (failures.length > 0) {
for (const failure of failures) console.error(`::error::${failure}`)
console.error('::error::release-please state is unrecoverable automatically; repair the PR/tag by hand before the next release')
process.exit(1)
}
}
run().catch((error) => {
console.error(`::error::${error.message}`)
process.exit(1)
})