Skip to content

feat(agent-prompt): add claude desktop, vs code and web destinations - #112270

Merged
trunk-io[bot] merged 4 commits into
masterfrom
rafa/agent-prompt-deep-links
Oct 6, 2026
Merged

trunk-io[bot] merged 4 commits into
masterfrom
rafa/agent-prompt-deep-links

Conversation

@rafaeelaudibert

@rafaeelaudibert rafaeelaudibert commented Oct 6, 2026 •

Copy link
Copy Markdown
Member

Problem

  • People who use Claude Desktop, Claude Code in VS Code, or Claude Code on the web cannot send a PostHog prompt there. The agent menus only offer the Claude Code CLI, Cursor and Codex.
  • The error tracking stack trace button sends a broken repository to agents. Claude Code then opens in the home directory instead of the repository.
  • The cause: posthog-cli stores repo_name as the bare name (posthog), and every agent expects owner/repo.

Changes

  • The agent menus offer three new destinations. Both the error tracking stack trace button and the inbox "Copy prompt for your agent" menu get them:
Menu label Link Opens the repository
Claude Desktop claude://code/new?q=… No, the link only takes an absolute folder path
Claude Code in VS Code vscode://anthropic.claude-code/open?prompt=… No
Claude Code on the web https://claude.ai/code?prompt=…&repositories=owner/repo Yes
  • The existing "Claude Code" entry is now "Claude Code CLI", so it reads apart from the new Claude entries. Its claude-code key stays, so remembered choices and the agent analytics property carry over.
  • Codex now opens the matching local workspace. The link passes originUrl=https://github.com/owner/repo, and Codex compares host, owner and repo, so SSH clones match too.
  • The stack trace button derives the repository from the release's remote URL. It sends one only for GitHub remotes, because every agent repository parameter assumes GitHub.
  • Long prompts no longer produce oversized links. Cursor and claude.ai links are capped by total URL length, since Cursor double-encodes the prompt.
  • A prompt cut in the middle of an emoji no longer throws a URIError, which made the button do nothing.
  • Mechanical: each inbox menu destination has its own open function. Only the claude.ai link passes noopener, and the other links keep their two-argument window.open call.
  • The menu is wider so the new labels fit. A shared style capped it at 200px, so the old w-56 never applied.
Before After

Link formats come from the vendor docs: Claude Code deep links, Claude Desktop, VS Code extension, Claude Code on the web, Codex, Cursor.

How did you test this code?

  • Jest cases in AgentPromptButton.test.ts and gitMetadataParser.spec.ts. Frontend typecheck passes locally.
  • Screenshots come from the AgentPromptButton Storybook story, before on master and after on this branch.
  • Not checked: clicking each link in the real apps. The 8,000-character cap for claude.ai is an estimate of common web server limits, not a documented number.

Test rationale:

  • The URL length cases catch a Cursor or claude.ai link that grows past its cap when encoding inflates the prompt. No earlier test covered link length.
  • The emoji case catches the URIError at the truncation boundary.
  • The new getGitHubRepositorySlug cases extend the existing parser spec. They catch a bare name, a GitLab remote, or a remote with a credential reaching an agent link.
  • The builder table extends the existing PostHog Desktop link test with the new parameter names.

Release status

  • No feature flag controls this change

Docs update

None. No doc under docs/ covers these menus.

🤖 Agent context

Autonomy: Human-driven (agent-assisted)

Agent: Claude Code, Claude Opus 5.5

  • Skills invoked: /writing-ui-components, /writing-user-facing-copy, /writing-tests, /writing-code-comments, /stacking-prs, /writing-pr-descriptions.
  • The local CodeRabbit pass was skipped, as the author prefers.
  • The first draft built the Codex originUrl from the bare repo_name. Reading the Codex app bundle showed it parses both URLs before matching, so a canonical GitHub URL from a correct slug is enough.
  • Overlaps with open PRs feat(desktop): send desktop entry points to posthog ai for non-staff #109352 (hides PostHog Desktop from non-staff) and feat(field-notes): open field notes to everyone and send them to an agent #95363 (moves the link builders into agentDeepLinks.ts). Whichever lands later needs a rebase.
  • A stacked PR on top of this one adds the button to the MCP hint surfaces.

🤖 Generated with Claude Code

@rafaeelaudibert rafaeelaudibert self-assigned this Oct 6, 2026
@trunk-io

trunk-io Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

😎 This pull request was merged.

@github-actions

github-actions Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

🤖 CI report

✅ Trunk lane — non-backend lane

This PR is assigned to the non-backend lane. It does not run backend Python tests and may merge in parallel with PRs in other lanes.

⚠️ Complexity (TypeScript) — 1 function above the limit (max 16)

Cyclomatic complexity above the limit in changed typescript files (10 for production files, 15 for test files). Warn only: worth simplifying when you next touch these functions.

Function Location Complexity Limit
AgentPromptButton frontend/src/lib/components/AgentPromptButton/AgentPromptButton.tsx:265 16 10
✅ Duplication (Python) — clean

New Python code duplication introduced by this branch. Fails at 70+ tokens in app code, or 150+ tokens when both copies live in test files. Advisory while the gate proves itself: extract a shared helper instead of copying.

✅ Duplication (TypeScript) — clean

New TypeScript code duplication introduced by this branch. Fails at 70+ tokens in app code, or 150+ tokens when both copies live in test files. Advisory while the gate proves itself: extract a shared helper instead of copying.

⚠️ Comment density — 4% of added code lines are comments (9 of 210)

This section warns when comments are more than 3% of the code lines a PR adds, and alerts above 6%. Before agent-assisted PRs, the typical share was about 2%. Only full-line comments count. Docstrings, generated files, snapshots, migrations, and workflow files are left out.

Comments that restate the code, record how the change came about, or narrate the next line add noise for the next reader. Keep the comments that explain a reason the code cannot show, and remove the rest. See .agents/skills/writing-code-comments/SKILL.md for the house rules.

Files with the most added comment lines:

File Comment lines Added lines
frontend/src/lib/components/AgentPromptButton/AgentPromptButton.tsx 9 96

This check does not block merging. It updates on every push and clears when the share drops.

⚠️ Bundle size — 🔺 +431 B (+0.0%)

Uncompressed size of every built .js bundle, compared against the base branch.

Total: 76.00 MiB · 🔺 +431 B (+0.0%)

No file changed by more than 1000 B.

Posted automatically by build-bundle-size-report · uncompressed bytes from dist-report

⚠️ Eager graph — 2 over budget

How much code each root ships on the eager path — downloaded and parsed before the surface is interactive. Measured from the esbuild output chunks (post-tree-shake, static imports only); lazy import() / React.lazy chunks are not counted.

Root Eager (shipped) Δ vs base Budget
entry (logged-out pages, app bootstrap)
src/index.tsx
1.64 MiB · 23 files no change █████████░ 88.9% of 1.84 MiB
logged-out boot: index + App + bootApp (preloaded by every page, including /login)
src/index.tsx + src/scenes/App.tsx + src/scenes/bootApp.ts
3.72 MiB · 663 files no change █████████░ 92.3% of 4.03 MiB
authenticated shell (every logged-in page)
src/scenes/AuthenticatedShell.tsx
7.62 MiB · 2,415 files no change █████████░ 91.4% of 8.34 MiB
🟡 dashboard scene
src/scenes/dashboard/Dashboard.tsx
13.90 MiB · 4,917 files 🔺 +207 B (+0.0%) ██████████ 103.2% of 13.48 MiB
today home path
src/scenes/AuthenticatedShell.tsx + src/scenes/project-homepage/ProjectHomepage.tsx + src/scenes/project-homepage/today/TodayHome.tsx
7.64 MiB · 2,427 files no change █████████░ 89.0% of 8.58 MiB
🟡 events scene
src/scenes/activity/explore/EventsScene.tsx
13.63 MiB · 4,789 files 🔺 +207 B (+0.0%) ██████████ 107.9% of 12.64 MiB
replay detail scene
src/scenes/session-recordings/detail/SessionRecordingDetail.tsx
12.13 MiB · 4,142 files 🔺 +207 B (+0.0%) ████████░░ 77.2% of 15.72 MiB

🟢 node_modules/monaco-editor/ stays out of src/index.tsx
🟢 src/lib/components/ActivityLog/describers stays out of src/index.tsx
🟢 node_modules/@posthog/brand/dist/generated/hoggies/svg/ stays out of src/index.tsx
🟢 node_modules/@posthog/brand/dist/generated/hoggies/components/ stays out of src/index.tsx
🟢 node_modules/monaco-editor/ stays out of src/index.tsx + src/scenes/App.tsx + src/scenes/bootApp.ts
🟢 src/layout/navigation-3000/navigationLogic.tsx stays out of src/index.tsx + src/scenes/App.tsx + src/scenes/bootApp.ts
🟢 src/scenes/dashboard/dashboardLogic.tsx stays out of src/index.tsx + src/scenes/App.tsx + src/scenes/bootApp.ts
🟢 src/lib/lemon-ui/LemonMarkdown/ stays out of src/index.tsx + src/scenes/App.tsx + src/scenes/bootApp.ts
🟢 src/lib/components/RichContentEditor/ stays out of src/index.tsx + src/scenes/App.tsx + src/scenes/bootApp.ts
🟢 src/lib/components/CodeSnippet/ stays out of src/index.tsx + src/scenes/App.tsx + src/scenes/bootApp.ts
🟢 src/taxonomy/core-filter-definitions-by-group.json stays out of src/index.tsx + src/scenes/App.tsx + src/scenes/bootApp.ts
🟢 node_modules/monaco-editor/ stays out of src/scenes/AuthenticatedShell.tsx
🟢 src/lib/components/ActivityLog/describers stays out of src/scenes/AuthenticatedShell.tsx
🟢 products/dashboards/frontend/widgets/previews/ stays out of src/scenes/AuthenticatedShell.tsx
🟢 src/scenes/session-recordings/player/sessionRecordingPlayerLogic.ts stays out of src/scenes/AuthenticatedShell.tsx
🟢 zod/v4/locales/de.js stays out of src/scenes/AuthenticatedShell.tsx
🟢 node_modules/@posthog/brand/dist/generated/hoggies/svg/ stays out of src/scenes/AuthenticatedShell.tsx
🟢 node_modules/@posthog/brand/dist/generated/hoggies/components/ stays out of src/scenes/AuthenticatedShell.tsx
🟢 src/scenes/project-homepage/ai-first/AiFirstHomepage.tsx stays out of src/scenes/AuthenticatedShell.tsx + src/scenes/project-homepage/ProjectHomepage.tsx + src/scenes/project-homepage/today/TodayHome.tsx
🟢 src/scenes/project-homepage/today/TodayReportPage.tsx stays out of src/scenes/AuthenticatedShell.tsx + src/scenes/project-homepage/ProjectHomepage.tsx + src/scenes/project-homepage/today/TodayHome.tsx
🟢 src/queries/Query/Query.tsx stays out of src/scenes/AuthenticatedShell.tsx + src/scenes/project-homepage/ProjectHomepage.tsx + src/scenes/project-homepage/today/TodayHome.tsx

Largest files eagerly shipped from src/index.tsx
Size File
126.8 KiB ../node_modules/.pnpm/react-dom@18.3.1_react@18.3.1/node_modules/react-dom/cjs/react-dom.production.min.js
24.6 KiB ../node_modules/.pnpm/buffer@6.0.3/node_modules/buffer/index.js
6.3 KiB ../node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react.production.min.js
4.5 KiB ../node_modules/.pnpm/@jspm+core@2.1.0/node_modules/@jspm/core/nodelibs/browser/process.js
3.9 KiB ../node_modules/.pnpm/scheduler@0.23.2/node_modules/scheduler/cjs/scheduler.production.min.js
1.4 KiB ../node_modules/.pnpm/base64-js@1.5.1/node_modules/base64-js/index.js
1.3 KiB src/index.tsx
1.3 KiB src/RootErrorBoundary.tsx
912 B ../node_modules/.pnpm/ieee754@1.2.1/node_modules/ieee754/index.js
839 B src/scenes/ChunkLoadErrorBoundary.tsx
Largest files eagerly shipped from src/index.tsx + src/scenes/App.tsx + src/scenes/bootApp.ts
Size File
306.2 KiB ../node_modules/.pnpm/posthog-js@1.435.5_@types+react@18.3.27_react@18.3.1/node_modules/posthog-js/dist/module.mjs
220.3 KiB ../node_modules/.pnpm/@posthog+icons@0.38.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@posthog/icons/dist/posthog-icons.es.js
126.8 KiB ../node_modules/.pnpm/react-dom@18.3.1_react@18.3.1/node_modules/react-dom/cjs/react-dom.production.min.js
99.7 KiB src/lib/api.ts
90.6 KiB src/products.tsx
68.7 KiB src/lib/lemon-ui/icons/icons.tsx
40.7 KiB src/lib/utils/eventUsageLogic.ts
38.7 KiB ../node_modules/.pnpm/@dnd-kit+core@6.0.8_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@dnd-kit/core/dist/core.esm.js
33.9 KiB ../node_modules/.pnpm/kea@4.0.0-pre.6_patch_hash=139b8d1f1304f9d9da452a9a1244c94ea679dbcb85687d8999563146879fb6f5_react@18.3.1/node_modules/kea/lib/index.cjs.js
29.0 KiB ../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/schemas.js
Largest files eagerly shipped from src/scenes/AuthenticatedShell.tsx
Size File
306.2 KiB ../node_modules/.pnpm/posthog-js@1.435.5_@types+react@18.3.27_react@18.3.1/node_modules/posthog-js/dist/module.mjs
280.3 KiB src/taxonomy/core-filter-definitions-by-group.json
220.3 KiB ../node_modules/.pnpm/@posthog+icons@0.38.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@posthog/icons/dist/posthog-icons.es.js
153.7 KiB ../node_modules/.pnpm/re2js@0.4.1/node_modules/re2js/build/index.esm.js
126.8 KiB ../node_modules/.pnpm/react-dom@18.3.1_react@18.3.1/node_modules/react-dom/cjs/react-dom.production.min.js
112.3 KiB ../packages/quill/packages/quill/dist/index.js
99.7 KiB src/lib/api.ts
93.3 KiB ../node_modules/.pnpm/prosemirror-view@1.40.1/node_modules/prosemirror-view/dist/index.js
90.6 KiB ../node_modules/.pnpm/@tiptap+core@3.20.6_@tiptap+pm@3.20.6/node_modules/@tiptap/core/dist/index.js
90.6 KiB src/products.tsx
Largest files eagerly shipped from src/scenes/dashboard/Dashboard.tsx
Size File
315.5 KiB ../node_modules/.pnpm/posthog-js@1.435.5_@types+react@18.3.27_react@18.3.1/node_modules/posthog-js/dist/rrweb.js
306.2 KiB ../node_modules/.pnpm/posthog-js@1.435.5_@types+react@18.3.27_react@18.3.1/node_modules/posthog-js/dist/module.mjs
280.3 KiB src/taxonomy/core-filter-definitions-by-group.json
220.3 KiB ../node_modules/.pnpm/@posthog+icons@0.38.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@posthog/icons/dist/posthog-icons.es.js
181.8 KiB src/queries/validators.js
153.7 KiB ../node_modules/.pnpm/re2js@0.4.1/node_modules/re2js/build/index.esm.js
126.8 KiB ../node_modules/.pnpm/react-dom@18.3.1_react@18.3.1/node_modules/react-dom/cjs/react-dom.production.min.js
112.3 KiB ../packages/quill/packages/quill/dist/index.js
99.7 KiB src/lib/api.ts
93.3 KiB ../node_modules/.pnpm/prosemirror-view@1.40.1/node_modules/prosemirror-view/dist/index.js
Largest files eagerly shipped from src/scenes/AuthenticatedShell.tsx + src/scenes/project-homepage/ProjectHomepage.tsx + src/scenes/project-homepage/today/TodayHome.tsx
Size File
306.2 KiB ../node_modules/.pnpm/posthog-js@1.435.5_@types+react@18.3.27_react@18.3.1/node_modules/posthog-js/dist/module.mjs
280.3 KiB src/taxonomy/core-filter-definitions-by-group.json
220.3 KiB ../node_modules/.pnpm/@posthog+icons@0.38.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@posthog/icons/dist/posthog-icons.es.js
153.7 KiB ../node_modules/.pnpm/re2js@0.4.1/node_modules/re2js/build/index.esm.js
126.8 KiB ../node_modules/.pnpm/react-dom@18.3.1_react@18.3.1/node_modules/react-dom/cjs/react-dom.production.min.js
112.3 KiB ../packages/quill/packages/quill/dist/index.js
99.7 KiB src/lib/api.ts
93.3 KiB ../node_modules/.pnpm/prosemirror-view@1.40.1/node_modules/prosemirror-view/dist/index.js
90.6 KiB ../node_modules/.pnpm/@tiptap+core@3.20.6_@tiptap+pm@3.20.6/node_modules/@tiptap/core/dist/index.js
90.6 KiB src/products.tsx
Largest files eagerly shipped from src/scenes/activity/explore/EventsScene.tsx
Size File
315.5 KiB ../node_modules/.pnpm/posthog-js@1.435.5_@types+react@18.3.27_react@18.3.1/node_modules/posthog-js/dist/rrweb.js
306.2 KiB ../node_modules/.pnpm/posthog-js@1.435.5_@types+react@18.3.27_react@18.3.1/node_modules/posthog-js/dist/module.mjs
280.3 KiB src/taxonomy/core-filter-definitions-by-group.json
220.3 KiB ../node_modules/.pnpm/@posthog+icons@0.38.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@posthog/icons/dist/posthog-icons.es.js
181.8 KiB src/queries/validators.js
153.7 KiB ../node_modules/.pnpm/re2js@0.4.1/node_modules/re2js/build/index.esm.js
126.8 KiB ../node_modules/.pnpm/react-dom@18.3.1_react@18.3.1/node_modules/react-dom/cjs/react-dom.production.min.js
112.3 KiB ../packages/quill/packages/quill/dist/index.js
99.7 KiB src/lib/api.ts
93.3 KiB ../node_modules/.pnpm/prosemirror-view@1.40.1/node_modules/prosemirror-view/dist/index.js
Largest files eagerly shipped from src/scenes/session-recordings/detail/SessionRecordingDetail.tsx
Size File
315.5 KiB ../node_modules/.pnpm/posthog-js@1.435.5_@types+react@18.3.27_react@18.3.1/node_modules/posthog-js/dist/rrweb.js
306.2 KiB ../node_modules/.pnpm/posthog-js@1.435.5_@types+react@18.3.27_react@18.3.1/node_modules/posthog-js/dist/module.mjs
280.3 KiB src/taxonomy/core-filter-definitions-by-group.json
220.3 KiB ../node_modules/.pnpm/@posthog+icons@0.38.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@posthog/icons/dist/posthog-icons.es.js
181.8 KiB src/queries/validators.js
153.7 KiB ../node_modules/.pnpm/re2js@0.4.1/node_modules/re2js/build/index.esm.js
126.8 KiB ../node_modules/.pnpm/react-dom@18.3.1_react@18.3.1/node_modules/react-dom/cjs/react-dom.production.min.js
112.3 KiB ../packages/quill/packages/quill/dist/index.js
99.7 KiB src/lib/api.ts
93.3 KiB ../node_modules/.pnpm/prosemirror-view@1.40.1/node_modules/prosemirror-view/dist/index.js

Posted automatically by check-eager-graph · sizes are eager output bytes (shipped, post-tree-shake) from the esbuild metafile · part of #32479

✅ Toolbar bundle — eager 2.21 MiB within budget

What the toolbar ships to customer pages, measured from the esbuild output (minified, post-tree-shake). The eager set is the entry plus everything statically imported from it — fetched before any feature runs; deferred chunks load lazily. The eager guardrail is 5.72 MiB. Each output file must also stay below 10 MB, where CloudFront stops compressing it. The module boundary is enforced separately by check-toolbar-graph.

Metric Size Δ vs base Budget
Eager (shipped)
entry + static imports
2.21 MiB · 19 files no change ████░░░░░░ 38.7% of 5.72 MiB
Deferred (lazy) 2.12 MiB · 44 files no change n/a — loads on demand
Loader dist/toolbar.js 1.2 KiB no change █░░░░░░░░░ 6.0% of 19.5 KiB
Largest eagerly-shipped chunks
Size File
850.6 KiB dist/toolbar/toolbar-app-5BH4NJL4.css
657.4 KiB dist/toolbar/chunk-chunk-R75Z5TYV.js
259.4 KiB dist/toolbar/chunk-chunk-6EL3FW4B.js
138.2 KiB dist/toolbar/chunk-chunk-2GNJAOKU.js
131.8 KiB dist/toolbar/chunk-chunk-FDH2IBXT.js
75.2 KiB dist/toolbar/toolbar-app-2PA223GW.js
69.0 KiB dist/toolbar/chunk-chunk-TSAL54PB.js
35.6 KiB dist/toolbar/chunk-chunk-46UEXYQR.js
21.0 KiB dist/toolbar/chunk-chunk-Q5QJDMUL.js
6.8 KiB dist/toolbar/chunk-chunk-DV7IWQNF.js

Posted automatically by check-toolbar-size · sizes are toolbar output bytes (shipped, post-tree-shake) from the esbuild metafile

✅ Dist folder size — 🔺 +16.2 KiB (+0.0%)

Total size of the built frontend/dist folder (all assets), compared against the base branch.

Total: 998.63 MiB · 🔺 +16.2 KiB (+0.0%)

✅ Playwright — all passed

All tests passed.

View test results →

✅ Hogbox preview — ready, open the preview

▶ Open the preview

🔑 Login test@posthog.com / 12345678 (demo data)
🧩 Running this PR's backend and frontend, on the PostHog :master base
🔗 Link stable across rebuilds: a re-push swaps the box underneath, the URL stays
🔒 Access tailnet only (PostHog VPN)
🛠️ Admin inspect & debug state in hogland
💤 Idle sleeps after ~30 min idle (snapshot to S3, zero node cost) and wakes on your next visit in ~30s, behind a brief "waking up" screen

commit 00811bf · box box-81a0f9ce5af8 · ready in 680s (push → usable) · build log · rebuilds on every push, torn down on close

@greptile-apps

greptile-apps Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Retrigger

[Medium risk] Adds new agent destinations to the code assistance UI.

The PR’s behavior appears safe to merge, but the repository’s absent-result requirement should be satisfied first.

Reviews (2) · Last reviewed commit: "fix(signals): open inbox agent links wit..."

@coderabbitai

coderabbitai Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

⚙️ Run configuration
  • Configuration used: Repository: PostHog/posthog/.coderabbit.yaml
  • Review profile: QUIET
  • Plan: Enterprise
  • Run ID: 542465d3-4e77-4543-91e9-6b74e6832c1c
📥 Commits

Reviewing files that changed from the base of the PR and between f951599 and 00811bf.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: PostHog/posthog/.coderabbit.yaml
  • Review profile: QUIET
  • Plan: Enterprise
  • Run ID: d5f75f42-444c-4b63-ac8c-85f2c4eacf2a
📥 Commits

Reviewing files that changed from the base of the PR and between 1b2e2d1 and f951599.

📒 Files selected for processing (3)
  • frontend/snapshots.yml
  • products/signals/frontend/inbox/components/detail/ImplementButton.test.tsx
  • products/signals/frontend/inbox/components/detail/ImplementButton.tsx

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 8 remain after this review.


📝 Walkthrough

Walkthrough

The change adds GitHub repository slug extraction and uses validated slugs as prompt context. Agent prompt links now support additional Claude destinations and Codex repository context. Prompt truncation uses agent-specific limits and URL-length caps. The agent menus expose the new destinations, and tests cover generated links, length limits, and emoji handling.

Priority: ⬇️ Low

Merge Risk: 🔵 Low · up to f9515

People using URL-form GitHub SSH remotes may open an agent prompt without repository context. The affected workflow is limited, but this context loss remains an open concern.

Security Architecture Review

Security architecture risk: 🔵 Low · up to f9515

The new destinations can receive error details and repository context, but opening them still requires user action. Destination addresses are fixed, supplied values are encoded, and the change does not itself grant credentials or execution permissions. How the receiving applications handle this information remains outside the reviewed code.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The inspected change exposes the currently selected report reference or stack-trace content to additional user-chosen destinations. Repository-aware receivers may use the supplied slug to select a workspace, but subsequent repository access and tool authority depend on their existing configuration and permissions, which were not inspected.

Security Findings and Attack Paths

  • inferred — Attacker-influenced exception text could reach a receiving application when a user opens the generated content. Interpolating that text into fix or explanation instructions predates this PR; the PR adds receiving destinations. User-driven dispatch and the absence of direct execution or credential transfer counter an automatic-execution claim, but downstream instruction handling remains unverified.

Trust Boundaries and Controls

  • observed — Outgoing values are query-encoded and cannot directly replace the fixed destination scheme or host. Web openings use noopener,noreferrer. Dispatch remains behind explicit UI actions, and the shared component resolves remembered keys only against currently available destinations.

Resilience and Maintainability Implications

  • observed — Remembered selection is a browser-local preference, not an execution reservation. Storage failures are caught, cross-tab updates change preference state without launching a destination, and unavailable keys fall back to configured choices. Opening is best-effort: the inspected code neither confirms receiver success nor automatically retries, so repeated clicks can repeat an opening without a background recovery operation.

Hardening Proposals

  • proposed — Consider an outgoing-content preview or redaction option for external web sharing, since stack traces can include exception values and source context. This would improve disclosure awareness; it is not a verified missing authorization control or vulnerability.
🚥 Pre-merge checks | ✅ 1
✅ Passed checks (1 passed)
Check name Status Explanation
Description check ✅ Passed The description explains the user problem and visible changes, includes screenshots, test rationale and limits, release status, docs update, and agent context. The agent context omits a session link a…
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Note

Quiet mode is enabled, so only the most important comments were posted inline. Other review comments are grouped below.

🟡 Other comments (1)
frontend/src/lib/components/Git/gitMetadataParser.ts-51-53 (1)

51-53: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Handle URL-form SSH remotes before rejecting the GitHub slug.

For ssh://git@github.com/PostHog/posthog.git, the SSH parser treats the scheme colon as its scp-style separator. The newly added helper then returns undefined. Parse URL-form SSH remotes separately and add a regression case for this input.


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository: PostHog/posthog/.coderabbit.yaml
  • Review profile: QUIET
  • Plan: Enterprise
  • Run ID: 9b7e2192-dfe3-4dc8-bbed-71d5571d7a39
📥 Commits

Reviewing files that changed from the base of the PR and between 5d280e7 and 1b2e2d1.

📒 Files selected for processing (7)
  • frontend/src/lib/components/AgentPromptButton/AgentPromptButton.test.ts
  • frontend/src/lib/components/AgentPromptButton/AgentPromptButton.tsx
  • frontend/src/lib/components/AgentPromptButton/index.ts
  • frontend/src/lib/components/Git/gitMetadataParser.spec.ts
  • frontend/src/lib/components/Git/gitMetadataParser.ts
  • products/error_tracking/frontend/components/ExceptionCard/Tabs/StackTraceTab/StackTraceActions.tsx
  • products/signals/frontend/inbox/components/detail/ImplementButton.tsx

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 10 remain after this review.

Comment on lines +5 to +7
buildClaudeCodeVSCodeDeepLink,
buildClaudeCodeWebLink,
buildClaudeDesktopDeepLink,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

sed -n '1,65p' frontend/src/lib/components/AgentPromptButton/index.ts
rg -n 'buildClaudeCodeVSCodeDeepLink|buildClaudeCodeWebLink|buildClaudeDesktopDeepLink' frontend/src/lib/components/AgentPromptButton products/signals/frontend/inbox/components/detail/ImplementButton.tsx

Repository: PostHog/posthog

Length of output: 3068


🏁 Script executed:

set -eu
printf '%s\n' '--- focused diff ---'
git diff --no-ext-diff --unified=8 5d280e7503147d30fd75a706ae64d87b7f1e6edd 1b2e2d11ae4a68a9419bafd5e197d4ac8ddb2676 -- frontend/src/lib/components/AgentPromptButton/index.ts frontend/src/lib/components/AgentPromptButton/AgentPromptButton.tsx products/signals/frontend/inbox/components/detail/ImplementButton.tsx
printf '%s\n' '--- index ---'
nl -ba frontend/src/lib/components/AgentPromptButton/index.ts
printf '%s\n' '--- builder declarations and exports ---'
nl -ba frontend/src/lib/components/AgentPromptButton/AgentPromptButton.tsx | sed -n '150,180p'
printf '%s\n' '--- consumer imports ---'
nl -ba products/signals/frontend/inbox/components/detail/ImplementButton.tsx | sed -n '1,22p'
printf '%s\n' '--- guidance candidates ---'
rg --files -g 'AGENTS.md' -g '*writing-ui-components*' -g 'SKILL.md' frontend .claude .agents 2>/dev/null | rg '(^|/)(AGENTS\.md|[^/]*writing-ui-components[^/]*|[^/]+/SKILL\.md)$' | rg 'frontend/src|writing-ui-components' || test "$?" -eq 1
printf '%s\n' '--- relevant guidance text ---'
rg -n -F -e 'Every symbol has exactly one home' -e 'multi-PR migration' -e 'No re-export shims' -e 'Avoid re-export shims' frontend .claude .agents 2>/dev/null || test "$?" -eq 1

Repository: PostHog/posthog

Length of output: 19813


Keep one import path for the new builders.

The builders are already exported from AgentPromptButton.tsx. Re-exporting them from the index gives them a second import path. Remove the index re-exports and import the builders directly at the call site.

Suggested fix
diff --git a/frontend/src/lib/components/AgentPromptButton/index.ts b/frontend/src/lib/components/AgentPromptButton/index.ts
@@
-    buildClaudeCodeVSCodeDeepLink,
-    buildClaudeCodeWebLink,
-    buildClaudeDesktopDeepLink,
diff --git a/products/signals/frontend/inbox/components/detail/ImplementButton.tsx b/products/signals/frontend/inbox/components/detail/ImplementButton.tsx
@@
-    buildClaudeCodeVSCodeDeepLink,
-    buildClaudeCodeWebLink,
-    buildClaudeDesktopDeepLink,
@@
 } from 'lib/components/AgentPromptButton'
+import {
+    buildClaudeCodeVSCodeDeepLink,
+    buildClaudeCodeWebLink,
+    buildClaudeDesktopDeepLink,
+} from 'lib/components/AgentPromptButton/AgentPromptButton'
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
buildClaudeCodeVSCodeDeepLink,
buildClaudeCodeWebLink,
buildClaudeDesktopDeepLink,

@hosthog

hosthog Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

HostHog preview — posthog-desktop-web

The previews for this PR have been torn down and no longer serve.

@posthog

posthog Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

✅ Visual changes approved by @rafaeelaudibert — baseline updated in 5c6b947.

View this run in PostHog

2 changed.

Changed

Snapshot Before After
components-agentpromptbutton--open-dropdown--dark before after
components-agentpromptbutton--open-dropdown--light before after

Install the Visual Review Chrome extension to see visual review results at the top of your pull requests.

@trunk-io

trunk-io Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Static Badge   Static Badge   Static Badge

Failed Test Failure Summary Logs
compareTopLevelSections() reports a modifiers change when the current query overrides the team default A TypeError occurred because the code attempted to access the 'add' property of an undefined object. Logs ↗︎

View Full Report ↗︎ ⋅ Docs

@rafaeelaudibert
rafaeelaudibert requested review from a team, MattBro and fercgomes and removed request for a team October 6, 2026 02:40
@rafaeelaudibert
rafaeelaudibert marked this pull request as ready for review October 6, 2026 02:51
@rafaeelaudibert rafaeelaudibert added the stamphog Request AI approval (no full review) label Oct 6, 2026
@rafaeelaudibert
rafaeelaudibert requested a review from a team October 6, 2026 02:51
@parameterai

parameterai Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Risk: No findings

This PR adds Claude Desktop, Claude Code in VS Code, and Claude Code on the web as agent-prompt destinations, switches the stack trace button to a validated GitHub slug derived from the release's remote URL, and caps URL length for Cursor and claude.ai links. All dynamic link parameters are encodeURIComponent'd into fixed-scheme URLs, and the new slug parser only accepts an exact github.com host plus a strict slug pattern, so I found no injection, redirect, or cross-tenant exposure introduced by this change.

Sentinel reviewed f951599 · Review settings

Comment on lines +47 to +49
static getGitHubRepositorySlug(remote_url?: string): string | undefined {
if (!remote_url) {
return undefined

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Absent results use undefined

getGitHubRepositorySlug returns undefined when the remote is missing, is not GitHub, or has an invalid slug. The repository requires null for an intentionally absent function result. Return null consistently and adapt the optional repository prop at the call site. This requirement must be satisfied before merging.

Rule Used: Use 'null' instead of 'undefined' to indicate an intended lack of result in functions. (source)

Learned From
PostHog/posthog#32556

Prompt To Fix With AI
This is a comment left during a code review.
Path: frontend/src/lib/components/Git/gitMetadataParser.ts
Line: 47-49

Comment:
**Absent results use undefined**

`getGitHubRepositorySlug` returns `undefined` when the remote is missing, is not GitHub, or has an invalid slug. The repository requires `null` for an intentionally absent function result. Return `null` consistently and adapt the optional `repository` prop at the call site. This requirement must be satisfied before merging.

**Rule Used:** Use 'null' instead of 'undefined' to indicate an intended lack of result in functions. ([source](https://app.greptile.com/posthog-org-19734/-/custom-context?memory=0631667e-2260-42be-a589-0d8da9ef007d))

**Learned From**
[PostHog/posthog#32556](https://github.com/PostHog/posthog/pull/32556)

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

stamphog[bot]

This comment was marked as outdated.

rafaeelaudibert and others added 2 commits October 6, 2026 00:37
Add Claude Desktop, Claude Code in VS Code and Claude Code on the web to
the agent prompt menus. Pass the repository to Codex as originUrl. Cap
Cursor and claude.ai links by total URL length, and keep truncation from
splitting a surrogate pair, which made encodeURIComponent throw.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
posthog-cli records repo_name as the bare repository name, so the stack
trace agent button sent values like "posthog" where every agent expects
owner/repo. Claude Code then opened in the home directory, and Codex got
a wrong originUrl. Derive the slug from the release remote URL instead,
and only for GitHub remotes, since every agent repo parameter assumes
GitHub.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
posthog Bot and others added 2 commits October 6, 2026 00:37
2 updated
Run: 6cb312db-6dce-403e-a472-4d928c594a89
The inbox agent menu passed `undefined` as the third window.open argument
for every destination except claude.ai. Give each destination its own open
function instead, so only the claude.ai link passes noopener. Update the
test for the "Claude Code CLI" label.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@rafaeelaudibert
rafaeelaudibert force-pushed the rafa/agent-prompt-deep-links branch from f951599 to 00811bf Compare October 6, 2026 03:37
@stamphog
stamphog Bot dismissed their stale review October 6, 2026 03:37

A new stamphog review started for this PR — the fresh verdict replaces this approval.

@stamphog stamphog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved.

Frontend-only change that adds agent deep-link destinations and a stricter GitHub slug parser, and it stays outside risky territory. Tests cover the new link builders and the parser. The open reviewer comments are a style preference (null vs undefined) and an edge case that fails safe (an unparsed remote sends no repo).

  • Author wrote 0% of the modified lines and has 28 merged PRs in these paths (familiarity MODERATE).
  • 👍 on the PR from greptile-apps[bot].
  • Greptile's style point: getGitHubRepositorySlug returns undefined where the repo convention prefers null. Not blocking.
  • CodeRabbit's edge case: ssh://-style GitHub remotes return no slug, so no repo is passed. This fails safe.
Gate mechanics and policy version
Gate Result
prerequisites ✓ all clear
deny-list ✓ no deny categories matched
size ✓ 199L, 6F substantive, 275L/9F incl. docs/generated/snapshots — within ceiling
tier ✓ T1-agent / T1c-medium (275L, 9F, two-areas, feat)
stamphog 2.3.1 .stamphog/policy.yml @ 00811bf · reviewed head 00811bf

@trunk-io

trunk-io Bot commented Oct 6, 2026

Copy link
Copy Markdown

Stacked PR 112278 failed testing in the merge queue. Please investigate the failure and re-submit the stack.

@trunk-io

trunk-io Bot commented Oct 6, 2026

Copy link
Copy Markdown

This pull request is queued for merge as part of 112278, which will merge 112270, 112273, 112278.

@trunk-io
trunk-io Bot merged commit 2591e4d into master Oct 6, 2026
@trunk-io
trunk-io Bot deleted the rafa/agent-prompt-deep-links branch October 6, 2026 07:06
@trunk-io

trunk-io Bot commented Oct 6, 2026

Copy link
Copy Markdown

This pull request was merged into master as part of stacked PR 112278.

@deployment-status-posthog

deployment-status-posthog Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Deploy status

Environment Status Deployed At Workflow
dev ✅ Deployed 2026-10-06 07:26 UTC Run
prod-us ✅ Deployed 2026-10-06 07:43 UTC Run
prod-eu ✅ Deployed 2026-10-06 07:47 UTC Run

This branch was successfully deployed

1 active deployment
preview-pr-112270 — 00811bf0 Deployed Oct 6, 2026 by github-actions[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stamphog Request AI approval (no full review)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant