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.

fix(agent-platform): remove agent-builder slack trigger, seed prod from CI (#70584)

Dylan Martin62376086fee0
diff --git a/.github/workflows/cd-agent-builder-seed.yml b/.github/workflows/cd-agent-builder-seed.yml
new file mode 100644
index 000000000000..f647797bc322
--- /dev/null
+++ b/.github/workflows/cd-agent-builder-seed.yml
@@ -0,0 +1,73 @@
+name: Seed agent-builder
+
+# Keeps the canonical Agent Builder deployment in sync with the repo.
+# The agent-builder is deliberately a special snowflake: its bundle source is
+# committed (services/agent-tests/src/examples/agent-builder/) but its runtime
+# behaviour also comes from kernel skills (backend/kernel_skills/) that the
+# freeze step injects from the *deployed* backend. Every seed run re-freezes,
+# so a run always picks up the kernel skills the prod backend currently ships.
+#
+# Two triggers, two jobs to do:
+# - push (path-filtered): bundle edits reach prod as soon as they merge.
+# - schedule (daily): converges kernel-skill changes, which only take effect
+# once the backend deploy carrying them has rolled out — a push-time seed
+# would freeze against the previous backend. The daily run also heals any
+# manual drift in the live deployment.
+#
+# Churn-free: seed.py compares the freshly frozen bundle_sha256 to the live
+# revision's and skips promote when the artifact is byte-identical, so a
+# scheduled run with nothing to converge promotes nothing.
+on:
+ push:
+ branches:
+ - master
+ paths:
+ - products/agent_platform/services/agent-tests/src/examples/agent-builder/**
+ - products/agent_platform/services/agent-tests/src/examples/seed.py
+ - products/agent_platform/backend/kernel_skills/**
+ - .github/workflows/cd-agent-builder-seed.yml
+ schedule:
+ - cron: '17 6 * * *'
+ workflow_dispatch: {}
+
+# Never run two seeds concurrently — each run branches a draft off the live
+# revision and promotes it, so parallel runs would race on the parent.
+concurrency:
+ group: cd-agent-builder-seed
+ cancel-in-progress: false
+
+permissions:
+ contents: read
+
+jobs:
+ seed:
+ name: Seed agent-builder to US prod
+ # Production mutation runs only from the canonical deploy repo
+ # (CD_DEPLOY_ENABLED) and only from master — workflow_dispatch can target
+ # any ref, and an unmerged branch must never run with the prod PAT.
+ if: github.repository_owner == 'PostHog' && vars.CD_DEPLOY_ENABLED == 'true' && github.ref == 'refs/heads/master'
+ runs-on: ubuntu-latest
+ timeout-minutes: 15
+ env:
+ POSTHOG_API: https://us.posthog.com
+ PROJECT_ID: '2'
+ steps:
+ - name: Checkout
+ uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
+ with:
+ sparse-checkout: products/agent_platform/services/agent-tests/src/examples
+ sparse-checkout-cone-mode: false
+
+ - name: Seed the agent-builder bundle
+ env:
+ PAT: ${{ secrets.AGENT_BUILDER_SEED_PAT }}
+ # seed.py is stdlib-only (urllib), no dependency install needed. It
+ # branches a draft off the live revision, pushes the bundle, validates,
+ # freezes (re-injecting current kernel skills), and promotes; the
+ # previously live revision stays archived as the rollback target.
+ run: |
+ if [ -z "$PAT" ]; then
+ echo "::error::AGENT_BUILDER_SEED_PAT secret is not set — the seed cannot run. Prod will drift from the repo until it is."
+ exit 1
+ fi
+ python3 products/agent_platform/services/agent-tests/src/examples/seed.py agent-builder
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.ts
index 5961a156e097..65775c11e30c 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
@@ -79,15 +79,15 @@ describe('example: agent-builder bundle', () => {
}
})
- it('declares chat + mcp + slack triggers (console, MCP, and now Slack)', async () => {
+ it('declares chat + mcp triggers and NO slack trigger', async () => {
const { spec } = await loadBundle()
const parsed = AgentSpecSchema.parse(spec)
const types = parsed.triggers.map((t) => t.type)
- expect(types).toEqual(expect.arrayContaining(['chat', 'mcp', 'slack']))
- // Slack must be owner-only so the asker's identity resolves (shared
- // threads fail closed — you can't act as the owner for someone else).
- const slack = parsed.triggers.find((t) => t.type === 'slack')
- expect(slack?.type === 'slack' && slack.config.allow_workspace_participants).toBe(false)
+ expect(types).toEqual(expect.arrayContaining(['chat', 'mcp']))
+ // No Slack: the canonical Agent Builder has no dedicated Slack app, and
+ // a slack trigger makes promote refuse until SLACK_SIGNING_SECRET +
+ // SLACK_BOT_TOKEN are set — re-adding it breaks the seeded deployment.
+ expect(types).not.toContain('slack')
})
it('declares a posthog identity provider with the scopes authoring needs', async () => {
diff --git a/products/agent_platform/services/agent-tests/src/examples/agent-builder/README.md b/products/agent_platform/services/agent-tests/src/examples/agent-builder/README.md
index ec647d6a7599..bb8bbd073c58 100644
--- a/products/agent_platform/services/agent-tests/src/examples/agent-builder/README.md
+++ b/products/agent_platform/services/agent-tests/src/examples/agent-builder/README.md
@@ -1,8 +1,8 @@
# Agent Builder — the meta-agent for the platform
The "explain, debug, edit" assistant for every agent on the
-PostHog agent platform. One deployment, three surfaces (PostHog Code
-chat dock, MCP from Claude Code / Cursor, future Slack),
+PostHog agent platform. One deployment, two surfaces (PostHog Code
+chat dock, MCP from Claude Code / Cursor),
all acting under the user's PostHog OAuth principal.
## Status
@@ -11,9 +11,9 @@ all acting under the user's PostHog OAuth principal.
current platform. The pieces this bundle leans on have shipped:
`kind: "client"` tool support is in the spec schema (and exercised by
the `focus_*` / `set_secret` entries), the runner opens the clients
-declared in `spec.mcps`, and the `@posthog/agent-applications-*`
-authoring surface is a set of native in-process tools resolved through
-the registry.
+declared in `spec.mcps`, and the `agent-applications-*` authoring
+surface is reached through the one declared PostHog MCP, authed by
+the `posthog` identity provider as the asking user.
## What it does
@@ -43,8 +43,8 @@ the user to review and promote themselves. `auditing-the-fleet` is a
kernel skill, injected at freeze — see
[`backend/kernel_skills/auditing-the-fleet/SKILL.md`](../../../../../backend/kernel_skills/auditing-the-fleet/SKILL.md).
-For each mode, the Agent Builder calls the same `agent-applications-*`
-native tools that the authoring AI uses,
+For each mode, the Agent Builder calls the `agent-applications-*`
+tools on the PostHog MCP,
acting under the connected user's principal so every write shows
up in the activity log as **the user**, not as the Agent Builder.
@@ -79,12 +79,12 @@ agent-builder/
## Tool surface
-| Class | Tool | Class semantics |
-| ------------------ | ------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| Native | `@posthog/agent-applications-*` (list, retrieve, revisions, sessions, logs + the draft edit + validate verbs) | Read agent state — applications, revisions, sessions, logs — as the connected user. Routed through the credential broker; no platform credentials, no impersonation. |
-| Native (telemetry) | `@posthog/query` | HogQL the agent's LLM-observability events (`$ai_generation` / `$ai_span` / `$ai_trace`) the runner captured into the team's project. Powers debug + improve evidence — see `querying-ai-observability`. |
-| Native (audit I/O) | `@posthog/memory-search`, `@posthog/memory-read`, `@posthog/memory-write` | Durable output of a fleet audit — persist the report to memory. |
-| Client | `focus_tab`, `focus_file`, `focus_revision`, `focus_session`, `focus_spec_section`, `toast`, `get_context`, `set_secret` | Drive PostHog Code's read panel + read the user's current view. No-op outside PostHog Code. |
+| Class | Tool | Class semantics |
+| ---------------- | --------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
+| MCP (authoring) | `agent-applications-*` (list, retrieve, revisions, sessions, logs + the draft edit + validate verbs) | The bulk of its work — read + write agent state as the connected user, via the one `spec.mcps` entry (PostHog MCP, `posthog` identity provider). Curated `tools[]` allow-list; `promote` / `archive` / `destroy` are approval-gated. |
+| MCP (telemetry) | `execute-sql`, `insight-query`, `get-llm-total-costs-for-project` | HogQL / insights over the agent's LLM-observability events (`$ai_generation` / `$ai_span` / `$ai_trace`) the runner captured into the team's project. Powers debug + improve evidence. |
+| Native (runtime) | `@posthog/memory-search`, `@posthog/memory-read`, `@posthog/memory-write`, `@posthog/web-search` | The agent's own runtime tools — durable memory (persist a fleet-audit report) and web search. |
+| Client | `focus_tab`, `focus_file`, `focus_revision`, `focus_session`, `focus_spec_section`, `toast`, `get_context`, `set_secret`, `connect_mcp` | Drive PostHog Code's read panel + read the user's current view. No-op outside PostHog Code. |
## Auth model
@@ -111,19 +111,33 @@ These are platform-side, not bundle-side — and they're in place:
accepts `kind: "client"`; the bundle's `focus_*`, `toast`, and
`set_secret` entries parse and validate.
2. **Runtime MCP support** — the runner opens the clients declared in
- `spec.mcps` at session start. (The Agent Builder declares none —
- `spec.mcps` is empty — because its authoring surface is native, not
- a remote MCP server.)
+ `spec.mcps` at session start. (The Agent Builder declares exactly
+ one — the PostHog MCP, authed by the `posthog` identity provider —
+ which carries its whole authoring surface.)
3. **OAuth principal threading** — the session principal threads
through every tool call, so writes attribute to the user.
-4. **The native authoring tools** — `@posthog/agent-applications-*`
- are native in-process tools resolved through the tool registry
- (not a separate MCP server), including the draft-edit + validate
- verbs the Agent Builder uses.
+4. **The MCP authoring tools** — the `agent-applications-*` verbs
+ (including draft-edit + validate) are served by the PostHog MCP,
+ scoped by the entry's curated `tools[]` allow-list, with the
+ destructive verbs approval-gated.
## Deploying
-Through the authoring MCP (preferred — same as other example bundles):
+The canonical US-prod deployment is kept in sync by CI:
+[`.github/workflows/cd-agent-builder-seed.yml`](../../../../../../../.github/workflows/cd-agent-builder-seed.yml)
+runs `seed.py agent-builder` against `us.posthog.com` on every master
+push touching this bundle, `seed.py`, or `backend/kernel_skills/`, plus
+a daily schedule (kernel-skill changes only take effect once the
+backend deploy carrying them is live, so the scheduled run converges
+them; it also heals manual drift). Runs are churn-free: a seed whose
+frozen artifact is byte-identical to the live revision skips promote
+instead of minting a new live revision. It authenticates with the
+`AGENT_BUILDER_SEED_PAT` repo secret and is gated to the canonical
+deploy repo via `CD_DEPLOY_ENABLED`. Manual seeding is only needed for
+other environments or when bootstrapping from scratch.
+
+Through the authoring MCP (preferred for manual deploys — same as
+other example bundles):
```text
agent-applications-create slug=agent-builder name="Agent Builder"
@@ -154,14 +168,17 @@ loads the bundle from disk and asserts:
- The bundle carries NO inline skills (kernel skills are injected at
freeze from backend code; builder playbooks are served by the MCP)
- `agent.md` is present and non-trivial
-- `spec.mcps` is empty (the Agent Builder authors via native tools only —
- no external MCP server in the write path) **and** every declared
- native tool id resolves in the native catalog (`listNativeTools()`)
-- Both `chat` and `mcp` triggers are declared
+- Authoring goes through ONE PostHog MCP (`spec.mcps[0].auth.provider`
+ is `posthog`), the only natives left are the agent's own runtime
+ tools (memory + web-search), **and** every declared native tool id
+ resolves in the native catalog (`listNativeTools()`)
+- Both `chat` and `mcp` triggers are declared — and NO `slack` trigger
+ (no dedicated Slack app exists, and a slack trigger blocks promote
+ until its required secrets are set)
- The `kind: "client"` tools (`focus_*`, `toast`, `get_context`,
- `set_secret`) are present, and the destructive native writes
- (`promote`, `archive`) carry inline `requires_approval` +
- `approval_policy`
+ `set_secret`, `connect_mcp`) are present, and the destructive MCP
+ authoring tools (`promote`, `archive`, `destroy`) are gated with
+ `level: "approve"` + a principal `approval_policy`
NOT a real-inference test — the model is faux. This is the wiring
regression net, not a quality bar. (A future real-inference case
diff --git a/products/agent_platform/services/agent-tests/src/examples/agent-builder/agent.md b/products/agent_platform/services/agent-tests/src/examples/agent-builder/agent.md
index d7d64d8c37b4..b59536184c65 100644
--- a/products/agent_platform/services/agent-tests/src/examples/agent-builder/agent.md
+++ b/products/agent_platform/services/agent-tests/src/examples/agent-builder/agent.md
@@ -8,11 +8,10 @@ expert who helps build them.
## Who you talk to
-| Surface | Detect via | Capabilities |
-| ---------------- | --------------------------------------------- | ------------------------------------------------------------------------------------- |
-| **PostHog Code** | `client.kind` is `posthog-code` | `focus_*`, `toast`, `set_secret` punch-out |
-| **MCP / IDE** | trigger is `mcp`, or `client.kind` is `mcp:*` | text only — no UI |
-| **Slack** | trigger is `slack` | Slack-formatted text replies; the asker links their PostHog account first (see below) |
+| Surface | Detect via | Capabilities |
+| ---------------- | --------------------------------------------- | ------------------------------------------ |
+| **PostHog Code** | `client.kind` is `posthog-code` | `focus_*`, `toast`, `set_secret` punch-out |
+| **MCP / IDE** | trigger is `mcp`, or `client.kind` is `mcp:*` | text only — no UI |
If you can call `focus_tab`, you are in PostHog Code. If calling it
returns `client_tool_unsupported`, you are not — fall back to
@@ -117,11 +116,11 @@ These are non-negotiable. If a request would force you to break
one, refuse and explain why.
1. **Act as the asking user — never as PostHog.** Every PostHog MCP
- call runs with the asking user's linked PostHog identity. You hold
+ call runs with the asking user's PostHog identity. You hold
no fallback credential. In PostHog Code / MCP the bearer passes
- through from the trigger; in Slack the user links their account
- first (see "Acting as the user"). If a call returns 403, that is
- the user's permissions speaking — surface it, don't work around it.
+ through from the trigger (see "Acting as the user"). If a call
+ returns 403, that is the user's permissions speaking — surface
+ it, don't work around it.
2. **Never accept raw secrets in chat.** API keys, OAuth tokens,
passwords. If the user pastes one, tell them not to and reset
the secret to whatever you'd have used the punch-out flow for.
@@ -161,17 +160,9 @@ slightly nudges at one of these.
You act on PostHog **as the person talking to you** — never a service
account. Every `posthog__*` MCP call is signed with that user's PostHog
identity, so what you can see and change is exactly what they can.
-
-How the credential reaches the call depends on the surface:
-
-- **PostHog Code / MCP / IDE:** the user's PostHog bearer passes through
- from the trigger — they're already authenticated, nothing to link.
-- **Slack:** the asker links their PostHog account once. Until they do, a
- `posthog__*` call comes back unavailable with a connect link — or mint one
- yourself with `@posthog/identity-connect`. Relay it as a short **markdown
- link** ("Connect your PostHog account: [link]"), ask them to click it, then
- retry — don't report the capability as broken. If a linked account later
- lacks a needed permission, the same path offers a reconnect.
+On both of your surfaces (PostHog Code and MCP / IDE) the user's PostHog
+bearer passes through from the trigger — they're already authenticated,
+nothing to link.
This is also the single most important thing to get right in the agents you
build: an agent that calls PostHog (or any third-party API) on a user's
@@ -241,7 +232,6 @@ called directly.
| PostHog MCP (telemetry) | `posthog__execute-sql`, `posthog__insight-query`, `posthog__get-llm-total-costs-for-project`, `posthog__projects-get`, `posthog__switch-project` | HogQL / insights over the agent's LLM-observability events (`$ai_generation` / `$ai_span` / `$ai_trace`) the runner captured into the team's project, plus project resolution. Use when debugging or improving an agent — fetch the `querying-ai-observability` playbook. |
| PostHog MCP (authoring aids) | `posthog__agent-applications-spec-schema`, `posthog__agent-native-tools-list`, `posthog__agent-applications-models`, `posthog__agent-resolve-resource` | Ground truth for building/editing: `agent-applications-spec-schema` returns the canonical spec JSON Schema (pass `section`, e.g. `models`, for one slice) — read it before hand-writing any `spec`; `agent-native-tools-list` is the catalog of valid native tool ids; `agent-applications-models` is the served-model catalog for `spec.models`; `agent-resolve-resource` is **the** source for builder playbooks — pass a playbook id and it returns the doc plus the live, scope-aware tool surface. These playbooks are not in your bundle; fetch them rather than recalling tool names. |
| Native (memory) | `@posthog/memory-search`, `@posthog/memory-read`, `@posthog/memory-write`, `@posthog/memory-update`, `@posthog/memory-delete` | Your own durable memory — persist a fleet-audit report, correct or remove notes the live sources have proven stale. Used by `skills/auditing-the-fleet` when a user asks for a fleet-wide sweep. |
-| Identity | `@posthog/identity-connect` | Mint a connect / reconnect link for the user's PostHog account — relay it as a markdown link when a capability needs an account that isn't linked yet (Slack). See "Acting as the user". |
| Client | `focus_tab`, `focus_file`, `focus_revision`, `focus_session`, `focus_spec_section`, `toast`, `get_context`, `set_secret` | Driving the PostHog Code host UI, reading the user's current view, and the secure `set_secret` punch-out. Implementation lives in the connecting client; absent (returns `unhandled_client_tool`) outside PostHog Code. |
### The agent-management tools
@@ -368,14 +358,13 @@ Every `focus_*` returns `{ focused: true, kind }` on success or `{ focused: fals
If a client tool returns `unhandled_client_tool: <id>` or `client_tool_timeout`, you're in an environment that doesn't implement it (MCP / IDE / etc.). Degrade to text — don't keep retrying.
-Your triggers are chat, MCP, **and Slack**. On every one the platform
-streams your finalized reply back to the originating surface — so your
-reply _is_ the channel; you never call a Slack tool to answer (on Slack,
-just reply in natural language with Slack-flavored formatting). (A
-fleet-audit sweep lands its report in memory, not Slack — see
+Your triggers are chat and MCP. On both the platform streams your
+finalized reply back to the originating surface — so your reply _is_
+the channel; you never call a messaging tool to answer. (A
+fleet-audit sweep lands its report in memory — see
`skills/auditing-the-fleet`.)
-**The same now holds for the Slack-triggered agents you build.** The
+**The same holds for the Slack-triggered agents you build.** The
platform relays each finalized assistant message into the originating
thread automatically — a Slack agent just replies in natural language,
exactly like a chat agent. You do NOT need to wire
diff --git a/products/agent_platform/services/agent-tests/src/examples/agent-builder/spec.json b/products/agent_platform/services/agent-tests/src/examples/agent-builder/spec.json
index 454ca7d54075..4cdc2235270b 100644
--- a/products/agent_platform/services/agent-tests/src/examples/agent-builder/spec.json
+++ b/products/agent_platform/services/agent-tests/src/examples/agent-builder/spec.json
@@ -36,17 +36,6 @@
}
]
}
- },
- {
- "type": "slack",
- "config": {
- "mention_only": true,
- "auto_resume_threads": true,
- "allow_workspace_participants": false,
- "allow_direct_messages": true,
- "trusted_workspaces": "*",
- "ack_reaction": "eyes"
- }
}
],
"tools": [
diff --git a/products/agent_platform/services/agent-tests/src/examples/seed.py b/products/agent_platform/services/agent-tests/src/examples/seed.py
index bc94f2442573..f57594907aa2 100755
--- a/products/agent_platform/services/agent-tests/src/examples/seed.py
+++ b/products/agent_platform/services/agent-tests/src/examples/seed.py
@@ -10,7 +10,13 @@ deploy pipeline for each selected one against a target PostHog project:
Idempotent: a bundle whose live revision already matches (per-file sha256 AND
spec) is a no-op; a drifted bundle branches a new draft and re-promotes,
-leaving the previously-live revision archived.
+leaving the previously-live revision archived. Bundles that receive
+platform-injected content at freeze (kernel skills) never match the on-disk
+manifest, so they get a second, post-freeze check: if the new frozen
+bundle_sha256 AND the frozen spec both equal the live revision's, the
+revision is identical — the draft is archived and promote is skipped, so
+repeated seeds don't churn revisions. (Both checks are needed: the sha only
+covers bundle files, while the spec lives on the revision row.)
Usage:
# Seed every discovered bundle into the default local project:
@@ -611,20 +617,41 @@ def promote(slug: str, app_id: str, rev_id: str) -> None:
raise SeedError(f"promote failed for {slug}: {status} {payload}")
-def get_live(app_id: str) -> tuple[str | None, dict[str, str] | None, dict | None]:
- """Returns (live_revision_id, {path: sha256}, spec) or (None, None, None)."""
+def archive(slug: str, app_id: str, rev_id: str) -> None:
+ """Archive a duplicate ready revision. Cosmetic cleanup — a failure here
+ leaves a stray ready revision but the live deployment is already correct,
+ so log instead of failing the run."""
+ if DRY_RUN:
+ return
+ status, payload = _req("POST", f"/agent_applications/{app_id}/revisions/{rev_id}/archive/")
+ if status != 200:
+ log(slug, f"WARNING: failed to archive duplicate revision {rev_id}: {status} {payload}")
+
+
+def get_live(app_id: str) -> tuple[str | None, dict[str, str] | None, dict | None, str | None]:
+ """Returns (live_revision_id, {path: sha256}, spec, bundle_sha256) or Nones."""
status, payload = _req("GET", f"/agent_applications/{app_id}/")
if status != 200:
- return None, None, None
+ return None, None, None, None
rev_id = payload.get("live_revision")
if not rev_id:
- return None, None, None
+ return None, None, None, None
status, rev = _req("GET", f"/agent_applications/{app_id}/revisions/{rev_id}/")
spec = rev.get("spec") if status == 200 else None
+ live_sha = rev.get("bundle_sha256") if status == 200 else None
status, manifest = _req("GET", f"/agent_applications/{app_id}/revisions/{rev_id}/manifest/")
if status != 200:
- return rev_id, None, spec
- return rev_id, {f["path"]: f["sha256"] for f in manifest.get("files", [])}, spec
+ return rev_id, None, spec, live_sha
+ return rev_id, {f["path"]: f["sha256"] for f in manifest.get("files", [])}, spec, live_sha
+
+
+def get_frozen_spec(app_id: str, rev_id: str) -> dict | None:
+ """The revision's spec as stamped at freeze (defaults filled, skills[]/tools[]
+ derived) — the same normalized shape `get_live` reads off the live revision,
+ so the two compare apples-to-apples. None when the read fails."""
+ status, rev = _req("GET", f"/agent_applications/{app_id}/revisions/{rev_id}/")
+ spec = rev.get("spec") if status == 200 else None
+ return spec if isinstance(spec, dict) else None
def seed_bundle(bundle_root: Path) -> None:
@@ -641,7 +668,7 @@ def seed_bundle(bundle_root: Path) -> None:
log(slug, "would deploy: draft -> bundle -> spec -> validate -> freeze -> promote")
return
- live_rev, live_manifest, live_spec = get_live(app_id)
+ live_rev, live_manifest, live_spec, live_sha = get_live(app_id)
log(slug, f"current live: rev={live_rev}")
if live_rev and live_manifest == target_manifest and live_spec == spec:
@@ -663,6 +690,19 @@ def seed_bundle(bundle_root: Path) -> None:
validate(slug, app_id, rev_id)
new_sha = freeze(slug, app_id, rev_id)
log(slug, f"frozen sha={new_sha[:12]}...")
+ # The frozen sha hashes the materialized bundle FILES (author files +
+ # freeze-injected kernel skills) — the spec (trigger auth, tool approvals,
+ # limits) lives on the revision row, not in the bundle, so a spec-only
+ # change freezes to the same sha and must still promote. Skip promote only
+ # when the bundle sha AND the frozen spec both match the live revision:
+ # then the "drift" above was only platform-injected content the on-disk
+ # bundle can't carry, and promoting would churn an identical revision.
+ if live_sha and new_sha == live_sha:
+ if get_frozen_spec(app_id, rev_id) == live_spec:
+ log(slug, "frozen artifact identical to live — archiving duplicate, skipping promote")
+ archive(slug, app_id, rev_id)
+ return
+ log(slug, "bundle identical but frozen spec changed — promoting")
promote(slug, app_id, rev_id)
log(slug, f"DONE: live at {rev_id}")