Skip to content

fix(agent): bill signals scouts and all signal-report tasks to signals product#2738

Merged
joshsny merged 4 commits into
mainfrom
posthog-code/bill-signals-scouts-to-signals-product
Jun 17, 2026
Merged

fix(agent): bill signals scouts and all signal-report tasks to signals product#2738
joshsny merged 4 commits into
mainfrom
posthog-code/bill-signals-scouts-to-signals-product

Conversation

@joshsny

@joshsny joshsny commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Problem

LLM usage from the Signals product wasn't fully attributed to the signals gateway product. Only internal signal-report tasks routed to signals; non-internal signal-report tasks fell through to posthog_code, and headless scout runs (origin_product = signals_scout) weren't routed to signals at all.

Changes

resolveGatewayProduct now routes any signals-originated work to the signals gateway product regardless of the internal flag:

  • signal_report tasks → signals (previously only when internal)
  • signals_scout (headless scout runs) → signals (new)

Task["origin_product"] in @posthog/shared gains the signals_scout member to match the backend OriginProduct enum (products/tasks/backend/models.py), where the scout origin product is signals_scout.

How did you test this?

Ran the affected unit tests:
pnpm --filter @posthog/agent exec vitest run src/utils/gateway.test.ts src/server/agent-server.configure-environment.test.ts — 41 passing, including new cases for non-internal signal_report and both internal/non-internal signals_scout. Also ran tsc --noEmit on the agent package and biome on the touched files.

Automatic notifications

  • Publish to changelog?
  • Alert Sales and Marketing teams?

Created with PostHog Code from a Slack thread

…s product

Route both signal-report tasks and headless scout runs (origin_product `signals_scout`) to the `signals` gateway product, regardless of whether the run is internal.

Generated-By: PostHog Code
Task-Id: be68dc37-6c5b-424c-845e-ad3f514f16df
@github-actions

github-actions Bot commented Jun 17, 2026

Copy link
Copy Markdown

React Doctor found no issues in the changed files. 🎉

Reviewed by React Doctor for commit 023ec1f.

@greptile-apps

greptile-apps Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor
Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 1
packages/agent/src/server/agent-server.configure-environment.test.ts:130-150
These two tests follow identical shapes — `buildServer("background").configureEnvironment({isInternal: false, originProduct: X})` → check `LLM_GATEWAY_URL` — and would be cleaner as a single `it.each`, matching the team's preference for parameterised tests. The description of the second test also says "internal or not" but only exercises `isInternal: false`; the internal path is only covered in `gateway.test.ts`.

```suggestion
  it.each([
    { originProduct: "signal_report" as const },
    { originProduct: "signals_scout" as const },
  ])(
    "tags as signals for signals-originated work (origin_product '$originProduct') regardless of internal flag",
    ({ originProduct }) => {
      buildServer("background").configureEnvironment({
        isInternal: false,
        originProduct,
      });

      expect(process.env.LLM_GATEWAY_URL).toBe(
        "https://gateway.us.posthog.com/signals",
      );
    },
  );
```

Reviews (1): Last reviewed commit: "fix(agent): bill signals scouts and all ..." | Re-trigger Greptile

joshsny added 3 commits June 17, 2026 19:10
Generated-By: PostHog Code
Task-Id: be68dc37-6c5b-424c-845e-ad3f514f16df
…ment

Generated-By: PostHog Code
Task-Id: be68dc37-6c5b-424c-845e-ad3f514f16df
Generated-By: PostHog Code
Task-Id: be68dc37-6c5b-424c-845e-ad3f514f16df
@joshsny joshsny marked this pull request as ready for review June 17, 2026 19:37
@joshsny joshsny requested a review from a team June 17, 2026 19:39
@greptile-apps

greptile-apps Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Reviews (2): Last reviewed commit: "chore(agent): drop redundant comment on ..." | Re-trigger Greptile

@joshsny joshsny merged commit 8331a94 into main Jun 17, 2026
27 checks passed
@joshsny joshsny deleted the posthog-code/bill-signals-scouts-to-signals-product branch June 17, 2026 19:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants