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.

feat(desktop): route scouts by their full skill name (#97900)

posthog[bot]585a75e6c7d6
diff --git a/products/desktop/docs/DEEP-LINKS.md b/products/desktop/docs/DEEP-LINKS.md
index 3721e6b3808b..79fff1104bf7 100644
--- a/products/desktop/docs/DEEP-LINKS.md
+++ b/products/desktop/docs/DEEP-LINKS.md
@@ -113,7 +113,7 @@ posthog-code://inbox
posthog-code://inbox/report_abc123
```
-### `posthog-code://scout/<skillSlug>`
+### `posthog-code://scout/<skillName>`
Open a scout's detail page, optionally focused on a specific finding (expanded
and scrolled into view). This is the link copied by the "Share" CTA on a scout
@@ -121,12 +121,12 @@ emission card.
| Segment / Parameter | Required | Description |
|---|---|---|
-| `<skillSlug>` | Yes | Scout route slug, i.e. the skill name with the `signals-scout-` prefix stripped (e.g. `error-tracking`) |
+| `<skillName>` | Yes | Full scout skill name (e.g. `signals-scout-error-tracking`, or a bare name such as `my-churn-watch`). Older links carrying the name with the `signals-scout-` prefix stripped still resolve. |
| `finding` | No | Emission id to expand and scroll to. Best effort – only resolves while the finding is still inside the scout's runs window. |
```
-posthog-code://scout/error-tracking
-posthog-code://scout/error-tracking?finding=abc123
+posthog-code://scout/signals-scout-error-tracking
+posthog-code://scout/my-churn-watch?finding=abc123
```
### `posthog-code://loop/<loopId>`
diff --git a/products/desktop/packages/core/src/links/scout-link.test.ts b/products/desktop/packages/core/src/links/scout-link.test.ts
index d34c98b960e6..e30645c3938f 100644
--- a/products/desktop/packages/core/src/links/scout-link.test.ts
+++ b/products/desktop/packages/core/src/links/scout-link.test.ts
@@ -78,25 +78,25 @@ describe("ScoutLinkService", () => {
name: "emits OpenScout with the finding id from the query param",
path: "error-tracking",
search: "finding=abc-123",
- expected: { skillSlug: "error-tracking", findingId: "abc-123" },
+ expected: { skillName: "error-tracking", findingId: "abc-123" },
},
{
name: "emits OpenScout without a finding id when none is supplied",
path: "error-tracking",
search: "",
- expected: { skillSlug: "error-tracking", findingId: undefined },
+ expected: { skillName: "error-tracking", findingId: undefined },
},
{
- name: "takes only the first path segment as the skill slug",
+ name: "takes only the first path segment as the skill name",
path: "error-tracking/extra/segments",
search: "",
- expected: { skillSlug: "error-tracking", findingId: undefined },
+ expected: { skillName: "error-tracking", findingId: undefined },
},
{
- name: "decodes a percent-encoded skill slug",
+ name: "decodes a percent-encoded skill name",
path: "error%2Dtracking",
search: "",
- expected: { skillSlug: "error-tracking", findingId: undefined },
+ expected: { skillName: "error-tracking", findingId: undefined },
},
])("$name", ({ path, search, expected }) => {
const listener = vi.fn();
@@ -112,7 +112,7 @@ describe("ScoutLinkService", () => {
deepLinkService.trigger("scout", "web-analytics", "finding=f-1");
const pending = service.consumePendingDeepLink();
- expect(pending).toEqual({ skillSlug: "web-analytics", findingId: "f-1" });
+ expect(pending).toEqual({ skillName: "web-analytics", findingId: "f-1" });
// Draining clears it
expect(service.consumePendingDeepLink()).toBeNull();
diff --git a/products/desktop/packages/core/src/links/scout-link.ts b/products/desktop/packages/core/src/links/scout-link.ts
index 832821dfa611..fb13d0419ff6 100644
--- a/products/desktop/packages/core/src/links/scout-link.ts
+++ b/products/desktop/packages/core/src/links/scout-link.ts
@@ -16,8 +16,8 @@ export const ScoutLinkEvent = {
} as const;
export interface ScoutLinkPayload {
- /** Route slug for the scout (e.g. "error-tracking"). */
- skillSlug: string;
+ /** Scout skill name from the link (e.g. "signals-scout-error-tracking"). */
+ skillName: string;
/** Emission id to expand and scroll to, if the link carried one. */
findingId?: string;
}
@@ -51,31 +51,31 @@ export class ScoutLinkService extends TypedEventEmitter<ScoutLinkEvents> {
path: string,
searchParams: URLSearchParams,
): boolean {
- const skillSlug = decodeSegment(path.split("/")[0]);
+ const skillName = decodeSegment(path.split("/")[0]);
- if (!skillSlug) {
- this.log.warn("Scout link missing skill slug");
+ if (!skillName) {
+ this.log.warn("Scout link missing skill name");
return false;
}
const findingId = searchParams.get("finding") ?? undefined;
- const payload: ScoutLinkPayload = { skillSlug, findingId };
+ const payload: ScoutLinkPayload = { skillName, findingId };
const hasListeners = this.listenerCount(ScoutLinkEvent.OpenScout) > 0;
if (hasListeners) {
this.log.info(
- `Emitting scout link event: skillSlug=${skillSlug} findingId=${findingId ?? "(none)"}`,
+ `Emitting scout link event: skillName=${skillName} findingId=${findingId ?? "(none)"}`,
);
this.emit(ScoutLinkEvent.OpenScout, payload);
} else {
this.log.info(
- `Queueing scout link (renderer not ready): skillSlug=${skillSlug}`,
+ `Queueing scout link (renderer not ready): skillName=${skillName}`,
);
this.pendingDeepLink = payload;
}
- this.log.info("Deep link focusing window", { skillSlug });
+ this.log.info("Deep link focusing window", { skillName });
if (this.mainWindow.isMinimized()) {
this.mainWindow.restore();
}
@@ -89,7 +89,7 @@ export class ScoutLinkService extends TypedEventEmitter<ScoutLinkEvents> {
this.pendingDeepLink = null;
if (pending) {
this.log.info(
- `Consumed pending scout link: skillSlug=${pending.skillSlug}`,
+ `Consumed pending scout link: skillName=${pending.skillName}`,
);
}
return pending;
diff --git a/products/desktop/packages/core/src/scouts/scoutPresentation.test.ts b/products/desktop/packages/core/src/scouts/scoutPresentation.test.ts
index 54222d74ccf1..2d46dc026711 100644
--- a/products/desktop/packages/core/src/scouts/scoutPresentation.test.ts
+++ b/products/desktop/packages/core/src/scouts/scoutPresentation.test.ts
@@ -22,6 +22,7 @@ import {
nextRunAt,
normalizeRunStatus,
prettifyScoutSkillName,
+ resolveScoutRouteName,
runDurationSeconds,
runMatchesFilter,
SCOUT_CUSTOM_CRON_SCHEDULE_MODE,
@@ -33,8 +34,6 @@ import {
scoutCreatorKey,
scoutCronScheduleError,
scoutRunOutcomeLabel,
- scoutSkillNameFromSlug,
- scoutSkillSlug,
sortConfigsForDisplay,
summarizeRunWindow,
weeklyCronToDayTime,
@@ -84,17 +83,39 @@ describe("naming", () => {
expect(prettifyScoutSkillName("custom_thing")).toBe("Custom thing");
});
- it("round-trips slugs", () => {
- expect(scoutSkillSlug("signals-scout-error-tracking")).toBe(
- "error-tracking",
- );
- expect(scoutSkillNameFromSlug("error-tracking")).toBe(
+ it.each<[string, string[], string]>([
+ [
"signals-scout-error-tracking",
- );
- expect(scoutSkillNameFromSlug("signals-scout-error-tracking")).toBe(
+ ["signals-scout-error-tracking"],
"signals-scout-error-tracking",
- );
- });
+ ],
+ ["my-churn-watch", ["my-churn-watch"], "my-churn-watch"],
+ // A link copied before the route carried full names.
+ [
+ "error-tracking",
+ ["signals-scout-error-tracking"],
+ "signals-scout-error-tracking",
+ ],
+ // A bare name wins over the prefixed scout that shares its slug.
+ [
+ "error-tracking",
+ ["error-tracking", "signals-scout-error-tracking"],
+ "error-tracking",
+ ],
+ ["unknown-scout", ["signals-scout-error-tracking"], "unknown-scout"],
+ ])("resolves route value %s", (routeValue, skillNames, expected) =>
+ expect(
+ resolveScoutRouteName(
+ routeValue,
+ skillNames.map((skill_name) => ({ skill_name })),
+ ),
+ ).toBe(expected),
+ );
+
+ it("keeps the route value while configs are still loading", () =>
+ expect(resolveScoutRouteName("error-tracking", undefined)).toBe(
+ "error-tracking",
+ ));
it.each<[Pick<ScoutConfig, "scout_origin"> | null | undefined, ScoutOrigin]>([
[{ scout_origin: "canonical" }, "canonical"],
diff --git a/products/desktop/packages/core/src/scouts/scoutPresentation.ts b/products/desktop/packages/core/src/scouts/scoutPresentation.ts
index 0fe5df80699d..0a91e1ff7c1f 100644
--- a/products/desktop/packages/core/src/scouts/scoutPresentation.ts
+++ b/products/desktop/packages/core/src/scouts/scoutPresentation.ts
@@ -6,10 +6,6 @@ import type {
ScoutRun,
} from "@posthog/api-client/posthog-client";
-// Single source of truth lives in `@posthog/shared` so `buildScoutDeeplink`
-// (which cannot import core) and the UI share one slug implementation.
-export { scoutSkillNameFromSlug, scoutSkillSlug } from "@posthog/shared";
-
export type ScoutOrigin = "canonical" | "custom";
/**
@@ -288,6 +284,26 @@ export function prettifyScoutSkillName(skillName: string): string {
return cleaned.charAt(0).toUpperCase() + cleaned.slice(1);
}
+/**
+ * Resolve a scout route value against the team's configs.
+ *
+ * The route carries the full skill name. Older links carry the name with the
+ * `signals-scout-` prefix stripped, so a value that matches no config falls
+ * back to the prefixed config of that name.
+ */
+export function resolveScoutRouteName(
+ routeValue: string,
+ configs: readonly Pick<ScoutConfig, "skill_name">[] | undefined,
+): string {
+ if (!configs) return routeValue;
+ if (configs.some((config) => config.skill_name === routeValue))
+ return routeValue;
+ const prefixed = `signals-scout-${routeValue}`;
+ return configs.some((config) => config.skill_name === prefixed)
+ ? prefixed
+ : routeValue;
+}
+
/** Skill name → author of the backing `signals-scout-*` skill's latest version. */
export type ScoutCreatorIndex = Map<string, LlmSkillCreatedBy>;
diff --git a/products/desktop/packages/shared/src/deep-links.test.ts b/products/desktop/packages/shared/src/deep-links.test.ts
index 25be1853fe1b..4a370f1224dd 100644
--- a/products/desktop/packages/shared/src/deep-links.test.ts
+++ b/products/desktop/packages/shared/src/deep-links.test.ts
@@ -138,10 +138,10 @@ describe("buildScoutDeeplink", () => {
}>([
{
name: "builds a bare scout link when finding is null",
- skillName: "error-tracking",
+ skillName: "my-churn-watch",
findingId: null,
isDevBuild: false,
- expected: "posthog-code://scout/error-tracking",
+ expected: "posthog-code://scout/my-churn-watch",
},
{
name: "builds a bare scout link when finding is undefined",
@@ -158,11 +158,11 @@ describe("buildScoutDeeplink", () => {
expected: "posthog-code://scout/error-tracking?finding=abc-123",
},
{
- name: "strips the signals-scout- prefix from a full skill name",
+ name: "keeps the signals-scout- prefix of a canonical skill name",
skillName: "signals-scout-error-tracking",
findingId: "f-1",
isDevBuild: false,
- expected: "posthog-code://scout/error-tracking?finding=f-1",
+ expected: "posthog-code://scout/signals-scout-error-tracking?finding=f-1",
},
{
name: "uses the dev scheme for dev builds",
diff --git a/products/desktop/packages/shared/src/deep-links.ts b/products/desktop/packages/shared/src/deep-links.ts
index bac2b1a7a073..01ad18076fde 100644
--- a/products/desktop/packages/shared/src/deep-links.ts
+++ b/products/desktop/packages/shared/src/deep-links.ts
@@ -1,5 +1,3 @@
-import { scoutSkillSlug } from "./scout-naming";
-
const DEEPLINK_PROTOCOL_PRODUCTION = "posthog-code";
const DEEPLINK_PROTOCOL_DEVELOPMENT = "posthog-code-dev";
const DEEPLINK_PROTOCOL_TEST = "posthog-code-test";
@@ -69,19 +67,17 @@ export function buildLoopDeeplink(
/**
* Build a canonical deep link to a scout's detail page, optionally focused on a
- * specific finding (`<scheme>://scout/<skillSlug>?finding=<id>`).
+ * specific finding (`<scheme>://scout/<skillName>?finding=<id>`).
*
- * `skillName` may be the full scout skill name (`signals-scout-error-tracking`)
- * or an already-stripped route slug (`error-tracking`); the `signals-scout-`
- * prefix is removed so the path always matches the renderer route param.
+ * The path carries the full scout skill name, so a scout named without the
+ * `signals-scout-` prefix routes to itself.
*/
export function buildScoutDeeplink(
skillName: string,
findingId: string | null | undefined,
{ isDevBuild }: { isDevBuild: boolean },
): string {
- const slug = scoutSkillSlug(skillName);
- const base = `${getDeeplinkProtocol(isDevBuild)}://scout/${encodeURIComponent(slug)}`;
+ const base = `${getDeeplinkProtocol(isDevBuild)}://scout/${encodeURIComponent(skillName)}`;
return findingId ? `${base}?finding=${encodeURIComponent(findingId)}` : base;
}
diff --git a/products/desktop/packages/shared/src/index.ts b/products/desktop/packages/shared/src/index.ts
index f7b8a24577c8..f55bcc7ab438 100644
--- a/products/desktop/packages/shared/src/index.ts
+++ b/products/desktop/packages/shared/src/index.ts
@@ -299,7 +299,6 @@ export { normalizeRepoKey } from "./repo";
export { getTaskRepository, parseRepository } from "./repository";
export { rewriteSavedLocation } from "./route-migrations";
export { Saga, type SagaLogger, type SagaResult } from "./saga";
-export { scoutSkillNameFromSlug, scoutSkillSlug } from "./scout-naming";
export {
type AcpMessage,
IMPORTED_USER_PROMPT_META_KEY,
diff --git a/products/desktop/packages/shared/src/scout-naming.ts b/products/desktop/packages/shared/src/scout-naming.ts
deleted file mode 100644
index 78ec911b5d34..000000000000
--- a/products/desktop/packages/shared/src/scout-naming.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-const SCOUT_SKILL_PREFIX = "signals-scout-";
-
-/** Route param form: "signals-scout-error-tracking" → "error-tracking" */
-export function scoutSkillSlug(skillName: string): string {
- return skillName.startsWith(SCOUT_SKILL_PREFIX)
- ? skillName.slice(SCOUT_SKILL_PREFIX.length)
- : skillName;
-}
-
-/** Inverse of `scoutSkillSlug`: "error-tracking" → "signals-scout-error-tracking" */
-export function scoutSkillNameFromSlug(slug: string): string {
- return slug.startsWith(SCOUT_SKILL_PREFIX)
- ? slug
- : `${SCOUT_SKILL_PREFIX}${slug}`;
-}
diff --git a/products/desktop/packages/ui/src/features/agents/agentsPageStore.test.tsx b/products/desktop/packages/ui/src/features/agents/agentsPageStore.test.tsx
index 56032700c5ab..2d045cab52e0 100644
--- a/products/desktop/packages/ui/src/features/agents/agentsPageStore.test.tsx
+++ b/products/desktop/packages/ui/src/features/agents/agentsPageStore.test.tsx
@@ -36,19 +36,19 @@ describe("agents page selection", () => {
[{}, null],
[
{ agent: "signals-scout-aio" },
- { slug: "signals-scout-aio", tab: "activity" },
+ { skillName: "signals-scout-aio", tab: "activity" },
],
[
{ agent: "a", finding: "f-1" },
- { slug: "a", tab: "output", findingId: "f-1" },
+ { skillName: "a", tab: "output", findingId: "f-1" },
],
[
{ agent: "a", agentTab: "settings" },
- { slug: "a", tab: "settings" },
+ { skillName: "a", tab: "settings" },
],
[
{ agent: "a", agentTab: "nonsense" },
- { slug: "a", tab: "activity" },
+ { skillName: "a", tab: "activity" },
],
])("reads the open agent from %o", (search, agent) =>
agent
diff --git a/products/desktop/packages/ui/src/features/agents/agentsPageStore.ts b/products/desktop/packages/ui/src/features/agents/agentsPageStore.ts
index 5d686933bcb1..535344a8c0fc 100644
--- a/products/desktop/packages/ui/src/features/agents/agentsPageStore.ts
+++ b/products/desktop/packages/ui/src/features/agents/agentsPageStore.ts
@@ -11,7 +11,7 @@ export type AgentsTab = "agents" | "memory" | "setup";
export const AGENTS_TABS: readonly AgentsTab[] = ["agents", "memory", "setup"];
interface OpenAgent {
- slug: string;
+ skillName: string;
tab: ScoutDetailTab;
findingId?: string;
}
@@ -38,7 +38,7 @@ export function openAgentFrom(search: unknown): OpenAgent | null {
: value.finding
? "output"
: "activity";
- return { slug: value.agent, tab, findingId: value.finding };
+ return { skillName: value.agent, tab, findingId: value.finding };
}
export function agentsPageActions() {
@@ -59,13 +59,13 @@ export function agentsPageActions() {
showTab: (tab: AgentsTab) =>
update((previous) => ({ ...keepSource(previous), tab }), false),
openAgent: (
- slug: string,
+ skillName: string,
options?: { tab?: ScoutDetailTab; findingId?: string },
) =>
update(
(previous) => ({
...keepSource(previous),
- agent: slug,
+ agent: skillName,
...(options?.tab ? { agentTab: options.tab } : {}),
...(options?.findingId ? { finding: options.findingId } : {}),
}),
@@ -92,14 +92,16 @@ export function useOpenAgent(): OpenAgent | null {
const packed = useRouterState({
select: (state) => {
const open = openAgentFrom(state.location.search);
- return open ? `${open.slug} ${open.tab} ${open.findingId ?? ""}` : null;
+ return open
+ ? `${open.skillName} ${open.tab} ${open.findingId ?? ""}`
+ : null;
},
});
return useMemo(() => {
if (!packed) return null;
- const [slug, tab, findingId] = packed.split(" ");
+ const [skillName, tab, findingId] = packed.split(" ");
return {
- slug,
+ skillName,
tab: tab as ScoutDetailTab,
findingId: findingId || undefined,
};
diff --git a/products/desktop/packages/ui/src/features/agents/components/AgentsView.tsx b/products/desktop/packages/ui/src/features/agents/components/AgentsView.tsx
index 747aa9f3819e..e438c68d8cf0 100644
--- a/products/desktop/packages/ui/src/features/agents/components/AgentsView.tsx
+++ b/products/desktop/packages/ui/src/features/agents/components/AgentsView.tsx
@@ -23,7 +23,7 @@ export function AgentsView() {
if (agent) {
return (
<ScoutDetailView
- skillSlug={agent.slug}
+ routeName={agent.skillName}
highlightFindingId={agent.findingId}
tab={agent.tab}
/>
diff --git a/products/desktop/packages/ui/src/features/inbox/components/DetailBackLink.tsx b/products/desktop/packages/ui/src/features/inbox/components/DetailBackLink.tsx
index f66784916786..b1c5d999b323 100644
--- a/products/desktop/packages/ui/src/features/inbox/components/DetailBackLink.tsx
+++ b/products/desktop/packages/ui/src/features/inbox/components/DetailBackLink.tsx
@@ -1,9 +1,6 @@
import { ArrowLeftIcon } from "@phosphor-icons/react";
import { humanizeReportTitle } from "@posthog/core/inbox/reportPresentation";
-import {
- prettifyScoutSkillName,
- scoutSkillNameFromSlug,
-} from "@posthog/core/scouts/scoutPresentation";
+import { prettifyScoutSkillName } from "@posthog/core/scouts/scoutPresentation";
import type { SignalReport } from "@posthog/shared/types";
import { useChannels } from "@posthog/ui/features/canvas/hooks/useChannels";
import { useReportPage } from "@posthog/ui/features/inbox/components/ReportPageContext";
@@ -113,7 +110,7 @@ function reportCrumbs(
if (source?.settingsCategory) {
crumbs.push({
label: source.label,
- render: source.agentSlug ? (
+ render: source.agentSkillName ? (
<Link
to="/settings/$category"
params={{ category: source.settingsCategory }}
@@ -122,9 +119,9 @@ function reportCrumbs(
exact
),
});
- if (source.agentSlug) {
+ if (source.agentSkillName) {
crumbs.push({
- label: prettifyScoutSkillName(scoutSkillNameFromSlug(source.agentSlug)),
+ label: prettifyScoutSkillName(source.agentSkillName),
render: exact,
});
}
diff --git a/products/desktop/packages/ui/src/features/scouts/components/NewAgentDialog.tsx b/products/desktop/packages/ui/src/features/scouts/components/NewAgentDialog.tsx
index 7355087a8795..2799528b8a16 100644
--- a/products/desktop/packages/ui/src/features/scouts/components/NewAgentDialog.tsx
+++ b/products/desktop/packages/ui/src/features/scouts/components/NewAgentDialog.tsx
@@ -21,8 +21,8 @@ const EXAMPLES = [
];
/**
- * Describe an agent in a sentence; PostHog drafts it as a `signals-scout-*`
- * skill in a cloud task and opens that task for review.
+ * Describe an agent in a sentence; PostHog drafts it as a scout skill in a
+ * cloud task and opens that task for review.
*/
export function NewAgentDialog({
open,
diff --git a/products/desktop/packages/ui/src/features/scouts/components/ScoutAttentionStrip.tsx b/products/desktop/packages/ui/src/features/scouts/components/ScoutAttentionStrip.tsx
index c80506d53ec7..7fc12a31b82d 100644
--- a/products/desktop/packages/ui/src/features/scouts/components/ScoutAttentionStrip.tsx
+++ b/products/desktop/packages/ui/src/features/scouts/components/ScoutAttentionStrip.tsx
@@ -3,7 +3,6 @@ import {
deriveScoutLifecycle,
type ScoutAttention,
type ScoutAttentionKind,
- scoutSkillSlug,
} from "@posthog/core/scouts/scoutPresentation";
import { Badge, Button } from "@posthog/quill";
import { useAgentsPageActions } from "@posthog/ui/features/agents/agentsPageStore";
@@ -41,7 +40,6 @@ export function ScoutAttentionStrip({
<div className="grid gap-3 sm:grid-cols-2 lg:grid-cols-3">
{shown.map(({ kind, config, detail }) => {
const { label, tone, Icon } = KIND_META[kind];
- const slug = scoutSkillSlug(config.skill_name);
const lifecycle = deriveScoutLifecycle(config);
const iconTone =
tone === "destructive" ? "text-(--red-11)" : "text-(--amber-11)";
@@ -55,7 +53,7 @@ export function ScoutAttentionStrip({
<div className="flex min-w-0 items-center gap-2">
<AgentNameLink
config={config}
- onOpen={() => openAgent(slug)}
+ onOpen={() => openAgent(config.skill_name)}
/>
<Badge variant={tone}>{label}</Badge>
</div>
@@ -94,7 +92,9 @@ export function ScoutAttentionStrip({
type="button"
variant="outline"
size="xs"
- onClick={() => openAgent(slug, { tab: "activity" })}
+ onClick={() =>
+ openAgent(config.skill_name, { tab: "activity" })
+ }
data-attr="scout-attention-open-runs"
>
{kind === "failing" ? "Open last run" : "Review runs"}
diff --git a/products/desktop/packages/ui/src/features/scouts/components/ScoutDetailView.tsx b/products/desktop/packages/ui/src/features/scouts/components/ScoutDetailView.tsx
index c3f8b501ddc6..e035f2998cef 100644
--- a/products/desktop/packages/ui/src/features/scouts/components/ScoutDetailView.tsx
+++ b/products/desktop/packages/ui/src/features/scouts/components/ScoutDetailView.tsx
@@ -3,7 +3,7 @@ import {
computeScoutRollups,
getScoutOrigin,
prettifyScoutSkillName,
- scoutSkillNameFromSlug,
+ resolveScoutRouteName,
} from "@posthog/core/scouts/scoutPresentation";
import { ANALYTICS_EVENTS } from "@posthog/shared";
import { useAgentsPageActions } from "@posthog/ui/features/agents/agentsPageStore";
@@ -19,18 +19,17 @@ import { ScoutDetailHeader } from "./ScoutDetailHeader";
import { ScoutOutputSection } from "./ScoutOutputSection";
export function ScoutDetailView({
- skillSlug,
+ routeName,
highlightFindingId,
tab,
}: {
- skillSlug: string;
+ /** Scout skill name from the route. Older links carry a stripped slug. */
+ routeName: string;
/** Emission id from a shared finding link – expanded and scrolled to when present. */
highlightFindingId?: string;
tab: ScoutDetailTab;
}) {
const projectId = useAuthStateValue((state) => state.currentProjectId);
- const skillName = scoutSkillNameFromSlug(skillSlug);
- const displayName = prettifyScoutSkillName(skillName);
const { showAgentTab, showTab } = useAgentsPageActions();
const configsQuery = useScoutConfigs();
@@ -39,6 +38,8 @@ export function ScoutDetailView({
isLoading: configsLoading,
isError: configsError,
} = configsQuery;
+ const skillName = resolveScoutRouteName(routeName, configs);
+ const displayName = prettifyScoutSkillName(skillName);
const runsQuery = useScoutRuns(skillName);
const {
data: runsWindow,
diff --git a/products/desktop/packages/ui/src/features/scouts/components/ScoutSuggestions.tsx b/products/desktop/packages/ui/src/features/scouts/components/ScoutSuggestions.tsx
index 22bb3384e612..2765ff5d6b2e 100644
--- a/products/desktop/packages/ui/src/features/scouts/components/ScoutSuggestions.tsx
+++ b/products/desktop/packages/ui/src/features/scouts/components/ScoutSuggestions.tsx
@@ -3,7 +3,6 @@ import type {
ScoutConfig,
ScoutSuggestionItem,
} from "@posthog/api-client/posthog-client";
-import { scoutSkillSlug } from "@posthog/core/scouts/scoutPresentation";
import {
suggestionActionLabel,
suggestionMetaLine,
@@ -111,7 +110,7 @@ function SuggestionCard({
variant="outline"
size="xs"
onClick={act}
- data-attr={`scout-suggestion-${scoutSkillSlug(item.skill_name)}`}
+ data-attr={`scout-suggestion-${item.skill_name}`}
>
{canTurnOn ? suggestionActionLabel(item) : "Draft it"}
</Button>
diff --git a/products/desktop/packages/ui/src/features/scouts/components/ScoutTableRow.tsx b/products/desktop/packages/ui/src/features/scouts/components/ScoutTableRow.tsx
index a5d797dd7be5..1f984e9cafc0 100644
--- a/products/desktop/packages/ui/src/features/scouts/components/ScoutTableRow.tsx
+++ b/products/desktop/packages/ui/src/features/scouts/components/ScoutTableRow.tsx
@@ -23,7 +23,6 @@ import {
type ScoutRunOutcome,
scoutCreatorDisplayName,
scoutRunOutcomeLabel,
- scoutSkillSlug,
} from "@posthog/core/scouts/scoutPresentation";
import {
Avatar,
@@ -122,7 +121,6 @@ function ScoutTableRowInner({
}) {
const { openAgent } = useAgentsPageActions();
const { runNow, isStarting } = useScoutRunNow(config, "fleet_list");
- const slug = scoutSkillSlug(config.skill_name);
const name = prettifyScoutSkillName(config.skill_name);
const latest = rollup?.latestRun ?? null;
const latestOutcome = latest ? deriveRunOutcome(latest, now) : null;
@@ -148,7 +146,7 @@ function ScoutTableRowInner({
/>
<AgentNameLink
config={config}
- onOpen={() => openAgent(slug)}
+ onOpen={() => openAgent(config.skill_name)}
dataAttr="scout-row-open"
/>
<span className="sr-only @xl:not-sr-only @xl:contents">
@@ -249,7 +247,7 @@ function ScoutTableRowInner({
Run now
</DropdownMenuItem>
<DropdownMenuItem
- onClick={() => openAgent(slug, { tab: "settings" })}
+ onClick={() => openAgent(config.skill_name, { tab: "settings" })}
>
<GearSixIcon size={13} />
Settings
diff --git a/products/desktop/packages/ui/src/features/scouts/hooks/useScoutDeepLink.ts b/products/desktop/packages/ui/src/features/scouts/hooks/useScoutDeepLink.ts
index ba67d0aef0bd..f34544e46580 100644
--- a/products/desktop/packages/ui/src/features/scouts/hooks/useScoutDeepLink.ts
+++ b/products/desktop/packages/ui/src/features/scouts/hooks/useScoutDeepLink.ts
@@ -19,7 +19,7 @@ import { useCallback, useEffect } from "react";
const log = logger.scope("scout-deep-link");
/**
- * Hook that handles scout detail deep links (`<scheme>://scout/{skillSlug}?finding={id}`,
+ * Hook that handles scout detail deep links (`<scheme>://scout/{skillName}?finding={id}`,
* e.g. `posthog-code://…` in production and `posthog-code-dev://…` in local dev)
* and opens the agent in Settings, expanding the finding when one is supplied.
*
@@ -45,9 +45,9 @@ export function useScoutDeepLink() {
);
const openScout = useCallback(
- (skillSlug: string, findingId?: string) => {
+ (skillName: string, findingId?: string) => {
log.info(
- `Opening scout from deep link: skillSlug=${skillSlug} findingId=${findingId ?? "(none)"}`,
+ `Opening scout from deep link: skillName=${skillName} findingId=${findingId ?? "(none)"}`,
);
const destination = {
href: "/settings/agents",
@@ -59,22 +59,22 @@ export function useScoutDeepLink() {
} else {
prepareSettingsPage();
}
- agentsPageActions().openAgent(skillSlug, { findingId });
+ agentsPageActions().openAgent(skillName, { findingId });
});
},
[tabsClient],
);
useEffect(() => {
- if (pendingDeepLink.data?.skillSlug) {
- openScout(pendingDeepLink.data.skillSlug, pendingDeepLink.data.findingId);
+ if (pendingDeepLink.data?.skillName) {
+ openScout(pendingDeepLink.data.skillName, pendingDeepLink.data.findingId);
}
}, [pendingDeepLink.data, openScout]);
useSubscription(
trpcReact.deepLink.onOpenScout.subscriptionOptions(undefined, {
onData: (data) => {
- if (data?.skillSlug) openScout(data.skillSlug, data.findingId);
+ if (data?.skillName) openScout(data.skillName, data.findingId);
},
}),
);
diff --git a/products/desktop/packages/ui/src/router/reportNavigation.ts b/products/desktop/packages/ui/src/router/reportNavigation.ts
index c7a97ee86eb1..e5efebae9775 100644
--- a/products/desktop/packages/ui/src/router/reportNavigation.ts
+++ b/products/desktop/packages/ui/src/router/reportNavigation.ts
@@ -11,7 +11,7 @@ export interface NavigationSource {
path: string;
label: string;
settingsCategory: SettingsCategory | null;
- agentSlug: string | null;
+ agentSkillName: string | null;
spaceId: string | null;
feedId: string | null;
}
@@ -90,7 +90,7 @@ export function resolveNavigationSource(
path,
label: sourceLabel(path, category),
settingsCategory: category,
- agentSlug: valid.match(/[?&]agent=([^&#]+)/)?.[1] ?? null,
+ agentSkillName: valid.match(/[?&]agent=([^&#]+)/)?.[1] ?? null,
spaceId: path.match(/^\/spaces\/([^/]+)/)?.[1] ?? null,
feedId: path.match(/^\/feeds\/([^/]+)/)?.[1] ?? null,
};