feat: add agent lifecycle hooks (Claude Code-compatible config) #6011
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| inputs: | |
| branch: | |
| description: "Branch to test" | |
| required: true | |
| default: "main" | |
| type: string | |
| name: Live Provider Tests | |
| jobs: | |
| check-fork: | |
| runs-on: ubuntu-latest | |
| # Skip entire workflow for fork PRs and dependabot PRs (they don't have access to secrets) | |
| if: github.actor != 'dependabot[bot]' && (github.event_name == 'workflow_dispatch' || github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository) | |
| steps: | |
| - run: echo "Not a fork PR - proceeding with smoke tests" | |
| changes: | |
| runs-on: ubuntu-latest | |
| needs: check-fork | |
| outputs: | |
| code: ${{ steps.filter.outputs.code }} | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| with: | |
| ref: ${{ github.event.inputs.branch || github.ref }} | |
| fetch-depth: 0 | |
| - name: Check for code changes | |
| uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # pin@v3 | |
| id: filter | |
| with: | |
| base: ${{ github.event.before || github.event.pull_request.base.sha }} | |
| filters: | | |
| code: | |
| - '!documentation/**' | |
| build-binary: | |
| name: Build Binary | |
| runs-on: ubuntu-latest | |
| needs: changes | |
| if: needs.changes.outputs.code == 'true' || github.event_name == 'workflow_dispatch' | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| with: | |
| ref: ${{ github.event.inputs.branch || github.ref }} | |
| - uses: actions-rust-lang/setup-rust-toolchain@v1 | |
| - name: Install Dependencies | |
| run: | | |
| sudo apt update -y | |
| sudo apt install -y libdbus-1-dev gnome-keyring libxcb1-dev | |
| - name: Cache Rust dependencies | |
| uses: Swatinem/rust-cache@v2 | |
| - name: Build Binary for Smoke Tests | |
| run: | | |
| cargo build --bin goose --bin goosed | |
| - name: Upload goose binary | |
| uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0 | |
| with: | |
| name: goose-binary | |
| path: target/debug/goose | |
| retention-days: 1 | |
| - name: Upload goosed binary | |
| uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0 | |
| with: | |
| name: goosed-binary | |
| path: target/debug/goosed | |
| retention-days: 1 | |
| smoke-tests: | |
| name: Smoke Tests | |
| runs-on: ubuntu-latest | |
| needs: build-binary | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| with: | |
| ref: ${{ github.event.inputs.branch || github.ref }} | |
| - name: Download Binary | |
| uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0 | |
| with: | |
| name: goose-binary | |
| path: target/debug | |
| - name: Make Binary Executable | |
| run: chmod +x target/debug/goose | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| - name: Install agentic providers | |
| run: npm install -g @anthropic-ai/claude-code @openai/codex @google/gemini-cli | |
| - name: Run Smoke Tests with Provider Script | |
| env: | |
| ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} | |
| OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
| CODEX_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
| GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }} | |
| GEMINI_API_KEY: ${{ secrets.GOOGLE_API_KEY }} | |
| DATABRICKS_HOST: ${{ secrets.DATABRICKS_HOST }} | |
| DATABRICKS_TOKEN: ${{ secrets.DATABRICKS_TOKEN }} | |
| OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }} | |
| XAI_API_KEY: ${{ secrets.XAI_API_KEY }} | |
| TETRATE_API_KEY: ${{ secrets.TETRATE_API_KEY }} | |
| HOME: /tmp/goose-home | |
| GOOSE_DISABLE_KEYRING: 1 | |
| SKIP_BUILD: 1 | |
| SKIP_PROVIDERS: ${{ vars.SKIP_PROVIDERS || '' }} | |
| run: | | |
| # Ensure the HOME directory structure exists | |
| mkdir -p $HOME/.local/share/goose/sessions | |
| mkdir -p $HOME/.config/goose | |
| # Run the provider test script (binary already built and downloaded) | |
| bash scripts/test_providers.sh | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@61cb8a9741eeb8a550a1b8544337180c0fc8476b # v7.2.0 | |
| - name: Run MCP Tests | |
| env: | |
| ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} | |
| OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
| GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }} | |
| DATABRICKS_HOST: ${{ secrets.DATABRICKS_HOST }} | |
| DATABRICKS_TOKEN: ${{ secrets.DATABRICKS_TOKEN }} | |
| OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }} | |
| TETRATE_API_KEY: ${{ secrets.TETRATE_API_KEY }} | |
| XAI_API_KEY: ${{ secrets.XAI_API_KEY }} | |
| HOME: /tmp/goose-home | |
| GOOSE_DISABLE_KEYRING: 1 | |
| SKIP_BUILD: 1 | |
| run: | | |
| bash scripts/test_mcp.sh | |
| - name: Run Subrecipe Tests | |
| env: | |
| ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} | |
| GOOSE_PROVIDER: anthropic | |
| GOOSE_MODEL: claude-sonnet-4-5-20250929 | |
| HOME: /tmp/goose-home | |
| GOOSE_DISABLE_KEYRING: 1 | |
| SKIP_BUILD: 1 | |
| run: | | |
| bash scripts/test_subrecipes.sh | |
| smoke-tests-code-exec: | |
| name: Smoke Tests (Code Execution) | |
| runs-on: ubuntu-latest | |
| needs: build-binary | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| with: | |
| ref: ${{ github.event.inputs.branch || github.ref }} | |
| - name: Download Binary | |
| uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0 | |
| with: | |
| name: goose-binary | |
| path: target/debug | |
| - name: Make Binary Executable | |
| run: chmod +x target/debug/goose | |
| - name: Run Provider Tests (Code Execution Mode) | |
| env: | |
| ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} | |
| OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
| GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }} | |
| DATABRICKS_HOST: ${{ secrets.DATABRICKS_HOST }} | |
| DATABRICKS_TOKEN: ${{ secrets.DATABRICKS_TOKEN }} | |
| OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }} | |
| XAI_API_KEY: ${{ secrets.XAI_API_KEY }} | |
| TETRATE_API_KEY: ${{ secrets.TETRATE_API_KEY }} | |
| HOME: /tmp/goose-home | |
| GOOSE_DISABLE_KEYRING: 1 | |
| SKIP_BUILD: 1 | |
| SKIP_PROVIDERS: ${{ vars.SKIP_PROVIDERS || '' }} | |
| run: | | |
| mkdir -p $HOME/.local/share/goose/sessions | |
| mkdir -p $HOME/.config/goose | |
| bash scripts/test_providers_code_exec.sh | |
| compaction-tests: | |
| name: Compaction Tests | |
| runs-on: ubuntu-latest | |
| needs: build-binary | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| with: | |
| ref: ${{ github.event.inputs.branch || github.ref }} | |
| - name: Download Binary | |
| uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0 | |
| with: | |
| name: goose-binary | |
| path: target/debug | |
| - name: Make Binary Executable | |
| run: chmod +x target/debug/goose | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@61cb8a9741eeb8a550a1b8544337180c0fc8476b # v7.2.0 | |
| - name: Run Compaction Tests | |
| env: | |
| ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} | |
| GOOSE_PROVIDER: anthropic | |
| GOOSE_MODEL: claude-sonnet-4-5-20250929 | |
| HOME: /tmp/goose-home | |
| GOOSE_DISABLE_KEYRING: 1 | |
| SKIP_BUILD: 1 | |
| run: | | |
| mkdir -p $HOME/.local/share/goose/sessions | |
| mkdir -p $HOME/.config/goose | |
| bash scripts/test_compaction.sh | |
| goosed-integration-tests: | |
| name: goose server HTTP integration tests | |
| runs-on: ubuntu-latest | |
| needs: build-binary | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| with: | |
| ref: ${{ github.event.inputs.branch || github.ref }} | |
| - name: Download Binary | |
| uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0 | |
| with: | |
| name: goosed-binary | |
| path: target/debug | |
| - name: Make Binary Executable | |
| run: chmod +x target/debug/goosed | |
| - name: Install Node.js Dependencies | |
| run: source ../../bin/activate-hermit && npm ci | |
| working-directory: ui/desktop | |
| - name: Run Integration Tests | |
| env: | |
| ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} | |
| GOOSED_BINARY: ../../target/debug/goosed | |
| GOOSE_PROVIDER: anthropic | |
| GOOSE_MODEL: claude-sonnet-4-5-20250929 | |
| SHELL: /bin/bash | |
| run: | | |
| echo 'export PATH=/some/fake/path:$PATH' >> $HOME/.bash_profile | |
| source ../../bin/activate-hermit && npm run test:integration:debug | |
| working-directory: ui/desktop |