Skip to content
This repository was archived by the owner on Aug 6, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,25 @@ describe("AgentServer.configureEnvironment", () => {
);
});

it("does not tag as signals when origin_product is 'signal_report' but the task is not internal", () => {
it("tags as signals when origin_product is 'signal_report' even if the task is not internal", () => {
buildServer("background").configureEnvironment({
isInternal: false,
originProduct: "signal_report",
});

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

it("tags as signals for scout runs (origin_product 'signals_scout'), internal or not", () => {
buildServer("background").configureEnvironment({
isInternal: false,
originProduct: "signals_scout",
});

expect(process.env.LLM_GATEWAY_URL).toBe(
"https://gateway.us.posthog.com/signals",
);
});
Comment thread
joshsny marked this conversation as resolved.

Expand Down
12 changes: 11 additions & 1 deletion packages/agent/src/utils/gateway.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ describe("resolveGatewayProduct", () => {
{
isInternal: false,
originProduct: "signal_report",
expected: "posthog_code",
expected: "signals",
},
{
isInternal: true,
Expand All @@ -30,6 +30,16 @@ describe("resolveGatewayProduct", () => {
expected: "background_agents",
},
{ isInternal: true, originProduct: "signal_report", expected: "signals" },
{
isInternal: false,
originProduct: "signals_scout",
expected: "signals",
},
{
isInternal: true,
originProduct: "signals_scout",
expected: "signals",
},
] as const)(
"isInternal=$isInternal originProduct=$originProduct -> $expected",
({ isInternal, originProduct, expected }) => {
Expand Down
8 changes: 7 additions & 1 deletion packages/agent/src/utils/gateway.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,14 @@ export function resolveGatewayProduct({
if (originProduct === "slack") {
return "slack_app";
}
// Signals-originated work bills to the signals product regardless of whether
// the run is internal: signal-report tasks and headless scout runs both count
// against signals. (`signals_scout` is the scout origin product.)
if (originProduct === "signal_report" || originProduct === "signals_scout") {
return "signals";
}
if (isInternal) {
return originProduct === "signal_report" ? "signals" : "background_agents";
return "background_agents";
}
return "posthog_code";
}
Expand Down
1 change: 1 addition & 0 deletions packages/shared/src/task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export interface Task {
| "support_queue"
| "session_summaries"
| "signal_report"
| "signals_scout" // Headless Signals scout that proactively emits signals
| "slack";
signal_report?: string | null; // Inbox report UUID when origin_product is "signal_report"
github_integration?: number | null;
Expand Down
Loading