PostHog / PostHog/posthog

Bug: preserve visualization settings when MCP updates an insight's SQL

Open
#54,870 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

AI bug feature/mcp feature/posthog-ai MCP team/posthog-ai
Dominant language
Python
Stars
39.9k
Forks
3.4k
Avg merge
6h 51m
Merged PRs (30d)
232

Description

Bug description

When an MCP client (for example Claude via the PostHog MCP server) updates a saved SQL insight by passing a new query, the insight's visualization settings are reset. Tiles that were configured as Big Number or bar charts revert to the default table view after the update, even though only the HogQL was changed.

The MCP insight-update tool schema now exposes display, chartSettings, and tableSettings (added in #54033), so a client can in principle pass them back.

The expected behaviour is that a partial update that only changes the HogQL source should preserve existing display, chartSettings, and tableSettings unless the client explicitly sends new values.

How to reproduce

  1. Create a SQL insight and set its visualization to Big Number (or a non-default chart type).
  2. From an MCP client, call insight-update on that insight with a modified query that only sets kind and source (no display, chartSettings, or tableSettings).
  3. Open the insight in the UI: the visualization has reverted to a plain table.

Additional context

https://posthoghelp.zendesk.com/agent/tickets/54542 (moved to PostHog: https://us.posthog.com/project/2/support/tickets/56980)

Debug info

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the MCP insight-update tool and its handling of the query source; inspect how omitted display, chartSettings, and tableSettings values are applied during a partial update. Reproduce the update on an insight with a non-default visualization, then verify that changing only the HogQL leaves those settings unchanged while explicitly supplied values still update them.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.