Skip to content

Fix MCP exec permission display metadata#2184

Closed
GHX5T-SOL wants to merge 3 commits into
PostHog:mainfrom
GHX5T-SOL:fix/2177-posthog-exec-permission-display
Closed

Fix MCP exec permission display metadata#2184
GHX5T-SOL wants to merge 3 commits into
PostHog:mainfrom
GHX5T-SOL:fix/2177-posthog-exec-permission-display

Conversation

@GHX5T-SOL
Copy link
Copy Markdown

Summary

  • route MCP permission requests through the MCP renderer when the tool name is present on rawInput
  • include Claude Code MCP tool metadata on generic MCP approval requests
  • add regressions for PostHog exec permission cards rendering as posthog - Read execute-sql (MCP) instead of a generic exec title

Fixes #2177.

Validation

  • pnpm install --frozen-lockfile --ignore-scripts
  • pnpm build:deps
  • pnpm exec vitest run src/renderer/components/permissions/PermissionSelector.test.tsx src/renderer/features/posthog-mcp/utils/posthog-exec-display.test.ts from apps/code
  • pnpm exec vitest run src/adapters/claude/permissions/permission-handlers.test.ts from packages/agent
  • pnpm exec biome check apps/code/src/renderer/components/permissions/McpPermission.tsx apps/code/src/renderer/components/permissions/PermissionSelector.tsx apps/code/src/renderer/components/permissions/PermissionSelector.test.tsx packages/agent/src/adapters/claude/permissions/permission-handlers.ts packages/agent/src/adapters/claude/permissions/permission-handlers.test.ts
  • pnpm --filter @posthog/code typecheck
  • pnpm --filter @posthog/agent typecheck

No packaged app/manual UI smoke was run.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 18, 2026

Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 1
apps/code/src/renderer/components/permissions/PermissionSelector.tsx:34-36
The `claudeCode` property in the `meta` type annotation is no longer accessed directly — `getMcpPermissionToolName` now handles that path. The type can be simplified to only what `meta` is still used for (`codeToolKind`).

```suggestion
  const meta = toolCall._meta as
    | { codeToolKind?: string }
    | undefined;
```

Reviews (1): Last reviewed commit: "Fix MCP exec permission display metadata" | Re-trigger Greptile

Comment on lines 34 to 36
const meta = toolCall._meta as
| { codeToolKind?: string; claudeCode?: { toolName?: string } }
| 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 The claudeCode property in the meta type annotation is no longer accessed directly — getMcpPermissionToolName now handles that path. The type can be simplified to only what meta is still used for (codeToolKind).

Suggested change
const meta = toolCall._meta as
| { codeToolKind?: string; claudeCode?: { toolName?: string } }
| undefined;
const meta = toolCall._meta as
| { codeToolKind?: string }
| undefined;
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/code/src/renderer/components/permissions/PermissionSelector.tsx
Line: 34-36

Comment:
The `claudeCode` property in the `meta` type annotation is no longer accessed directly — `getMcpPermissionToolName` now handles that path. The type can be simplified to only what `meta` is still used for (`codeToolKind`).

```suggestion
  const meta = toolCall._meta as
    | { codeToolKind?: string }
    | undefined;
```

How can I resolve this? If you propose a fix, please make it concise.

@GHX5T-SOL
Copy link
Copy Markdown
Author

Addressed the Greptile type-cleanup note in 1e63cce2.

Validation:

  • pnpm exec biome check apps/code/src/renderer/components/permissions/PermissionSelector.tsx
  • pnpm exec vitest run src/renderer/components/permissions/PermissionSelector.test.tsx src/renderer/features/posthog-mcp/utils/posthog-exec-display.test.ts from apps/code
  • pnpm --filter @posthog/code typecheck
  • git diff --check
  • git diff | gitleaks stdin --no-banner --redact --timeout 30

GHX5T-SOL and others added 3 commits May 19, 2026 16:29
Project policy (CLAUDE.md) bans reading from Claude Code SDK's rawInput
for metadata. The handler now writes _meta.claudeCode.toolName on every
MCP approval request, so the rawInput compatibility fallback is no
longer needed.

Generated-By: PostHog Code
Task-Id: c5674c04-c95c-4bfe-bfcf-248a921b4aae
@jonathanlab jonathanlab force-pushed the fix/2177-posthog-exec-permission-display branch from 1e63cce to 9aa9e3b Compare May 19, 2026 14:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

exec toolcall lacking information

2 participants