: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(agent-platform): lazy-load seed secret contract (#71768)
Dylan Martin9b39e41b06f4
diff --git a/products/agent_platform/services/agent-tests/src/cases/example-agent-builder.test.ts b/products/agent_platform/services/agent-tests/src/cases/example-agent-builder.test.tsindex 3ee7a54b02ec..fbe0b90a88ef 100644--- a/products/agent_platform/services/agent-tests/src/cases/example-agent-builder.test.ts+++ b/products/agent_platform/services/agent-tests/src/cases/example-agent-builder.test.ts@@ -13,15 +13,19 @@* Faux net — wiring, not inference quality.*/-import { readdir, readFile } from 'node:fs/promises'+import { execFile } from 'node:child_process'+import { cp, mkdir, mkdtemp, readdir, readFile, rm } from 'node:fs/promises'+import { tmpdir } from 'node:os'import { dirname, join, resolve } from 'node:path'import { fileURLToPath } from 'node:url'+import { promisify } from 'node:util'import { AgentSpecSchema } from '@posthog/agent-shared'import { listNativeTools } from '@posthog/agent-tools'const __dirname = dirname(fileURLToPath(import.meta.url))const BUNDLE_ROOT = resolve(__dirname, '../examples/agent-builder')+const execFileAsync = promisify(execFile)async function loadBundle(): Promise<{ spec: Record<string, unknown>; files: Record<string, string> }> {const spec = JSON.parse(await readFile(join(BUNDLE_ROOT, 'spec.json'), 'utf-8')) as Record<string, unknown>@@ -182,4 +186,22 @@ describe('example: agent-builder bundle', () => {// The bundle now SHIPS an MCP — the seeder must never blank mcps[].expect(src).not.toContain('spec["mcps"] = []')})++ it('the shared example seeder starts from the production sparse checkout', async () => {+ const tempRoot = await mkdtemp(join(tmpdir(), 'agent-builder-seed-'))+ const sparseExamplesRoot = join(tempRoot, 'products/agent_platform/services/agent-tests/src/examples')++ try {+ await mkdir(dirname(sparseExamplesRoot), { recursive: true })+ await cp(resolve(__dirname, '../examples'), sparseExamplesRoot, { recursive: true })++ const { stdout } = await execFileAsync('python3', [join(sparseExamplesRoot, 'seed.py'), '--list'], {+ env: { ...process.env, SEED_DUMMY_SECRETS: '0' },+ })++ expect(stdout).toContain('agent-builder')+ } finally {+ await rm(tempRoot, { recursive: true, force: true })+ }+ })})diff --git a/products/agent_platform/services/agent-tests/src/examples/seed.py b/products/agent_platform/services/agent-tests/src/examples/seed.pyindex 045f64407f0b..7606371d6216 100755--- a/products/agent_platform/services/agent-tests/src/examples/seed.py+++ b/products/agent_platform/services/agent-tests/src/examples/seed.py@@ -128,14 +128,13 @@ def _load_trigger_required_secrets() -> dict[str, list[str]]:}-TRIGGER_REQUIRED_SECRETS: dict[str, list[str]] = _load_trigger_required_secrets()-# Opt-in: set obviously-fake placeholder values for any secret an agent requires# (declared `spec.secrets[]` + per-trigger required keys) that isn't already# set, so secret-gated agents (slack, …) can promote in local dev. The agents# won't actually function — Slack signature checks etc. will fail — but they go# live + visible in the console. Never overwrites an existing value.SEED_DUMMY_SECRETS = os.environ.get("SEED_DUMMY_SECRETS") == "1"+TRIGGER_REQUIRED_SECRETS: dict[str, list[str]] = _load_trigger_required_secrets() if SEED_DUMMY_SECRETS else {}# ---------------------------------------------------------------------------