Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/agent/e2e/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ arm self-skips if it is missing).

| Var | Default | Notes |
| --- | --- | --- |
| `POSTHOG_CODE_E2E_GATEWAY_PERSONAL_API_KEY` | — | Required. A token the gateway accepts — the `llm_gateway` product takes a personal API key (no OAuth). Without it every arm skips. `run-e2e.sh` reads the local dev key. |
| `POSTHOG_CODE_E2E_GATEWAY_URL` | `http://localhost:3308/llm_gateway` | Gateway base (codex appends `/v1`). `llm_gateway` accepts a personal API key; `posthog_code` is OAuth-only. |
| `POSTHOG_CODE_E2E_GATEWAY_PERSONAL_API_KEY` | — | Required. A token the gateway accepts — the `ci` product takes a personal API key (no OAuth). Without it every arm skips. `run-e2e.sh` reads the local dev key. |
| `POSTHOG_CODE_E2E_GATEWAY_URL` | `http://localhost:3308/ci` | Gateway base (codex appends `/v1`). `ci` accepts a personal API key; `posthog_code` is OAuth-only. |
| `POSTHOG_CODE_E2E_CLAUDE_MODEL` | `claude-haiku-4-5` | Override if the gateway serves a different cheap Claude id. |
| `POSTHOG_CODE_E2E_CODEX_MODEL` | `gpt-5-mini` | Cheapest codex id the local gateway serves; override if needed. |
| `POSTHOG_CODE_E2E_CLAUDE_STRONG_MODEL` | `claude-sonnet-4-5` | Stronger Claude id for tests the cheap model can't handle (structured output). |
Expand Down
9 changes: 5 additions & 4 deletions packages/agent/e2e/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@ export type Adapter = "claude" | "codex";
/**
* Live e2e configuration, resolved entirely from the environment so no secret is
* committed. Needs a local llm-gateway and a token in `POSTHOG_CODE_E2E_GATEWAY_PERSONAL_API_KEY`; targets
* the `llm_gateway` product, which accepts a personal API key (no OAuth mint,
* unlike prod's `posthog_code`). Without the token every arm self-skips.
* the `ci` product, which accepts a personal API key (no OAuth mint,
* unlike prod's `posthog_code`) and keeps e2e traffic attributed to its own
* `ai_product` rather than the catch-all `llm_gateway` bucket. Without the token
* every arm self-skips.
*/
// `||` not `??`: CI sets unset vars to "" which should fall back to the default.
const GATEWAY_URL =
process.env.POSTHOG_CODE_E2E_GATEWAY_URL ||
"http://localhost:3308/llm_gateway";
process.env.POSTHOG_CODE_E2E_GATEWAY_URL || "http://localhost:3308/ci";
const TOKEN = process.env.POSTHOG_CODE_E2E_GATEWAY_PERSONAL_API_KEY ?? "";

// This checkout's bundled codex binaries, relative to packages/agent/e2e.
Expand Down
6 changes: 3 additions & 3 deletions packages/agent/e2e/run-e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Run the live golden-path e2e for both adapters (claude + codex).
#
# Needs a local llm-gateway (run `./bin/start` in the posthog repo) and a token.
# The suite targets the gateway's `llm_gateway` product, which accepts a personal
# The suite targets the gateway's `ci` product, which accepts a personal
# API key (no OAuth), so if POSTHOG_CODE_E2E_GATEWAY_PERSONAL_API_KEY is unset this reads the repo's
# hardcoded local dev key from ee/settings.py (override the repo with POSTHOG_REPO).
# That key must be registered in the local DB — run `python manage.py
Expand All @@ -25,7 +25,7 @@ if [[ -z "${POSTHOG_CODE_E2E_GATEWAY_PERSONAL_API_KEY:-}" ]]; then
echo "Set POSTHOG_CODE_E2E_GATEWAY_PERSONAL_API_KEY, or POSTHOG_REPO to the posthog checkout." >&2
exit 1
fi
# The `llm_gateway` product accepts personal API keys, so no OAuth mint needed.
# The `ci` product accepts personal API keys, so no OAuth mint needed.
POSTHOG_CODE_E2E_GATEWAY_PERSONAL_API_KEY="$(grep -E '^DEV_API_KEY[[:space:]]*=' "$SETTINGS" | head -1 | sed -E 's/^DEV_API_KEY[[:space:]]*=[[:space:]]*"([^"]+)".*/\1/')"
fi

Expand All @@ -36,6 +36,6 @@ if [[ -z "${POSTHOG_CODE_E2E_GATEWAY_PERSONAL_API_KEY:-}" ]]; then
fi

export POSTHOG_CODE_E2E_GATEWAY_PERSONAL_API_KEY
echo "token: ${POSTHOG_CODE_E2E_GATEWAY_PERSONAL_API_KEY:0:8}… gateway: ${POSTHOG_CODE_E2E_GATEWAY_URL:-http://localhost:3308/llm_gateway}"
echo "token: ${POSTHOG_CODE_E2E_GATEWAY_PERSONAL_API_KEY:0:8}… gateway: ${POSTHOG_CODE_E2E_GATEWAY_URL:-http://localhost:3308/ci}"
cd "$AGENT_DIR"
pnpm test:e2e "$@"
Loading