From 1fa33377f84e5b13200e8dd3cb301c6b80fb1abb Mon Sep 17 00:00:00 2001 From: Jammy2211 Date: Tue, 4 Aug 2026 21:41:03 +0100 Subject: [PATCH] ci: add a PR test workflow, and the sizing skill wrapper it needs to be green MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PyAutoBrain PRs carried zero check runs: docs.yml is path-filtered to docs/**, nightly-release.yml is a cron scheduler, so ~190 tests ran in no CI at all and a PR's only gate was whatever the authoring session ran locally. Add tests.yml, modelled on PyAutoHeart's heart-tests.yml (push to main + pull_request, cancel-in-progress off main only, python 3.12/3.13, pytest only — no agent runs, no network). It checks out PyAutoMind alongside PyAutoBrain because a lone-repo checkout cannot even COLLECT the suite: _sizing.py reads PyAutoMind/repos.yaml at import time and is strict, so test_policy_seams and test_sizing_paths error out first. Both repos are public, so the default GITHUB_TOKEN suffices. Ship the missing skills/sizing/ wrapper in the same PR: sizing is listed as a directly-runnable faculty in `pyauto-brain help` and has its own sizing.sh, but never got the SKILL.md its four sibling faculties carry (wired into help by #141), leaving test_skill_install red on main. Merging the workflow without it would ship a knowingly-failing gate. Verified in the two-repo layout the workflow builds: 193 passed. Closes #194 Co-Authored-By: Claude Opus 5 --- .github/workflows/tests.yml | 64 ++++++++++++++++++++++++++++++++ skills/sizing/SKILL.md | 11 ++++++ skills/sizing/agents/openai.yaml | 4 ++ 3 files changed, 79 insertions(+) create mode 100644 .github/workflows/tests.yml create mode 100644 skills/sizing/SKILL.md create mode 100644 skills/sizing/agents/openai.yaml diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..d5d0607 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,64 @@ +name: Brain Tests + +# Brain's own unit suite — the reasoning layer's self-test. Until this existed, +# PyAutoBrain PRs carried ZERO check runs (`docs.yml` is path-filtered to +# `docs/**`, `nightly-release.yml` is a cron release scheduler), so ~190 tests +# covering the conductors, faculties, worktree helpers, skill install and policy +# seams ran in no CI at all and a Brain PR's only gate was whatever the +# authoring session happened to run locally. +# +# Deliberately ONLY pytest. It must not run `pyauto-brain ` against live +# repos or reach the network — those need the full workspace and belong to the +# scheduled health/nightly drivers, not a PR gate. The suite is stdlib + PyYAML +# only, so it stays fast (~30s) and flake-free. +# +# TWO repos are checked out on purpose. PyAutoBrain alone cannot even COLLECT +# the suite: `agents/faculties/sizing/_sizing.py` reads the body map +# (`BRAIN_HOME.parent / "PyAutoMind" / "repos.yaml"`) at import time and is +# deliberately strict, so `test_policy_seams.py` and `test_sizing_paths.py` +# error out before a single test runs. Checking PyAutoMind out as a sibling +# reproduces the workspace layout the code assumes. Both repos are public, so +# the default GITHUB_TOKEN suffices — no PAT. No other sibling repo is needed +# (verified by running the suite against exactly this two-repo layout). + +# One run per commit: PR events carry the CI; pushes only build main. +# Superseded runs are cancelled on PR refs only — a cancelled main run would +# read as red CI (cancelled is in Heart's FAILURE_CONCLUSIONS). +on: + push: + branches: [main] + pull_request: + +concurrency: + group: brain-tests-${{ github.ref }} + cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} + +jobs: + pytest: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: ["3.12", "3.13"] + steps: + - name: Checkout PyAutoBrain + uses: actions/checkout@v4 + with: + path: PyAutoBrain + # The body map `_sizing.py` imports. Pinned to main: this gate tests + # Brain against the CURRENT organism identity, the same pairing a local + # workspace has. + - name: Checkout PyAutoMind (the body map — required to import) + uses: actions/checkout@v4 + with: + repository: PyAutoLabs/PyAutoMind + path: PyAutoMind + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - name: Install (pytest + PyYAML — the whole dependency set) + run: pip install pytest PyYAML + - name: Run tests + working-directory: PyAutoBrain + run: pytest tests/ -q diff --git a/skills/sizing/SKILL.md b/skills/sizing/SKILL.md new file mode 100644 index 0000000..e47e686 --- /dev/null +++ b/skills/sizing/SKILL.md @@ -0,0 +1,11 @@ +--- +name: sizing +description: Estimate how hard a PyAutoMind prompt is through the read-only PyAutoBrain Sizing Faculty — the single difficulty heuristic the intake and feature conductors both consult. Use to size or re-size a task without dispatching work. +--- + +# Sizing + +Read [`../../agents/faculties/sizing/AGENTS.md`](../../agents/faculties/sizing/AGENTS.md) +completely, then run `bin/pyauto-brain sizing` in the documented mode. Return +the `SizingSurface` as an estimate; deciding to phase or split a task belongs to +the conductor that consulted it. diff --git a/skills/sizing/agents/openai.yaml b/skills/sizing/agents/openai.yaml new file mode 100644 index 0000000..879b9a9 --- /dev/null +++ b/skills/sizing/agents/openai.yaml @@ -0,0 +1,4 @@ +interface: + display_name: "Sizing Faculty" + short_description: "Estimate how hard a PyAutoMind task is" + default_prompt: "Use $sizing to estimate the difficulty of a PyAutoMind prompt."