Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

chore(tasks): smoke the pinned sandbox agent nightly on the go ai-gateway (#105732)

Alessandro Pogliaghi48e0bef457f9
diff --git a/.github/actions/sandbox-agent-gateway-smoke/action.yml b/.github/actions/sandbox-agent-gateway-smoke/action.yml
index 8ced1d7038b4..24b5b650cbcf 100644
--- a/.github/actions/sandbox-agent-gateway-smoke/action.yml
+++ b/.github/actions/sandbox-agent-gateway-smoke/action.yml
@@ -12,6 +12,10 @@ inputs:
registry-token:
description: 'Token that can pull the image from ghcr.io'
required: true
+ agent-version:
+ description: 'The @posthog/agent version the image must contain'
+ required: false
+ default: ''
gateway-url:
description: 'Go ai-gateway base URL'
required: false
@@ -33,6 +37,7 @@ runs:
shell: bash
env:
IMAGE: ${{ inputs.image }}
+ AGENT_VERSION: ${{ inputs.agent-version }}
MINT_KEY: ${{ inputs.mint-key }}
REGISTRY_TOKEN: ${{ inputs.registry-token }}
AI_GATEWAY_URL: ${{ inputs.gateway-url }}
@@ -63,6 +68,13 @@ runs:
echo "Could not run the image." >> "$summary"
finish infra
fi
+ if [ -n "$AGENT_VERSION" ]; then
+ installed=$(docker run --rm "$IMAGE" node -p "require('/scripts/node_modules/@posthog/agent/package.json').version")
+ if [ "$installed" != "$AGENT_VERSION" ]; then
+ echo "The image has @posthog/agent ${installed:-unknown}, not ${AGENT_VERSION}." >> "$summary"
+ finish infra
+ fi
+ fi
if [ -z "$MINT_KEY" ]; then
echo "No gateway mint key is configured." >> "$summary"
finish infra
diff --git a/.github/workflows/update-sandbox-agent-version.yml b/.github/workflows/update-sandbox-agent-version.yml
index 732f84c02ca6..d48eb807d47a 100644
--- a/.github/workflows/update-sandbox-agent-version.yml
+++ b/.github/workflows/update-sandbox-agent-version.yml
@@ -390,6 +390,40 @@ jobs:
echo "::error::The gateway smoke reported ${RESULT:-no result}, so PR #$PR waits for a person"
exit 1
+ # The nightly run catches a gateway deploy that breaks the pinned agent.
+ - name: Smoke the pinned agent on the Go ai-gateway
+ id: nightly-smoke
+ if: github.event_name == 'schedule' && contains(fromJSON('["noop", "declined", "current"]'), steps.state.outputs.action)
+ timeout-minutes: 25
+ uses: ./.github/actions/sandbox-agent-gateway-smoke
+ with:
+ image: ghcr.io/posthog/posthog-sandbox-base:master
+ agent-version: ${{ steps.resolve.outputs.pinned }}
+ mint-key: ${{ secrets.AGENT_SMOKE_AI_GATEWAY_MINT_KEY }}
+ registry-token: ${{ secrets.GITHUB_TOKEN }}
+
+ - name: Post the nightly smoke failure
+ id: nightly-failure
+ if: ${{ !cancelled() && github.event_name == 'schedule' && contains(fromJSON('["noop", "declined", "current"]'), steps.state.outputs.action) && steps.nightly-smoke.outputs.result != 'pass' && steps.nightly-smoke.outputs.result != 'unavailable' }}
+ continue-on-error: true
+ uses: slackapi/slack-github-action@af78098f536edbc4de71162a307590698245be95 # v3.0.1
+ with:
+ method: chat.postMessage
+ token: ${{ secrets.SLACK_BOT_TOKEN }}
+ errors: true
+ payload: |
+ channel: "${{ env.SLACK_CHANNEL }}"
+ unfurl_links: false
+ text: ":red_circle: The nightly Go ai-gateway smoke reported `${{ steps.nightly-smoke.outputs.result || 'no result' }}` for @posthog/agent ${{ steps.resolve.outputs.pinned }} on `posthog-sandbox-base:master`. <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View run>"
+
+ - name: Fail when the nightly smoke did not pass
+ if: ${{ !cancelled() && github.event_name == 'schedule' && contains(fromJSON('["noop", "declined", "current"]'), steps.state.outputs.action) && steps.nightly-smoke.outputs.result != 'pass' && steps.nightly-smoke.outputs.result != 'unavailable' }}
+ env:
+ RESULT: ${{ steps.nightly-smoke.outputs.result }}
+ run: |
+ echo "::error::The nightly gateway smoke reported ${RESULT:-no result} for the pinned agent"
+ exit 1
+
- name: Get release approval token
id: releaser-token
if: steps.state.outputs.action == 'bump'