From e876055167d6101eaa22e49dbd6e8be4158df457 Mon Sep 17 00:00:00 2001 From: TapTap Date: Thu, 30 Jul 2026 18:25:45 +0200 Subject: [PATCH] fix: remove Gitea Actions agent workflows (agents run locally, not in CI) --- .gitea/workflows/agent-batch-merge.yml | 38 -------------- .gitea/workflows/agent-fix.yml | 43 ---------------- .gitea/workflows/agent-maintenance.yml | 26 ---------- .gitea/workflows/agent-review.yml | 44 ---------------- .gitea/workflows/ci.yaml | 2 +- AGENTS.md | 70 ++++++++++++++++---------- 6 files changed, 44 insertions(+), 179 deletions(-) delete mode 100644 .gitea/workflows/agent-batch-merge.yml delete mode 100644 .gitea/workflows/agent-fix.yml delete mode 100644 .gitea/workflows/agent-maintenance.yml delete mode 100644 .gitea/workflows/agent-review.yml diff --git a/.gitea/workflows/agent-batch-merge.yml b/.gitea/workflows/agent-batch-merge.yml deleted file mode 100644 index 5ac60cf..0000000 --- a/.gitea/workflows/agent-batch-merge.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: Agent Batch Merge -on: - workflow_dispatch: - inputs: - branches: - description: "Comma-separated branches to merge (e.g., fix/a,fix/b)" - required: true - -jobs: - batch-merge: - runs-on: ubuntu-latest - container: gitea.tap-tap.win/taptap/fastsync-ci:v9 - steps: - - uses: actions/checkout@v4 - with: - ref: dev - fetch-depth: 0 - - - name: Merge all branches - run: | - IFS=',' read -ra BRANCHES <<< "${{ github.event.inputs.branches }}" - for branch in "${BRANCHES[@]}"; do - branch=$(echo "$branch" | xargs) - git fetch origin "$branch" - git merge "origin/$branch" --no-edit || true - done - - - name: Build and test - run: | - cmake -B build -S . && cmake --build build -j$(nproc) - ./build/tests - python3 -m pytest tests/ -v --tb=short - - - name: Commit and push - run: | - git add -A - git commit -m "batch-merge: ${{ github.event.inputs.branches }}" || true - git push origin dev diff --git a/.gitea/workflows/agent-fix.yml b/.gitea/workflows/agent-fix.yml deleted file mode 100644 index 15b9130..0000000 --- a/.gitea/workflows/agent-fix.yml +++ /dev/null @@ -1,43 +0,0 @@ -name: Agent Issue Fix -on: - issue_comment: - types: [created] - -jobs: - fix: - if: contains(github.event.comment.body, '/opencode fix') - runs-on: ubuntu-latest - container: gitea.tap-tap.win/taptap/fastsync-ci:v9 - steps: - - uses: actions/checkout@v4 - with: - ref: dev - fetch-depth: 0 - - - name: Install opencode - run: npm install -g opencode-ai - - - name: Create fix branch and implement - run: | - ISSUE_NUM="${{ github.event.issue.number }}" - BRANCH="auto-fix/issue-${ISSUE_NUM}" - git checkout -b "$BRANCH" origin/dev - opencode run \ - "Fix this issue: ${{ github.event.issue.body }}" - git add -A - git commit -m "auto-fix: address issue #${ISSUE_NUM}" || true - git push origin "$BRANCH" - - - name: Create PR - run: | - ISSUE_NUM="${{ github.event.issue.number }}" - TITLE="${{ github.event.issue.title }}" - curl -s -X POST -H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \ - -H "Content-Type: application/json" \ - -d "{ - \"title\": \"Fix: ${TITLE:0:80}\", - \"body\": \"Automated fix for issue #${ISSUE_NUM}\n\nCloses #${ISSUE_NUM}\", - \"head\": \"auto-fix/issue-${ISSUE_NUM}\", - \"base\": \"dev\" - }" \ - "https://gitea.tap-tap.win/api/v1/repos/${{ github.repository }}/pulls" diff --git a/.gitea/workflows/agent-maintenance.yml b/.gitea/workflows/agent-maintenance.yml deleted file mode 100644 index 2fa3fc2..0000000 --- a/.gitea/workflows/agent-maintenance.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: Agent Scheduled Maintenance -on: - schedule: - - cron: "0 6 * * 1" - -jobs: - audit: - runs-on: ubuntu-latest - container: gitea.tap-tap.win/taptap/fastsync-ci:v9 - steps: - - uses: actions/checkout@v4 - with: - ref: dev - - - name: Install opencode - run: npm install -g opencode-ai - - - name: Security audit - run: | - opencode run --agent security-auditor \ - "Audit the codebase for vulnerabilities. Create issues for any findings via the Gitea API at https://gitea.tap-tap.win/api/v1/repos/${{ github.repository }}/issues using token ${{ secrets.GITEA_TOKEN }}" - - - name: Code quality scan - run: | - opencode run --agent code-quality-guardian \ - "Scan for code quality issues. Create issues for any findings via the Gitea API at https://gitea.tap-tap.win/api/v1/repos/${{ github.repository }}/issues using token ${{ secrets.GITEA_TOKEN }}" diff --git a/.gitea/workflows/agent-review.yml b/.gitea/workflows/agent-review.yml deleted file mode 100644 index 3be7107..0000000 --- a/.gitea/workflows/agent-review.yml +++ /dev/null @@ -1,44 +0,0 @@ -name: Agent PR Review -on: - pull_request: - types: [opened, synchronize, ready_for_review] - -jobs: - review: - runs-on: ubuntu-latest - container: gitea.tap-tap.win/taptap/fastsync-ci:v9 - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Install opencode - run: npm install -g opencode-ai - - - name: Run security audit review - run: | - opencode run --agent security-auditor \ - "Review this PR for security vulnerabilities" \ - > /tmp/security-review.md 2>&1 || true - - - name: Run code quality review - run: | - opencode run --agent code-quality-guardian \ - "Review this PR for code quality issues" \ - > /tmp/quality-review.md 2>&1 || true - - - name: Post combined review - run: | - { - echo "## Agent Review Report" - echo "" - echo "### Security Audit" - cat /tmp/security-review.md 2>/dev/null || echo "No security issues found." - echo "" - echo "### Code Quality" - cat /tmp/quality-review.md 2>/dev/null || echo "No quality issues found." - } > /tmp/full-review.md - curl -s -X POST -H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \ - -H "Content-Type: application/json" \ - -d "$(jq -Rs '{body: .}' < /tmp/full-review.md)" \ - "https://gitea.tap-tap.win/api/v1/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments" diff --git a/.gitea/workflows/ci.yaml b/.gitea/workflows/ci.yaml index 05e4d05..82cd6af 100644 --- a/.gitea/workflows/ci.yaml +++ b/.gitea/workflows/ci.yaml @@ -2,7 +2,7 @@ name: CI on: push: - branches: [dev, main] + branches: [main] pull_request: jobs: diff --git a/AGENTS.md b/AGENTS.md index fce0df0..042ab34 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -125,40 +125,56 @@ git push origin dev ## Automated Agent Workflows -When a PR targeting `dev` is opened or synchronized, Gitea Actions workflows automatically run agents to review the code and post results as PR comments. This replaces the manual "invoke 3 reviewers" pattern. +All agents run locally via the opencode CLI. There is no CI-based agent automation — agents are invoked on-demand by the developer or by this assistant. -### Automated PR Review -Triggered on `pull_request: [opened, synchronize, ready_for_review]`. Runs security-auditor and code-quality-guardian, posts combined review to PR. +### One-command batch workflow -### Automated Issue Fix -Comment `/opencode fix` on any issue — agents will create a fix branch, implement the fix, and open a PR targeting `dev`. - -### Scheduled Maintenance -Runs weekly (Monday 06:00 UTC) — security audit of the full codebase, creates issues for findings. - -### Batch Merge Orchestration -For grouping multiple fixes into one integration PR (like the `integration/all-fixes` pattern): -1. Push each fix branch independently (targetting `dev`) -2. Use `workflow_dispatch` on `agent-batch-merge.yml` with comma-separated branch names -3. The workflow merges all branches into `dev`, resolves conflicts, runs build + tests, and pushes - -## Manual PR Invocation - -When automated agents are unavailable or you need a targeted review, invoke agents directly: +For fixing a set of issues and creating one integration PR: ```bash -# Run all 3 reviewers on a PR diff -opencode run --agent reviewer "Review this PR" -opencode run --agent security-auditor "Audit this PR for vulnerabilities" -opencode run --agent code-quality-guardian "Check this PR for code quality" +# 1. Run each subagent on its category +opencode run --agent security-auditor "Fix all open security issues" +opencode run --agent debugger "Fix all open bugs" +opencode run --agent test-writer "Add missing test coverage" -# Post results to Gitea -curl -s -X POST -H "Authorization: token $TOKEN" \ - -H "Content-Type: application/json" \ - -d '{"body":"MARKDOWN_REVIEW_BODY"}' \ - "https://gitea.tap-tap.win/api/v1/repos/TapTap/FastSync/issues//comments" +# 2. The assistant handles: merging branches, fixing CI failures, +# pushing, creating the integration PR, waiting for CI, iterating. +# The developer only reviews the final PR. ``` +### Issue triage loop +When you want to fix a batch of issues autonomously: + +1. Tell the assistant: *"Fix all open issues and create one big PR"* +2. The assistant delegates to subagents in parallel +3. Merges their branches, handles CI failures iteratively +4. Pushes and opens the final PR +5. You review the PR once CI passes — no intermediate check-ins + +### Scheduling +For periodic maintenance (security audits, code quality scans), run: + +```bash +opencode run --agent security-auditor "Audit the codebase for vulnerabilities" +opencode run --agent code-quality-guardian "Scan for code quality issues" +``` + +This can be cron'd locally if desired (e.g., `crontab -e` with `opencode run`). + +## Is opencode a good option? + +**Yes, for FastSync's needs.** The hybrid model works well: +- opencode's 17 specialized agents handle deep code analysis, fixes, tests, and reviews +- The assistant orchestrates subagents, merges branches, and iterates on CI +- You only review the final output + +The key limitation: opencode is session-based, not a persistent daemon. But for the "fix all issues, one PR" workflow, this is fine — the assistant runs the full pipeline in one shot. Persistent webhook-driven automation isn't available for Gitea, but the one-shot batch approach is simpler and gives you full control over what gets merged. + +### Recommendations for this project +- **Do** use the batch pattern: delegate to subagents, let the assistant merge + iterate CI, review once +- **Don't** try to run opencode in Gitea Actions — the CI container doesn't have your LLM keys or the interactive context agents need +- **If** you want fully hands-off periodic scans, set up a local cron job or systemd timer that runs `opencode run` and posts results to Gitea via API + ## Gitea API & tea CLI ### Check CI status via API