Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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 @@ -183,6 +183,20 @@ describe("AgentServer.configureEnvironment", () => {
},
);

it("tags as onboarding when a wizard cloud run reaches the gateway", () => {
const env = buildServer("background").configureEnvironment({
isInternal: false,
originProduct: "onboarding",
});

expect(env.anthropicBaseUrl).toBe(
"https://gateway.us.posthog.com/onboarding",
);
expect(env.openaiBaseUrl).toBe(
"https://gateway.us.posthog.com/onboarding/v1",
);
});

// The codex/OpenAI path sets provider http_headers rather than
// ANTHROPIC_CUSTOM_HEADERS, so the same task metadata must be exposed as a
// record — including team_id, which the Claude path adds separately in
Expand Down
29 changes: 14 additions & 15 deletions packages/agent/src/utils/gateway.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ export type GatewayProduct =
| "signals"
| "slack_app"
| "posthog_ai"
| "conversations";
| "conversations"
| "onboarding";

export function resolveGatewayProduct({
isInternal,
Expand All @@ -13,20 +14,18 @@ export function resolveGatewayProduct({
isInternal?: boolean;
originProduct?: string | null;
} = {}): GatewayProduct {
if (originProduct === "slack") {
return "slack_app";
}
if (originProduct === "posthog_ai") {
return "posthog_ai";
}
if (originProduct === "signal_report" || originProduct === "signals_scout") {
return "signals";
}
if (originProduct === "support_reply") {
return "conversations";
}
if (originProduct === "loop") {
return "posthog_code";
const originProductToGatewayProductMap: Record<string, GatewayProduct> = {
loop: "posthog_code",
onboarding: "onboarding",
posthog_ai: "posthog_ai",
signal_report: "signals",
signals_scout: "signals",
slack: "slack_app",
support_reply: "conversations",
};

if (originProduct && originProduct in originProductToGatewayProductMap) {
return originProductToGatewayProductMap[originProduct];
}
if (isInternal) {
return "background_agents";
Expand Down
Loading