: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
chore(devex): move the stamphog review engine into the product (#85567)
Julian Bez45e7ebd20083
diff --git a/.dockerignore b/.dockerignoreindex d91c3cd4338c..b50a018f6e4d 100644--- a/.dockerignore+++ b/.dockerignore@@ -76,7 +76,6 @@ services/agent-*/.next!tools/hogli!tools/openapi-codegen!tools/owners-!tools/pr-approval-agent!tsconfig.json!unit.json.tplcommon/*/*/node_modulesdiff --git a/.github/CODEOWNERS b/.github/CODEOWNERSindex 32696e5b72a7..326266c82235 100644--- a/.github/CODEOWNERS+++ b/.github/CODEOWNERS@@ -49,6 +49,7 @@ tools/owners/** @PostHog/team-securityCODEOWNERS @PostHog/team-security# PR approval agent — can auto-approve PRs, so changes need review+products/stamphog/packages/pr-approval-agent/** @PostHog/team-securitytools/pr-approval-agent/** @PostHog/team-security# Ingestion team owns persons migrationsdiff --git a/.github/scripts/trunk-impacted-targets.js b/.github/scripts/trunk-impacted-targets.jsindex 060816b013cb..54322de73ba5 100644--- a/.github/scripts/trunk-impacted-targets.js+++ b/.github/scripts/trunk-impacted-targets.js@@ -339,6 +339,9 @@ const COMMON_FRONTEND = ['esbuilder', 'storybook', 'tailwind', 'replay-shared',// spec and recorded by a Python script sitting beside them.const COMMON_FULLSTACK = ['fixtures']+// The pr-approval-agent engine's home inside the stamphog product.+const PR_APPROVAL_AGENT_DIR = 'products/stamphog/packages/pr-approval-agent'+// Tools that own their whole test story and that no suite imports, so they can// hold a lane of their own. Everything else under tools/ falls through to the// backend lanes, which keeps a newly added tool over-reporting until someone@@ -352,7 +355,6 @@ const TOOLS_INDEPENDENT = ['hogbox-preview','traffic-sim','hedgebox-dummy',- 'pr-approval-agent','query-performance-ai','infra-scripts',]@@ -1208,8 +1210,8 @@ function addPythonLanes(targets, context) {for (const product of context.products) {targets.add(pyProduct(product))}- // pyproject.toml roots products, but Python also lives under tools/, and- // tools/pr-approval-agent holds a lane of its own through .stamphog.+ // pyproject.toml roots products, but Python also lives under tools/, and the+ // pr-approval-agent engine holds a lane of its own through .stamphog.for (const tool of TOOLS_INDEPENDENT) {targets.add(`tools:${tool}`)}@@ -1460,6 +1462,14 @@ function computeTargets(changedFiles, context) {targets.add('tools:pr-approval-agent')continue}+ // The engine sits inside the stamphog product, but no product suite imports it. ci-python+ // runs its tests directly, and those are the same tests that .stamphog/ and every+ // AGENT_APPROVALS.md feed into. All three share one lane, so a policy change and an engine+ // change cannot merge in parallel against each other.+ if (file.startsWith(`${PR_APPROVAL_AGENT_DIR}/`)) {+ targets.add('tools:pr-approval-agent')+ continue+ }if (/\.mdx?$/.test(file) && !isBuildInput) {inertFiles++continuediff --git a/.github/scripts/trunk-impacted-targets.test.js b/.github/scripts/trunk-impacted-targets.test.jsindex 162bd2251e2e..74fa5c4a9569 100644--- a/.github/scripts/trunk-impacted-targets.test.js+++ b/.github/scripts/trunk-impacted-targets.test.js@@ -554,7 +554,7 @@ test('every target the rules can emit appears in the enumerated universe', () =>'.stamphog/policy.yml','.vscode/launch.json','tools/phrocs/src/main.rs',- 'tools/pr-approval-agent/policy.py',+ 'products/stamphog/packages/pr-approval-agent/policy.py','common/hogvm/x.py','common/storybook/x.ts','common/__init__.py',@@ -646,7 +646,7 @@ test('stamphog policy files claim the suite that validates them', () => {assert.deepEqual(computeTargets(['products/alpha/AGENT_APPROVALS.md'], CONTEXT), ['tools:pr-approval-agent'])assert.deepEqual(computeTargets(['.stamphog/policy.yml'], CONTEXT),- computeTargets(['tools/pr-approval-agent/policy.py'], CONTEXT)+ computeTargets(['products/stamphog/packages/pr-approval-agent/policy.py'], CONTEXT))})diff --git a/.github/workflows/ci-python.yml b/.github/workflows/ci-python.ymlindex e8293854e760..afd52270d67d 100644--- a/.github/workflows/ci-python.yml+++ b/.github/workflows/ci-python.yml@@ -70,6 +70,7 @@ jobs:- 'bin/**'# Dev tools with dedicated pytest steps below- 'tools/pr-approval-agent/**'+ - 'products/stamphog/packages/pr-approval-agent/**'- 'tools/query-performance-ai/**'# Stamphog policy files validated by the pr-approval-agent suite- '.stamphog/**'@@ -209,7 +210,22 @@ jobs:- name: Run pr-approval-agent (stamphog) testsshell: bash- run: pytest tools/pr-approval-agent -v --junitxml=junit-pr-approval-agent.xml+ # Two candidate paths. The engine now lives under the stamphog product, but an+ # open PR that has not rebased still carries it under tools/, and this workflow+ # runs against that branch merged with master. The loop tests both trees when+ # both exist, because that merge can add a file at the old path next to the new+ # tree.+ run: |+ found=0+ for dir in products/stamphog/packages/pr-approval-agent tools/pr-approval-agent; do+ [ -d "$dir" ] || continue+ found=1+ pytest "$dir" -v --junitxml="junit-pr-approval-agent-$(echo "$dir" | tr / -).xml"+ done+ if [ "$found" = "0" ]; then+ echo "::error::pr-approval-agent engine not found at either path"+ exit 1+ fi- name: Run dependency detection script testsshell: bash@@ -225,7 +241,7 @@ jobs:junit-hogli-commands.xmljunit-owners.xmljunit-query-performance-ai.xml- junit-pr-approval-agent.xml+ junit-pr-approval-agent-*.xml- name: Upload test results for dependency detectionuses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0diff --git a/.semgrep/rules/devex/prefer-frozen-dataclasses.yaml b/.semgrep/rules/devex/prefer-frozen-dataclasses.yamlindex 70dbf3dccc53..0a33ff60042a 100644--- a/.semgrep/rules/devex/prefer-frozen-dataclasses.yaml+++ b/.semgrep/rules/devex/prefer-frozen-dataclasses.yaml@@ -31,6 +31,10 @@ rules:exclude:- '**/migrations/**'- '**/.semgrep/**'+ # Standalone PEP 723 script bundle. Other repos vendor it, and it runs from a+ # sandbox checkout. It cannot import posthog.dataclasses, so the house decorator that+ # this rule points at is unavailable to it.+ - '**/packages/pr-approval-agent/**'patterns:- pattern-either:# Bare @dataclass is ambiguous: skip it when pydantic's decoratordiff --git a/.stamphog/README.md b/.stamphog/README.mdindex 11ad874373c1..5e9fc8798c3b 100644--- a/.stamphog/README.md+++ b/.stamphog/README.md@@ -1,8 +1,8 @@# .stamphog-Declarative policy for the stamphog PR-approval merge gate (`tools/pr-approval-agent/`).+Declarative policy for the stamphog PR-approval merge gate (`products/stamphog/packages/pr-approval-agent/`).The engine loads these files from the checked-out working tree at run time.-Engine and policy are vendored into other repos (see the note in `tools/pr-approval-agent/README.md`), so format changes here need those copies re-synced too.+Engine and policy are vendored into other repos (see the note in the engine's README), so format changes here need those copies re-synced too.## What lives here@@ -12,7 +12,7 @@ Engine and policy are vendored into other repos (see the note in `tools/pr-appro## Proposing a policy changeOpen a PR that edits these files.-Stamphog can never auto-approve it: the `stamphog_policy` deny category matches `.stamphog/**`, any `AGENT_APPROVALS.md`, and `tools/pr-approval-agent/**`, so every change to the gate's own policy or engine routes to a human reviewer.+Stamphog can never auto-approve it: the `stamphog_policy` deny category matches `.stamphog/**`, any `AGENT_APPROVALS.md`, and any `pr-approval-agent/**`, so every change to the gate's own policy or engine routes to a human reviewer.The loader also hard-fails if that self-governance entry is ever missing, so it cannot be dropped silently.## Per-folder overrides (`AGENT_APPROVALS.md`)diff --git a/.stamphog/policy.yml b/.stamphog/policy.ymlindex ea1cd1efa2ea..ce32dd7c9dcc 100644--- a/.stamphog/policy.yml+++ b/.stamphog/policy.yml@@ -122,6 +122,10 @@ deny:paths:- '\.stamphog/'- 'AGENT_APPROVALS\.md'+ - 'pr-approval-agent/'+ # Kept next to the location-agnostic pattern above. The engine that+ # validates this file ships in the server image, so a deploy that still+ # runs the previous engine needs this exact literal.- 'tools/pr-approval-agent/'- 'products/stamphog/backend/logic/policy_defaults/'- 'tools/owners/'diff --git a/Dockerfile b/Dockerfileindex acd503535d13..4eb1c51c488c 100644--- a/Dockerfile+++ b/Dockerfile@@ -445,11 +445,11 @@ COPY --chown=posthog:posthog common/migration_utils common/migration_utils/COPY --chown=posthog:posthog products products/# Stamphog ships the review engine + owners resolver from this checkout into its sandbox at# runtime (products/stamphog/backend/temporal/activities.py), so both must exist in the image as-# source. This is separate from posthog-owners being installed into the venv as a library: the-# sandbox gets files copied into a checkout, not an import.-COPY --chown=posthog:posthog tools/pr-approval-agent tools/pr-approval-agent/+# source. The engine arrives with products/ above, and only tools/owners needs its own COPY. This+# differs from the installation of posthog-owners into the venv as a library: the sandbox receives+# files copied into a checkout, and not an import.COPY --chown=posthog:posthog tools/owners tools/owners/-RUN test -f tools/pr-approval-agent/review_local.py && test -d tools/owners/posthog_owners+RUN test -f products/stamphog/packages/pr-approval-agent/review_local.py && test -d tools/owners/posthog_owners# Generated MCP tool catalog, read at runtime from BASE_DIR by the OAuth consent page# (posthog/api/oauth/mcp_resource_scopes.py) and the tasks permission broker. The rest of# services/ is a Node build (Dockerfile.node) and deliberately stays out of this image.diff --git a/docs/internal/monorepo-layout.md b/docs/internal/monorepo-layout.mdindex 6b962a79696b..fc660b517203 100644--- a/docs/internal/monorepo-layout.md+++ b/docs/internal/monorepo-layout.md@@ -33,22 +33,25 @@ packages/ # Libraries shared across more than one product/service (common/ # Shared code — holding pen, NOT a destination (goal: shrink it)hogql_parser/ # HogQL parser-tools/ # Developer/CI tooling, with two exceptions noted below+tools/ # Developer/CI tooling, with one exception noted belowhogli/ # Developer CLI framework (PyPI-publishable; uv workspace member)hogli-commands/ # PostHog-specific hogli commands (consumed via hogli.yaml)owners/ # owners.yaml resolver (posthog_owners) — also a RUNTIME dependency- pr-approval-agent/ # stamphog's review engine — shipped into the review sandbox at runtimedevenv/ # Developer environment config (intent map, process model)```-`tools/` is developer and CI tooling by default, and two directories in it are not. `tools/owners`-is installed into the production venv, because stamphog's digest resolves a team's Slack channel-through `posthog_owners` rather than reparsing `owners.yaml` itself. `tools/pr-approval-agent` and-`tools/owners` are also copied into the production image as source, because stamphog ships them-into its review sandbox at runtime. Both stay under `tools/` rather than moving to `packages/`:-downstream repos vendor `pr-approval-agent` with `owners` beside it, and `posthog_owners` is-imported from that sibling path, so the layout is a contract, not an accident.+`tools/` is developer and CI tooling by default, and one directory in it is not. `tools/owners` is+installed into the production venv, because stamphog's digest resolves a team's Slack channel through+`posthog_owners` rather than reparsing `owners.yaml` itself. It is also copied into the production+image as source, alongside stamphog's review engine at+`products/stamphog/packages/pr-approval-agent/`, because stamphog ships both into its review sandbox+at runtime.++Inside that sandbox the engine is written to `<checkout>/tools/pr-approval-agent` with `tools/owners`+beside it, and that placement is a contract rather than a leftover: the engine finds its repo root by+walking up from its own file, so the path decides which policy it reads, and downstream repos vendor+the two directories in exactly that arrangement.### Productsdiff --git a/docs/internal/ownership-model-proposal.md b/docs/internal/ownership-model-proposal.mdindex fe7786559c37..3d20cb231740 100644--- a/docs/internal/ownership-model-proposal.md+++ b/docs/internal/ownership-model-proposal.md@@ -48,7 +48,7 @@ Two data sources, one shared matcher, four consumers — all hand-maintained.| `.github/scripts/assign-reviewers.js` (CI auto-assign) | soft + product.yaml | vendored matcher + own YAML mini-parser || `hogli product:lint:owners` | product.yaml | own loader (`product_yaml.py`), validates slugs against live GitHub teams || `.agents/skills/establishing-code-ownership/ownership.js` | hard + soft + product.yaml | vendored matcher + own YAML mini-parser |-| `tools/pr-approval-agent/gates.py` | soft only | fully independent reimplementation |+| `products/stamphog/packages/pr-approval-agent/gates.py` | soft only | fully independent reimplementation |The vendored matcher is `.github/scripts/codeowners.js` (a port of `hmarr/codeowners`, faithful to GitHub semantics).diff --git a/owners.yaml b/owners.yamlindex 9c93e447720c..c5d2827d6276 100644--- a/owners.yaml+++ b/owners.yaml@@ -103,7 +103,8 @@ rules:- '/tools/hogli/'- '/tools/owners/'- '/tools/phrocs/'- - '/tools/pr-approval-agent/'+ owners: team-devex+ - match: '/products/stamphog/packages/pr-approval-agent/'owners: team-devex- match: '/tools/query-performance-ai/'owners: team-analytics-platformdiff --git a/posthog/test/repo_invariants/dataclass_frozen_baseline.txt b/posthog/test/repo_invariants/dataclass_frozen_baseline.txtindex 0cba2211b572..99982e880fbb 100644--- a/posthog/test/repo_invariants/dataclass_frozen_baseline.txt+++ b/posthog/test/repo_invariants/dataclass_frozen_baseline.txt@@ -191,6 +191,9 @@1 products/slack_app/backend/tests/services/test_slack_app_home.py1 products/stamphog/backend/tests/conftest.py1 products/stamphog/backend/tests/fakes.py+1 products/stamphog/packages/pr-approval-agent/familiarity.py+1 products/stamphog/packages/pr-approval-agent/github.py+1 products/stamphog/packages/pr-approval-agent/review_pr.py1 products/streamlit_apps/backend/logic/zip_validator.py1 products/surveys/backend/summarization/llm/gemini.py1 products/tasks/backend/logic/services/agent_command.pydiff --git a/products/stamphog/AGENTS.md b/products/stamphog/AGENTS.mdindex cc019145ffeb..aae21f50bdd6 100644--- a/products/stamphog/AGENTS.md+++ b/products/stamphog/AGENTS.md@@ -179,7 +179,7 @@ narrow:in reviewer prompts and error messages persisted to API-readable fields (`run.error` keeps onlya truncated first line for exactly this reason).-## Engine parity (tools/pr-approval-agent)+## Engine parity (packages/pr-approval-agent)`review_local.py` is the entrypoint the sandbox runs. It drives `review_pr.Pipeline`'s own steps, sogate order, review filtering (bare COMMENTED reviews dropped, non-empty ones kept), in-flight@@ -210,6 +210,6 @@ answers False for every PR it exists to catch.## Tests`hogli test products/stamphog/backend/tests/` (Django; `--reuse-db` after the first run) plus-`tools/pr-approval-agent/` tests for engine changes. The integration tests drive the full chain+`packages/pr-approval-agent/` tests for engine changes. The integration tests drive the full chainthrough fakes (`tests/fakes.py`, `tests/conftest.py`) — extend the fakes rather than mockinginternals, and prefer adding a parameterized case to an existing test over a new function.diff --git a/products/stamphog/README.md b/products/stamphog/README.mdindex 3851bb5ad638..6093effa77ec 100644--- a/products/stamphog/README.md+++ b/products/stamphog/README.md@@ -4,7 +4,7 @@ Approve-first PR review: an LLM reviewer that runs deterministic gates plus a sc## The engine-The review engine lives in [`tools/pr-approval-agent/`](../../tools/pr-approval-agent/).+The review engine lives in [`packages/pr-approval-agent/`](packages/pr-approval-agent/).A GitHub App delivers webhooks here, and reviews run in an isolated Modal sandbox with per-run minted credentials: `review_local.py` consumes a pre-fetched context, with no GitHub token inside the sandbox.`review_pr.py` in the same directory is the manual entrypoint for reviewing a PR from your own checkout, which fetches over the network instead.diff --git a/products/stamphog/backend/logic/digest_config.py b/products/stamphog/backend/logic/digest_config.pyindex 54f0e151876e..0e225a972fa4 100644--- a/products/stamphog/backend/logic/digest_config.py+++ b/products/stamphog/backend/logic/digest_config.py@@ -3,7 +3,7 @@ channel for ALL of a repo's merged-PR digests, if the repo owner wants to opt ouaudience cascade.Read from the target repo's DEFAULT branch only (never the PR head), same master-read-security model as the sandboxed review engine's policy pipeline (tools/pr-approval-agent/+security model as the sandboxed review engine's policy pipeline (products/stamphog/packages/pr-approval-agent/policy.py) — a PR must not be able to redirect its own digest.Only the top-level `digest` key is read here; the rest of the policy schema is thatengine's concern and is neither parsed nor validated.diff --git a/products/stamphog/backend/logic/policy_defaults/policy.yml b/products/stamphog/backend/logic/policy_defaults/policy.ymlindex d921010daa72..0163ae4fe67d 100644--- a/products/stamphog/backend/logic/policy_defaults/policy.yml+++ b/products/stamphog/backend/logic/policy_defaults/policy.yml@@ -122,6 +122,10 @@ deny:paths:- '\.stamphog/'- 'AGENT_APPROVALS\.md'+ - 'pr-approval-agent/'+ # Kept next to the location-agnostic pattern above. The engine that+ # validates this file ships in the server image, so a deploy that still+ # runs the previous engine needs this exact literal.- 'tools/pr-approval-agent/'- 'CODEOWNERS'allow:diff --git a/products/stamphog/backend/logic/reviewer.py b/products/stamphog/backend/logic/reviewer.pyindex a0d3f27742af..3c59e14db7ec 100644--- a/products/stamphog/backend/logic/reviewer.py+++ b/products/stamphog/backend/logic/reviewer.py@@ -1,16 +1,17 @@"""Sandbox reviewer invocation + output parsing.-The whole review engine — hard gates, tier classification, git-blame-familiarity, and the LLM reviewer — now runs inside the sandbox via the Action's-own modules (``tools/pr-approval-agent/review_local.py``). This module no longer-embeds a reviewer script; it only:+The whole review engine (hard gates, tier classification, git-blame+familiarity, and the LLM reviewer) runs inside the sandbox via the engine's own+modules (``products/stamphog/packages/pr-approval-agent/review_local.py``). This+module no longer embeds a reviewer script. It only does two things:- ``build_reviewer_invocation``: assembles the ``--context`` JSON payload thesandbox entrypoint consumes (PR metadata, changed files, the author's merged-PRnumbers, base/head shas) and the ``uv run`` command to execute it.-- ``parse_reviewer_output``: turns the entrypoint's last stdout JSON line — the- Action's full ``to_dict()`` contract — into a verdict, defensively. A run we- can't read is never an approval: malformed output escalates.+- ``parse_reviewer_output``: turns the entrypoint's last stdout JSON line, which+ is the engine's full ``to_dict()`` contract, into a verdict. It parses+ defensively, because a run that the server cannot read is never an approval.+ Malformed output escalates.The trusted review-norms prose and gate policy are NOT passed here — the serveroverwrites ``.stamphog/policy.yml`` and ``.stamphog/review-guidance.md`` in the@@ -50,7 +51,7 @@ _LEGACY_VERDICT_MAP = {}-# Mirrors the engine's VERDICT_SCHEMA cap (tools/pr-approval-agent/reviewer.py) and the+# Mirrors the engine's VERDICT_SCHEMA cap (products/stamphog/packages/pr-approval-agent/reviewer.py) and the# stamphog_reviewrun column width.CHANGE_SUMMARY_MAX_CHARS = 200diff --git a/products/stamphog/backend/temporal/activities.py b/products/stamphog/backend/temporal/activities.pyindex 3fcfdc2b4a63..73b4ee63a107 100644--- a/products/stamphog/backend/temporal/activities.py+++ b/products/stamphog/backend/temporal/activities.py@@ -6,11 +6,12 @@ policy files, raw reviewer output) is persisted on ``ReviewRun.output`` betweenrather than threaded through the workflow, keeping every Temporal payload well under the~2 MiB limit.-The whole review engine — hard gates, tier classification, git-blame familiarity, and-the LLM reviewer — runs inside the sandbox via the Action's own modules-(``tools/pr-approval-agent/review_local.py``). The server never processes repo content:-it fetches PR data and the trusted default-branch policy over the API, ships the engine-and injects the policy into the sandbox, and only ever reads back a single verdict JSON.+The whole review engine (hard gates, tier classification, git-blame familiarity, and+the LLM reviewer) runs inside the sandbox via the engine's own modules+(``products/stamphog/packages/pr-approval-agent/review_local.py``). The server never+processes repo content. It fetches PR data and the trusted default-branch policy over+the API, ships the engine and injects the policy into the sandbox, and reads back only a+single verdict JSON."""from __future__ import annotations@@ -69,11 +70,11 @@ from products.tasks.backend.facade.sandbox import (get_sandbox_class_for_backend,)-# The Action's review engine on the server's own checkout. Read as data files at-# runtime (never imported — the directory is hyphenated and lives outside the-# import graph) and shipped into the sandbox checkout. activities.py is at-# products/stamphog/backend/temporal/activities.py, so the repo root is five parents up.-_SERVER_ENGINE_DIR = Path(__file__).resolve().parents[4] / "tools" / "pr-approval-agent"+# The review engine on the server's own checkout. The server reads these as data files at runtime+# and ships them into the sandbox checkout. It never imports them, because the directory is+# hyphenated and sits outside the import graph. activities.py is at+# products/stamphog/backend/temporal/activities.py, so the product root is three parents up.+_SERVER_ENGINE_DIR = Path(__file__).resolve().parents[2] / "packages" / "pr-approval-agent"# Server-shipped default policy files, the base layer every repo's config sits on. Named by the# basename of each STAMPHOG_POLICY_PATHS entry (policy.yml / review-guidance.md): a repo with no@@ -1160,11 +1161,14 @@ def _ship_owners_package(sandbox: SandboxBase) -> None:"""Ship the posthog-owners resolver package the engine's ownership format imports.The default policy declares a ``hogli-resolver`` ownership source, and gates.py imports- ``posthog_owners`` from ``tools/owners`` next to the engine dir. Same trust posture as the- engine: always our copy, wiping whatever the PR head carried at that path. Repos without+ ``posthog_owners`` from ``tools/owners`` next to the engine dir in the sandbox. Same trust+ posture as the engine: always our copy, which overwrites whatever the PR head carried at that+ path. Repos withoutowners.yaml/product.yaml files simply resolve to "no ownership-source match"."""- package_dir = _SERVER_ENGINE_DIR.parent / "owners" / "posthog_owners"+ # Repo root rather than a sibling of the engine. posthog_owners is a shared tool, so it stays+ # under tools/ while the engine lives in the product.+ package_dir = Path(__file__).resolve().parents[4] / "tools" / "owners" / "posthog_owners"if not package_dir.is_dir():raise RuntimeError(f"owners package source dir not found: {package_dir}")target = f"{STAMPHOG_SANDBOX_OWNERS_DIR}/posthog_owners"diff --git a/products/stamphog/backend/temporal/constants.py b/products/stamphog/backend/temporal/constants.pyindex 157f687dd453..d44eaac26ffb 100644--- a/products/stamphog/backend/temporal/constants.py+++ b/products/stamphog/backend/temporal/constants.py@@ -23,7 +23,7 @@ STAMPHOG_SANDBOX_ENGINE_DIR = f"{STAMPHOG_SANDBOX_REPO_DIR}/tools/pr-approval-ag# Reviewer bots whose 👀 reaction means "review in flight" — the hosted workflow waits these out# server-side before provisioning the sandbox (the sandbox holds no token to poll with). Mirrors the-# engine's TRUSTED_REACTOR_BOTS (tools/pr-approval-agent/github.py) and its wait timings+# engine's TRUSTED_REACTOR_BOTS (products/stamphog/packages/pr-approval-agent/github.py) and its wait timings# (review_pr.py); the server cannot import the hyphenated engine dir, so keep the two in sync.STAMPHOG_TRUSTED_REACTOR_BOTS = frozenset({diff --git a/products/stamphog/backend/tests/test_logic.py b/products/stamphog/backend/tests/test_logic.pyindex 97fb655eaf0d..825cac6a7e20 100644--- a/products/stamphog/backend/tests/test_logic.py+++ b/products/stamphog/backend/tests/test_logic.py@@ -28,10 +28,10 @@ from products.stamphog.backend.temporal.registry import ACTIVITIESfrom products.stamphog.backend.tests import fakesfrom products.stamphog.backend.tests.conftest import _generate_app_private_key-# The gate/policy engine now lives in tools/pr-approval-agent and is covered by its-# own suite (test_gates.py, test_policy.py); it runs inside the sandbox rather than-# server-side, so there is no ported copy to test here. What remains server-side is-# the defensive parsing of the engine's stdout contract.+# The gate/policy engine lives in packages/pr-approval-agent, and its own suite covers it+# (test_gates.py, test_policy.py). It runs inside the sandbox rather than server-side, so there is+# no ported copy to test here. Only the defensive parsing of the engine's stdout contract remains+# server-side.class ParseReviewerOutputTests(SimpleTestCase):diff --git a/products/stamphog/backend/tests/test_policy_defaults.py b/products/stamphog/backend/tests/test_policy_defaults.pyindex c8c276e3abf6..03b6fb1adf38 100644--- a/products/stamphog/backend/tests/test_policy_defaults.py+++ b/products/stamphog/backend/tests/test_policy_defaults.py@@ -5,9 +5,10 @@ import pytestimport yaml-# The review engine (tools/pr-approval-agent) is a set of plain modules, not an importable package, so-# its directory must be on sys.path to import its policy loader by bare name — same way its own tests do.-_ENGINE_DIR = Path(__file__).resolve().parents[4] / "tools" / "pr-approval-agent"+# The review engine (packages/pr-approval-agent) is a set of plain modules, and not an importable+# package, so its directory must be on sys.path to import its policy loader by bare name. Its own+# tests do the same.+_ENGINE_DIR = Path(__file__).resolve().parents[2] / "packages" / "pr-approval-agent"sys.path.insert(0, str(_ENGINE_DIR))import gates # noqa: E402diff --git a/tools/pr-approval-agent/README.md b/products/stamphog/packages/pr-approval-agent/README.mdsimilarity index 95%rename from tools/pr-approval-agent/README.mdrename to products/stamphog/packages/pr-approval-agent/README.mdindex 9195e5caed69..077e38ebcb64 100644--- a/tools/pr-approval-agent/README.md+++ b/products/stamphog/packages/pr-approval-agent/README.md@@ -4,7 +4,7 @@ AI-assisted PR approval for PostHog.Deterministic safety gates first, then Claude reviews for showstoppers.> [!NOTE]-> This directory (together with `.stamphog/`) is vendored into other repos — e.g. [MLHog](https://github.com/PostHog/MLHog/tree/master/tools/pr-approval-agent) — each documenting its intentional local changes in its own copy of this README. When you change the engine or policy format here, those copies stay stale until someone re-syncs them, so give the owning teams a heads-up (or re-sync yourself: diff, re-copy, re-apply their documented local changes).+> This directory (together with `.stamphog/`) is vendored into other repos — e.g. [MLHog](https://github.com/PostHog/MLHog/tree/master/tools/pr-approval-agent) — each documenting its intentional local changes in its own copy of this README. Vendored copies live at `tools/pr-approval-agent/` with `tools/owners` beside them, which is also where this repo's review sandbox writes the engine; only the source of truth sits here. When you change the engine or policy format here, those copies stay stale until someone re-syncs them, so give the owning teams a heads-up (or re-sync yourself: diff, re-copy, re-apply their documented local changes).> A policy that declares a `hogli-resolver` ownership source additionally needs the sibling `tools/owners` package vendored.> The legacy `gh-codeowners` / `ph-product` ownership formats were removed together with the `CODEOWNERS-soft` migration, so a vendored copy whose policy still declares them must migrate to `hogli-resolver` (adopting `owners.yaml` + `tools/owners`) as part of the re-sync — or skip the re-sync and keep its previous engine until it's ready. The policy loader rejects unknown formats loudly at startup, so a missed migration fails closed rather than silently skipping the ownership source.@@ -30,16 +30,16 @@ the next push retries automatically.```bash# run from anywhere inside the posthog repo-uv run tools/pr-approval-agent/review_pr.py 46594+uv run products/stamphog/packages/pr-approval-agent/review_pr.py 46594# dry run (gates only, no LLM calls)-uv run tools/pr-approval-agent/review_pr.py 46594 --dry-run+uv run products/stamphog/packages/pr-approval-agent/review_pr.py 46594 --dry-run# save full result as JSON-uv run tools/pr-approval-agent/review_pr.py 46594 --output-json /tmp/review.json+uv run products/stamphog/packages/pr-approval-agent/review_pr.py 46594 --output-json /tmp/review.json# verbose (show agent tool calls)-uv run tools/pr-approval-agent/review_pr.py 46594 -v+uv run products/stamphog/packages/pr-approval-agent/review_pr.py 46594 -v````review_pr.py` is the manual entrypoint: it fetches everything over the network with `gh` and reviews a PR from your own checkout.@@ -232,7 +232,7 @@ are exempt from the **auth** and **billing** categories — connector codelegitimately does OAuth and talks to the Stripe API without touchingPostHog's auth system or its billing.-The **migrations** deny-list is bypassed when the `Migration risk` check on the head commit concludes `success` (all migrations classified Safe). The check is published by `analyze_migration_risk` in `ci-backend.yml` and is the same signal humans see in the PR's Checks tab. See `tools/pr-approval-agent/migration_risk.py` for how stamphog reads it.+The **migrations** deny-list is bypassed when the `Migration risk` check on the head commit concludes `success` (all migrations classified Safe). The check is published by `analyze_migration_risk` in `ci-backend.yml` and is the same signal humans see in the PR's Checks tab. See `migration_risk.py` for how stamphog reads it.If the check hasn't reported yet when stamphog runs, the hosted runtime returns `WAIT` rather than a verdict: the deny-list only matched because the engine could not tell a safe migration from a risky one, and a refusal would hand the PR to ReviewHog and strip the trigger label over a race with CI. The label is kept and the next push reviews against the now-classified head commit.diff --git a/tools/pr-approval-agent/familiarity.py b/products/stamphog/packages/pr-approval-agent/familiarity.pysimilarity index 100%rename from tools/pr-approval-agent/familiarity.pyrename to products/stamphog/packages/pr-approval-agent/familiarity.pydiff --git a/tools/pr-approval-agent/gates.py b/products/stamphog/packages/pr-approval-agent/gates.pysimilarity index 92%rename from tools/pr-approval-agent/gates.pyrename to products/stamphog/packages/pr-approval-agent/gates.pyindex ba249428ce29..35388c404857 100644--- a/tools/pr-approval-agent/gates.py+++ b/products/stamphog/packages/pr-approval-agent/gates.py@@ -22,14 +22,28 @@ from policy import OwnershipSource, load_policyif TYPE_CHECKING:from posthog_owners.resolver import OwnersResolver-# The resolver lives in the posthog-owners package, a sibling under tools/. It is-# not installed in this script's uv env, so it is put on the path and imported as-# a library (it needs only pyyaml, which review_pr.py declares). The import is-# deferred to _build_hogli_resolver: downstream repos vendor this directory-# (plus .stamphog/) without tools/owners, and a module-level import would-# disable their stamphog copy before any gate runs — the package is only-# required once a policy actually declares a hogli-resolver ownership source.-_OWNERS_PKG = Path(__file__).resolve().parents[1] / "owners"+# The resolver lives in the posthog-owners package. This script's uv env does not install it, so the+# code puts it on the path and imports it as a library. It needs only pyyaml, which review_pr.py+# declares. _build_hogli_resolver defers the import, because downstream repos vendor this directory+# (plus .stamphog/) without tools/owners. A module-level import would disable their stamphog copy+# before any gate runs. The package is only necessary once a policy declares a hogli-resolver+# ownership source.+#+# There are two candidate locations, and the code puts only the FIRST one that exists on the path.+# The sibling `owners/` covers two cases: the vendored layout that downstream repos copy, and the+# review sandbox, which receives this directory at <checkout>/tools/pr-approval-agent with+# tools/owners beside it. The sandbox therefore never reaches the second entry. The second entry+# covers a run from this repo, where the engine's own home is under products/stamphog/packages/.+#+# Both entries are fixed offsets from this file, and not a discovered repo root.+# `policy.repo_root()` walks up to find a `.stamphog/` directory, and the PR head is untrusted. A PR+# that adds `tools/.stamphog/` would move that root and point this code at a directory that the PR+# controls. The sandbox would then import that directory, and the sandbox holds the run's LLM+# credentials.+_OWNERS_PKG_CANDIDATES = (+ Path(__file__).resolve().parents[1] / "owners",+ Path(__file__).resolve().parents[4] / "tools" / "owners",+)# ── Dependency ecosystems ────────────────────────────────────────#@@ -186,16 +200,20 @@ class _HogliResolver:def _build_hogli_resolver(repo_root: Path, source: OwnershipSource) -> _HogliResolver:- if str(_OWNERS_PKG) not in sys.path:- sys.path.insert(0, str(_OWNERS_PKG))+ for candidate in _OWNERS_PKG_CANDIDATES:+ if not candidate.is_dir():+ continue+ if str(candidate) not in sys.path:+ sys.path.insert(0, str(candidate))+ breaktry:- from posthog_owners.resolver import (- OwnersResolver, # noqa: PLC0415 — absent in vendored copies; needed only for this format- )+ # Deferred (PLC0415) because the package is absent in vendored copies and is needed only+ # once a policy declares this ownership format.+ from posthog_owners.resolver import OwnersResolver # noqa: PLC0415except ImportError as exc:raise RuntimeError("ownership format 'hogli-resolver' requires the posthog-owners package: "- "vendor tools/owners alongside tools/pr-approval-agent, or drop the "+ "vendor tools/owners alongside this directory, or drop the ""hogli-resolver source from .stamphog/policy.yml") from excassert source.path is not None # validated by the loader (hogli-resolver uses `path`)diff --git a/tools/pr-approval-agent/gateway.py b/products/stamphog/packages/pr-approval-agent/gateway.pysimilarity index 100%rename from tools/pr-approval-agent/gateway.pyrename to products/stamphog/packages/pr-approval-agent/gateway.pydiff --git a/tools/pr-approval-agent/github.py b/products/stamphog/packages/pr-approval-agent/github.pysimilarity index 100%rename from tools/pr-approval-agent/github.pyrename to products/stamphog/packages/pr-approval-agent/github.pydiff --git a/tools/pr-approval-agent/manifest_risk.py b/products/stamphog/packages/pr-approval-agent/manifest_risk.pysimilarity index 100%rename from tools/pr-approval-agent/manifest_risk.pyrename to products/stamphog/packages/pr-approval-agent/manifest_risk.pydiff --git a/tools/pr-approval-agent/migration_risk.py b/products/stamphog/packages/pr-approval-agent/migration_risk.pysimilarity index 100%rename from tools/pr-approval-agent/migration_risk.pyrename to products/stamphog/packages/pr-approval-agent/migration_risk.pydiff --git a/tools/pr-approval-agent/policy.py b/products/stamphog/packages/pr-approval-agent/policy.pysimilarity index 99%rename from tools/pr-approval-agent/policy.pyrename to products/stamphog/packages/pr-approval-agent/policy.pyindex fa9d947a86a4..da69c0749819 100644--- a/tools/pr-approval-agent/policy.py+++ b/products/stamphog/packages/pr-approval-agent/policy.py@@ -235,7 +235,9 @@ _DELEGABLE_KEYS = {"size_gate.max_files"}# Invariant 7: self-governance deny must cover these path families so a future# policy edit cannot silently drop stamphog's protection of its own files.-_SELF_GOVERNANCE_REQUIRED = (".stamphog/", "AGENT_APPROVALS", "tools/pr-approval-agent/")+# The engine token is location-agnostic on purpose: this repo keeps the engine under the stamphog+# product while vendored copies keep it under tools/, and both must stay self-governed.+_SELF_GOVERNANCE_REQUIRED = (".stamphog/", "AGENT_APPROVALS", "pr-approval-agent/")def _require(condition: bool, message: str) -> None:diff --git a/tools/pr-approval-agent/review_local.py b/products/stamphog/packages/pr-approval-agent/review_local.pysimilarity index 100%rename from tools/pr-approval-agent/review_local.pyrename to products/stamphog/packages/pr-approval-agent/review_local.pydiff --git a/tools/pr-approval-agent/review_pr.py b/products/stamphog/packages/pr-approval-agent/review_pr.pysimilarity index 99%rename from tools/pr-approval-agent/review_pr.pyrename to products/stamphog/packages/pr-approval-agent/review_pr.pyindex 9b8736eee66d..d095eb6b4a40 100644--- a/tools/pr-approval-agent/review_pr.py+++ b/products/stamphog/packages/pr-approval-agent/review_pr.py@@ -12,7 +12,7 @@"""AI-assisted PR approval agent.Usage:- uv run tools/pr-approval-agent/review_pr.py <pr_number> [--dry-run] [--output-json path]+ uv run products/stamphog/packages/pr-approval-agent/review_pr.py <pr_number> [--dry-run] [--output-json path]Runs deterministic gates (deny-list, ownership, tier classification),then — if eligible — calls Claude for evidence-bundle review and@@ -28,6 +28,7 @@ import uuidimport argparseimport tempfileimport subprocess+from collections.abc import Iteratorfrom contextlib import contextmanagerfrom dataclasses import dataclass, fieldfrom datetime import UTC, datetime@@ -208,7 +209,7 @@ class Pipeline:verbose: bool = False,self_driving: bool = False,head_checkout: bool = False,- ):+ ) -> None:self.pr_number = pr_numberself.repo = repoself.dry_run = dry_run@@ -735,7 +736,7 @@ class Pipeline:return links@contextmanager- def _pr_head_worktree(self):+ def _pr_head_worktree(self) -> Iterator[Path | None]:"""Yield a detached worktree at the PR head, or None when none is needed.Only stacked PRs reviewed from a trunk checkout need this: their headdiff --git a/tools/pr-approval-agent/reviewer.py b/products/stamphog/packages/pr-approval-agent/reviewer.pysimilarity index 99%rename from tools/pr-approval-agent/reviewer.pyrename to products/stamphog/packages/pr-approval-agent/reviewer.pyindex 586bb9ae4096..b48485891930 100644--- a/tools/pr-approval-agent/reviewer.py+++ b/products/stamphog/packages/pr-approval-agent/reviewer.py@@ -10,7 +10,9 @@ import jsonimport shutilimport asyncioimport textwrap+from collections.abc import Callablefrom pathlib import Path+from typing import Anyfrom claude_agent_sdk import ClaudeAgentOptions, ResultMessage, queryfrom claude_agent_sdk.types import AssistantMessage, ToolUseBlock@@ -290,7 +292,7 @@ _REVIEWER_SCAFFOLD_TAIL = "\n" + textwrap.dedent(REVIEWER_SYSTEM = _load_review_guidance() + _REVIEWER_SCAFFOLD_TAIL-def _apply_gateway_route(gateway: tuple[str, str] | None, attribution: dict[str, object]):+def _apply_gateway_route(gateway: tuple[str, str] | None, attribution: dict[str, object]) -> Callable[..., Any] | None:"""Apply the gateway env and return the plain SDK ``query`` when configured, else None."""if gateway is None:return None@@ -302,7 +304,7 @@ def _apply_gateway_route(gateway: tuple[str, str] | None, attribution: dict[str,class Reviewer:"""LLM reviewer using Agent SDK."""- def __init__(self, repo_root: Path, *, explore_root: Path | None = None, verbose: bool = False):+ def __init__(self, repo_root: Path, *, explore_root: Path | None = None, verbose: bool = False) -> None:self.repo_root = repo_root# Where the agent's Read/Grep/Glob look. For stacked PRs this is a# worktree at the PR head so imports from not-yet-merged parent PRsdiff --git a/tools/pr-approval-agent/test_familiarity.py b/products/stamphog/packages/pr-approval-agent/test_familiarity.pysimilarity index 100%rename from tools/pr-approval-agent/test_familiarity.pyrename to products/stamphog/packages/pr-approval-agent/test_familiarity.pydiff --git a/tools/pr-approval-agent/test_gates.py b/products/stamphog/packages/pr-approval-agent/test_gates.pysimilarity index 96%rename from tools/pr-approval-agent/test_gates.pyrename to products/stamphog/packages/pr-approval-agent/test_gates.pyindex f2662636aa69..00deb61c62b1 100644--- a/tools/pr-approval-agent/test_gates.py+++ b/products/stamphog/packages/pr-approval-agent/test_gates.py@@ -4,6 +4,7 @@ from pathlib import Pathimport pytest+import gatesfrom gates import (DEPENDENCY_ECOSYSTEMS,build_ownership,@@ -553,3 +554,13 @@ def test_ownership_cross_team_and_unowned(tmp_path: Path) -> None:outside = detect_ownership(["posthog/models/x.py"], resolvers)assert outside["teams"] == []assert outside["unowned_files"] == 1+++def test_owners_candidates_are_fixed_offsets_from_this_file() -> None:+ # policy.repo_root() walks up to find a .stamphog/ directory, and the PR head is untrusted. A PR+ # that adds tools/.stamphog/ would move that root and aim the lookup at a directory that the PR+ # controls. The sandbox would then import that directory, and the sandbox holds the run's LLM+ # credentials. Both candidates must stay fixed offsets from the engine's own file.+ engine_dir = Path(gates.__file__).resolve().parent+ assert gates._OWNERS_PKG_CANDIDATES[0] == engine_dir.parent / "owners"+ assert gates._OWNERS_PKG_CANDIDATES[1] == engine_dir.parents[3] / "tools" / "owners"diff --git a/tools/pr-approval-agent/test_gateway.py b/products/stamphog/packages/pr-approval-agent/test_gateway.pysimilarity index 100%rename from tools/pr-approval-agent/test_gateway.pyrename to products/stamphog/packages/pr-approval-agent/test_gateway.pydiff --git a/tools/pr-approval-agent/test_github.py b/products/stamphog/packages/pr-approval-agent/test_github.pysimilarity index 100%rename from tools/pr-approval-agent/test_github.pyrename to products/stamphog/packages/pr-approval-agent/test_github.pydiff --git a/tools/pr-approval-agent/test_manifest_risk.py b/products/stamphog/packages/pr-approval-agent/test_manifest_risk.pysimilarity index 98%rename from tools/pr-approval-agent/test_manifest_risk.pyrename to products/stamphog/packages/pr-approval-agent/test_manifest_risk.pyindex 8fa64319d314..81ad152d5d0b 100644--- a/tools/pr-approval-agent/test_manifest_risk.py+++ b/products/stamphog/packages/pr-approval-agent/test_manifest_risk.py@@ -4,7 +4,7 @@ import subprocessimport pytest-from manifest_risk import manifest_change_is_risky+from manifest_risk import manifest_change_is_risky, manifest_script_changesdef _pkg(scripts: str = "", extra: str = "") -> str:@@ -215,8 +215,6 @@ def test_wrapper_anchors_at_merge_base_not_base_tip(tmp_path) -> None:# Regression from review: comparing against the base branch *tip* counts# base-side drift (someone else's scripts change landing on the base) as# this PR's doing and falsely denies a clean manifest edit.- from manifest_risk import manifest_script_changes-def run(*args: str) -> str:result = subprocess.run(["git", *args], capture_output=True, text=True, cwd=tmp_path, check=True)return result.stdout.strip()diff --git a/tools/pr-approval-agent/test_migration_risk.py b/products/stamphog/packages/pr-approval-agent/test_migration_risk.pysimilarity index 100%rename from tools/pr-approval-agent/test_migration_risk.pyrename to products/stamphog/packages/pr-approval-agent/test_migration_risk.pydiff --git a/tools/pr-approval-agent/test_policy.py b/products/stamphog/packages/pr-approval-agent/test_policy.pysimilarity index 98%rename from tools/pr-approval-agent/test_policy.pyrename to products/stamphog/packages/pr-approval-agent/test_policy.pyindex a2368c63a55b..21727bb25d2a 100644--- a/tools/pr-approval-agent/test_policy.py+++ b/products/stamphog/packages/pr-approval-agent/test_policy.py@@ -479,7 +479,13 @@ def test_resolve_invalid_child_rides_parent_grant(fake_repo: Path) -> None:@pytest.mark.parametrize("path",- [".stamphog/policy.yml", "some/AGENT_APPROVALS.md", "tools/pr-approval-agent/review_pr.py"],+ [+ ".stamphog/policy.yml",+ "some/AGENT_APPROVALS.md",+ "products/stamphog/packages/pr-approval-agent/review_pr.py",+ # A vendored copy keeps the engine under tools/, and the same deny must still cover it.+ "tools/pr-approval-agent/review_pr.py",+ ],)def test_policy_file_only_pr_is_t2_never(path: str) -> None:deny = gates.detect_deny_categories([path])diff --git a/tools/pr-approval-agent/test_review_local.py b/products/stamphog/packages/pr-approval-agent/test_review_local.pysimilarity index 100%rename from tools/pr-approval-agent/test_review_local.pyrename to products/stamphog/packages/pr-approval-agent/test_review_local.pydiff --git a/tools/pr-approval-agent/test_review_pr.py b/products/stamphog/packages/pr-approval-agent/test_review_pr.pysimilarity index 100%rename from tools/pr-approval-agent/test_review_pr.pyrename to products/stamphog/packages/pr-approval-agent/test_review_pr.pydiff --git a/tools/pr-approval-agent/test_reviewer.py b/products/stamphog/packages/pr-approval-agent/test_reviewer.pysimilarity index 100%rename from tools/pr-approval-agent/test_reviewer.pyrename to products/stamphog/packages/pr-approval-agent/test_reviewer.pydiff --git a/tools/pr-approval-agent/test_reviewer_gateway.py b/products/stamphog/packages/pr-approval-agent/test_reviewer_gateway.pysimilarity index 100%rename from tools/pr-approval-agent/test_reviewer_gateway.pyrename to products/stamphog/packages/pr-approval-agent/test_reviewer_gateway.pydiff --git a/tools/pr-approval-agent/version.py b/products/stamphog/packages/pr-approval-agent/version.pysimilarity index 100%rename from tools/pr-approval-agent/version.pyrename to products/stamphog/packages/pr-approval-agent/version.pydiff --git a/pyproject.toml b/pyproject.tomlindex 60d9933c6a7d..b53ce11ae089 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -461,7 +461,7 @@ exclude_gitignore = true# (both resolve to top-level module "conftest")# rust/deltalite/python: pytest suite for the maturin-built extension; nothing Django# imports it and it has its own CI (ci-deltalite-python.yml).-exclude = ["^(bin/.*|tools/.*|rust/deltalite/python/.*|products/desktop/.*|products/[^/]+/skills/[^/]+/scripts/.*|gunicorn\\.config\\.py|manage\\.py|conftest\\.py)$"]+exclude = ["^(bin/.*|tools/.*|rust/deltalite/python/.*|products/desktop/.*|products/stamphog/packages/.*|products/[^/]+/skills/[^/]+/scripts/.*|gunicorn\\.config\\.py|manage\\.py|conftest\\.py)$"][[tool.mypy.overrides]]module = "bin.*"diff --git a/pytest.ini b/pytest.iniindex 51e7cc5c6067..aa49b53e045a 100644--- a/pytest.ini+++ b/pytest.ini@@ -18,7 +18,7 @@ junit_family = xunit1# nothing in this repo uses the `faker` fixture or the library (faker is a transitive dep)# -p pytest_boot_gc opens the boot GC window (gc.disable) before pytest-django runs# django.setup(), which happens before conftest files load; the root conftest closes it-addopts = -p no:warnings -p no:tach -p no:langsmith_plugin -p no:faker -p pytest_boot_gc --reuse-db --pytest-durations=0 --ignore=posthog/user_scripts --ignore=services/llm-gateway --ignore=services/stripe-mock --ignore=common/ingestion/acceptance_tests --ignore=tools/hogli --ignore=tools/hogli-commands --ignore=tools/owners --ignore=tools/traffic-sim --ignore=tools/query-performance-ai --ignore=products/desktop+addopts = -p no:warnings -p no:tach -p no:langsmith_plugin -p no:faker -p pytest_boot_gc --reuse-db --pytest-durations=0 --ignore=posthog/user_scripts --ignore=services/llm-gateway --ignore=services/stripe-mock --ignore=common/ingestion/acceptance_tests --ignore=tools/hogli --ignore=tools/hogli-commands --ignore=tools/owners --ignore=tools/traffic-sim --ignore=tools/query-performance-ai --ignore=products/desktop --ignore=products/stamphog/packagesmarkers =eediff --git a/tools/hogli-commands/hogli_commands/product/checks.py b/tools/hogli-commands/hogli_commands/product/checks.pyindex 941b96e35ba4..a787573bb9a0 100644--- a/tools/hogli-commands/hogli_commands/product/checks.py+++ b/tools/hogli-commands/hogli_commands/product/checks.py@@ -1068,6 +1068,10 @@ class OrphanedTestFilesCheck(ProductCheck):"tasks": ("backend/temporal/",),"warehouse_sources": ("backend/temporal/",),"signals": ("backend/emission/",),+ # Covered by the "Run pr-approval-agent (stamphog) tests" step in ci-python.yml. The review+ # engine is a flat script bundle with bare sibling imports, so it runs as its own pytest+ # invocation rather than inside the product's Django suite.+ "stamphog": ("packages/pr-approval-agent/",),}def run(self, ctx: CheckContext) -> CheckResult: