Skip to content

feat(llm): add a system one client that prefers the ai-gateway #141278

feat(llm): add a system one client that prefers the ai-gateway

feat(llm): add a system one client that prefers the ai-gateway #141278

name: Agent Proxy CI
on:
push:
branches:
- master
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
permissions:
contents: read
pull-requests: read
env:
# npm's audit blocks the pnpm bootstrap. See .github/actions/pnpm-install for why.
NPM_CONFIG_AUDIT: 'false'
NPM_CONFIG_FUND: 'false'
jobs:
changes:
runs-on: ubuntu-24.04
timeout-minutes: 5
name: Determine need to run agent-proxy checks
outputs:
agent_proxy: ${{ steps.filter.outputs.agent_proxy || 'true' }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
sparse-checkout: .github/actions/paths-filter
sparse-checkout-cone-mode: false
- uses: actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3 # v3.1.1
id: app-token
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository
with:
client-id: ${{ vars.GH_APP_POSTHOG_PATHS_FILTER_APP_ID }}
private-key: ${{ secrets.GH_APP_POSTHOG_PATHS_FILTER_PRIVATE_KEY }}
- uses: ./.github/actions/paths-filter
id: filter
if: github.event_name != 'push'
with:
token: ${{ steps.app-token.outputs.token || github.token }}
filters: |
agent_proxy:
- 'services/agent-proxy/**'
- 'ee/hogai/sandbox/turn_event_contract.json'
- '.github/workflows/ci-agent-proxy.yml'
agent-proxy:
name: Agent Proxy checks
needs: changes
if: needs.changes.outputs.agent_proxy == 'true'
runs-on: ubuntu-24.04
timeout-minutes: 10
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Install pnpm dependencies
uses: ./.github/actions/pnpm-install
with:
install-command: pnpm install --frozen-lockfile --filter @posthog/agent-proxy...
- name: Typecheck
working-directory: services/agent-proxy
run: pnpm typecheck
- name: Test
working-directory: services/agent-proxy
run: pnpm exec vitest run
- name: Lint
working-directory: services/agent-proxy
run: pnpm exec oxlint
- name: Format check
working-directory: services/agent-proxy
run: pnpm exec oxfmt --check 'src/**/*.ts' 'tests/**/*.ts' 'scripts/**/*.ts'
agent_proxy_ci:
needs: [changes, agent-proxy]
name: Agent Proxy CI Pass
runs-on: ubuntu-24.04
timeout-minutes: 5
# !cancelled(): a superseded run records cancelled (which branch protection
# does not treat as a pass) instead of running on to report failure. A cancelled
# or timed-out dependency on a live run is still caught by the != success &&
# != skipped checks below; a legitimate no-change skip passes.
if: ${{ !cancelled() }}
steps:
- name: Check outcomes
run: |
if [[ "${{ needs.changes.result }}" != "success" && "${{ needs.changes.result }}" != "skipped" ]]; then
echo "Change detection did not succeed (result: ${{ needs.changes.result }})."
exit 1
fi
if [[ "${{ needs.agent-proxy.result }}" != "success" && "${{ needs.agent-proxy.result }}" != "skipped" ]]; then
echo "Agent Proxy checks did not succeed (result: ${{ needs.agent-proxy.result }})."
exit 1
fi
echo "All agent-proxy checks passed."