Skip to content

Commit 8331a94

Browse files
authored
fix(agent): bill signals scouts and all signal-report tasks to signals product (#2738)
1 parent 229dd75 commit 8331a94

4 files changed

Lines changed: 29 additions & 4 deletions

File tree

packages/agent/src/server/agent-server.configure-environment.test.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,14 +128,25 @@ describe("AgentServer.configureEnvironment", () => {
128128
);
129129
});
130130

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

137137
expect(process.env.LLM_GATEWAY_URL).toBe(
138-
"https://gateway.us.posthog.com/posthog_code",
138+
"https://gateway.us.posthog.com/signals",
139+
);
140+
});
141+
142+
it("tags as signals for scout runs (origin_product 'signals_scout'), internal or not", () => {
143+
buildServer("background").configureEnvironment({
144+
isInternal: false,
145+
originProduct: "signals_scout",
146+
});
147+
148+
expect(process.env.LLM_GATEWAY_URL).toBe(
149+
"https://gateway.us.posthog.com/signals",
139150
);
140151
});
141152

packages/agent/src/utils/gateway.test.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ describe("resolveGatewayProduct", () => {
1717
{
1818
isInternal: false,
1919
originProduct: "signal_report",
20-
expected: "posthog_code",
20+
expected: "signals",
2121
},
2222
{
2323
isInternal: true,
@@ -30,6 +30,16 @@ describe("resolveGatewayProduct", () => {
3030
expected: "background_agents",
3131
},
3232
{ isInternal: true, originProduct: "signal_report", expected: "signals" },
33+
{
34+
isInternal: false,
35+
originProduct: "signals_scout",
36+
expected: "signals",
37+
},
38+
{
39+
isInternal: true,
40+
originProduct: "signals_scout",
41+
expected: "signals",
42+
},
3343
] as const)(
3444
"isInternal=$isInternal originProduct=$originProduct -> $expected",
3545
({ isInternal, originProduct, expected }) => {

packages/agent/src/utils/gateway.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,11 @@ export function resolveGatewayProduct({
1414
if (originProduct === "slack") {
1515
return "slack_app";
1616
}
17+
if (originProduct === "signal_report" || originProduct === "signals_scout") {
18+
return "signals";
19+
}
1720
if (isInternal) {
18-
return originProduct === "signal_report" ? "signals" : "background_agents";
21+
return "background_agents";
1922
}
2023
return "posthog_code";
2124
}

packages/shared/src/task.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export interface Task {
1212
| "support_queue"
1313
| "session_summaries"
1414
| "signal_report"
15+
| "signals_scout"
1516
| "slack";
1617
signal_report?: string | null; // Inbox report UUID when origin_product is "signal_report"
1718
github_integration?: number | null;

0 commit comments

Comments
 (0)