From 286633fc92dae3a9166268c8ea513f701d5c402b Mon Sep 17 00:00:00 2001 From: Rick Falkvinge Date: Sun, 12 Apr 2026 19:01:01 +0200 Subject: [PATCH] Apply CI lessons from Sonarr pipeline work CI workflow: - Force IPv4 DNS resolution (DOTNET_SYSTEM_NET_HTTP_SOCKETSHTTPHANDLER_DNSRESOLUTIONFAMILY) to avoid IPv6 flakiness in K8s runners - DOTNET_CLI_TELEMETRY_OPTOUT=1 - NUGET_HTTP_TIMEOUT=300 for slow cache warming - npm --network-timeout 120000 for CI resilience AGENTS.md: - Added OpenSpec Artifact Persistence section (commit after every phase, verify before any phase, never re-scaffold) - Added Archive = Full Close-Out section (complete sequence: commit, merge, push, archive, remove worktree) - Added Build Pipeline Notes section (IPv4 DNS, timeouts, cache config) Made-with: Cursor --- .gitea/workflows/ci.yaml | 6 ++++-- AGENTS.md | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/ci.yaml b/.gitea/workflows/ci.yaml index d19c8f44..487c8397 100644 --- a/.gitea/workflows/ci.yaml +++ b/.gitea/workflows/ci.yaml @@ -12,6 +12,8 @@ jobs: env: NUGET_CACHE_URL: ${{ vars.NUGET_CACHE_URL }} NPM_REGISTRY_URL: ${{ vars.NPM_REGISTRY_URL }} + DOTNET_SYSTEM_NET_HTTP_SOCKETSHTTPHANDLER_DNSRESOLUTIONFAMILY: IPv4 + DOTNET_CLI_TELEMETRY_OPTOUT: 1 steps: - uses: actions/checkout@v4 @@ -33,7 +35,7 @@ jobs: set -euo pipefail if [ -n "${NUGET_CACHE_URL:-}" ]; then echo "Using NuGet cache: ${NUGET_CACHE_URL}" - dotnet restore src/UsingCash.sln \ + NUGET_HTTP_TIMEOUT=300 dotnet restore src/UsingCash.sln \ --source "${NUGET_CACHE_URL}" \ --source "https://api.nuget.org/v3/index.json" \ --ignore-failed-sources @@ -55,7 +57,7 @@ jobs: echo "Using npm registry: ${NPM_REGISTRY_URL}" npm config set registry "${NPM_REGISTRY_URL}" fi - npm ci + npm ci --network-timeout 120000 working-directory: frontend - name: Lint frontend diff --git a/AGENTS.md b/AGENTS.md index 8dd878ff..607d6649 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -23,6 +23,42 @@ This repository uses per-agent worktree isolation. Every agent task must run in 5. After merge, remove worktree: - `scripts/agent-worktree.sh remove ` +## OpenSpec Artifact Persistence + +Untracked files in the main checkout can vanish between agent sessions. To prevent loss of OpenSpec artifacts across phases (propose, apply, verify, archive): + +1. **Commit after every phase.** After creating or updating artifacts under `openspec/changes//`, immediately stage and commit them in the main checkout. +2. **Before any phase, verify artifacts exist.** At the start of apply, verify, or archive, confirm the change directory and its files are present. If missing, check `git log --all --oneline -- openspec/changes//` to find and restore them before proceeding. +3. **Never re-scaffold over existing artifacts.** `openspec new change` refuses to overwrite, but if the directory was lost and you recreate it, the fresh `.openspec.yaml` resets artifact tracking. Restore from git history instead of re-creating. + +## Archive = Full Close-Out + +When archiving a change, always perform the complete close-out sequence: + +1. **Commit** any uncommitted implementation work in the agent worktree. +2. **Merge** the agent branch into the integration branch from the main checkout. +3. **Push** the integration branch to origin. +4. **Archive** the change artifacts (`mv openspec/changes/ openspec/changes/archive/YYYY-MM-DD-`). +5. **Remove the worktree and branch:** + ```bash + git worktree remove .worktree/ --force + git branch -d agent/ + ``` + +"Done" means done — no orphan worktrees, no unmerged branches, no unpushed commits. + +## .NET SDK + +The project targets .NET 8. The CI pipeline uses `actions/setup-dotnet` with `dotnet-version: '8.0.x'`. + +## Build Pipeline Notes + +- Force IPv4 for DNS resolution in CI: `DOTNET_SYSTEM_NET_HTTP_SOCKETSHTTPHANDLER_DNSRESOLUTIONFAMILY: IPv4` (IPv6 can be flaky in K8s runners) +- Use `NUGET_HTTP_TIMEOUT=300` for slow cache warming on first build +- Use `--ignore-failed-sources` for resilience when Nexus cache is partially available +- Use `--network-timeout 120000` for npm in CI +- NuGet and npm cache mirrors (Nexus) are configured via repo action variables (`NUGET_CACHE_URL`, `NPM_REGISTRY_URL`) + ## Lock File Contract Each active worktree contains `.agent-lock` with owner/task/timestamp. If lock ownership is unclear, stop and ask before making edits.