From cbb5a6731bafa944f7a396161ca08a76a5f4caab Mon Sep 17 00:00:00 2001 From: ffaerber Date: Tue, 7 Jul 2026 17:16:06 +0200 Subject: [PATCH 1/2] feat(ci): cache opencode CLI + Playwright/npm across agent runs --- .gitea/workflows/agent.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/.gitea/workflows/agent.yml b/.gitea/workflows/agent.yml index 0622d03..62c7845 100644 --- a/.gitea/workflows/agent.yml +++ b/.gitea/workflows/agent.yml @@ -5,6 +5,10 @@ name: agent on: workflow_call: +# Pinned opencode version — used both to install it and to key the CI cache below. +env: + OPENCODE_VERSION: "1.17.13" + jobs: agent: @@ -121,6 +125,24 @@ jobs: curl -sS -X POST -H "Authorization: token $SELF_TOKEN" -H "Content-Type: application/json" \ "$R" -d '{"content":"eyes"}' -w '\nreact -> HTTP %{http_code}\n' || true + - name: Cache opencode CLI + if: steps.prep.outputs.mode != 'skip' + continue-on-error: true # a cache backend hiccup must never fail an agent run + uses: actions/cache@v4 + with: + path: ~/.opencode + key: opencode-${{ runner.os }}-${{ env.OPENCODE_VERSION }} + + - name: Cache Playwright browsers + npm (browser agents only) + if: steps.prep.outputs.mode != 'skip' && (steps.prep.outputs.name == 'senior' || steps.prep.outputs.name == 'lead' || steps.prep.outputs.name == 'qa') + continue-on-error: true + uses: actions/cache@v4 + with: + path: | + ~/.cache/ms-playwright + ~/.npm + key: playwright-npm-${{ runner.os }}-v1 + - name: Install opencode + provider config (+ Playwright MCP for browser agents) if: steps.prep.outputs.mode != 'skip' env: -- 2.54.0 From 47a0c93b0b8c669d43373e21eed721aee7a1e4a5 Mon Sep 17 00:00:00 2001 From: ffaerber Date: Tue, 7 Jul 2026 17:16:08 +0200 Subject: [PATCH 2/2] feat(ci): skip opencode re-download on cache hit --- .gitea/workflows/scripts/install-opencode.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/scripts/install-opencode.sh b/.gitea/workflows/scripts/install-opencode.sh index 57ee2d2..761d57a 100755 --- a/.gitea/workflows/scripts/install-opencode.sh +++ b/.gitea/workflows/scripts/install-opencode.sh @@ -9,7 +9,14 @@ set -eu # --format json event schema that build-activity-log.sh parses) breaks every agent in every repo # at once. Bump deliberately by changing this default (or set OPENCODE_VERSION in the step env). OPENCODE_VERSION="${OPENCODE_VERSION:-1.17.13}" -curl -fsSL https://opencode.ai/install | bash -s -- --version "$OPENCODE_VERSION" +# Skip the download when a cache hit already restored the pinned binary (see the Cache +# opencode CLI step in agent.yml). The installer always re-fetches otherwise. +OC_BIN="$HOME/.opencode/bin/opencode" +if [ -x "$OC_BIN" ] && "$OC_BIN" --version 2>/dev/null | grep -qF "$OPENCODE_VERSION"; then + echo "opencode $OPENCODE_VERSION already present (cache hit) — skipping install" +else + curl -fsSL https://opencode.ai/install | bash -s -- --version "$OPENCODE_VERSION" +fi echo "$HOME/.opencode/bin" >> "$GITHUB_PATH" mkdir -p ~/.config/opencode # Playwright browser MCP only for agents that need to drive a web app -- 2.54.0