name: Autoresearch Loop on: workflow_dispatch: inputs: fixture: description: 'Fixture name in fixtures/ (without .json)' required: true default: 'phase-a-toy' rq_id: description: 'Run ID — defaults to fixture name if blank' required: false default: '' iters: description: 'Max iterations' required: false default: '3' model: description: 'LiteLLM model override (leave blank for default berget/gemma4-31b)' required: false default: '' jobs: run: name: Autoresearch — ${{ inputs.fixture }} runs-on: self-hosted timeout-minutes: 90 steps: - uses: actions/checkout@v4 - name: Resolve run ID id: vars # signals#47: inputs and outputs derived from them reach the shell via # env, never via ${{ }} expansion inside run: (a `"` or `$(...)` in an # input would otherwise run as code). env: IN_RQ_ID: ${{ inputs.rq_id }} IN_FIXTURE: ${{ inputs.fixture }} run: | RQ_ID="$IN_RQ_ID" [ -z "$RQ_ID" ] && RQ_ID="$IN_FIXTURE" echo "rq_id=$RQ_ID" >> "$GITHUB_OUTPUT" - name: Clean stale run dir env: RQ_ID: ${{ steps.vars.outputs.rq_id }} run: rm -rf "runs/$RQ_ID" - name: Set up Python venv run: | [ -d .venv ] || python3 -m venv .venv # torch must come from the cu130 wheel index (koala Blackwell sm_120); # requirements.txt deliberately excludes it. Install it first. .venv/bin/pip install -q torch --index-url https://download.pytorch.org/whl/cu130 .venv/bin/pip install -q -r requirements.txt - name: Scaffold run dir env: IN_FIXTURE: ${{ inputs.fixture }} RQ_ID: ${{ steps.vars.outputs.rq_id }} run: | .venv/bin/python scripts/autoresearch_start.py \ "fixtures/$IN_FIXTURE.json" \ "$RQ_ID" - name: Run autoresearch loop env: LITELLM_KEY: ${{ secrets.LITELLM_KEY }} LITELLM_BASE: ${{ secrets.LITELLM_BASE }} NTFY_URL: ${{ secrets.NTFY_URL }} RQ_ID: ${{ steps.vars.outputs.rq_id }} IN_ITERS: ${{ inputs.iters }} IN_MODEL: ${{ inputs.model }} run: | ARGS=(--run-dir "runs/$RQ_ID" --iters "$IN_ITERS") [ -n "$IN_MODEL" ] && ARGS+=(--model "$IN_MODEL") .venv/bin/python loop.py "${ARGS[@]}" - name: Upload run artifacts if: always() uses: https://gitea.com/actions/upload-artifact@v3 with: name: run-${{ steps.vars.outputs.rq_id }}-${{ github.run_number }} path: | runs/${{ steps.vars.outputs.rq_id }}/STATUS.md runs/${{ steps.vars.outputs.rq_id }}/metrics.json runs/${{ steps.vars.outputs.rq_id }}/program.md retention-days: 30