PostHog / PostHog/posthog

Bug: Using Fix error with AI in SQL editor may delete entire query when switching tabs

Open
#32,028 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug feature/sql-editor team/data-warehouse
Dominant language
Python
Stars
39.9k
Forks
3.4k
Avg merge
7h 27m
Merged PRs (30d)
222

Description

Bug Description

Bug description

In the SQL editor, doing "Fix error with AI" in one tab, then switching to another to work on something else while that ran (very common pattern when one uses AI powered IDEs like cursor), may delete the content of tab where AI is fixing the query when you switch back to it, with no way to undo.

The user has to dig through the query_log to try and recover it.

How to reproduce

  1. Open multiple tabs in the SQL editor
  2. Add an error to any tab and run the query to get the "Fix with AI" button
  3. Click "Fix with AI" and while it's running, switch to another tab
  4. When it's finished, switch back to the tab AI was fixing

Additional context

From: https://posthoghelp.zendesk.com/agent/tickets/30246 (moved to PostHog: https://us.posthog.com/project/2/support/tickets/31833)

Debug info
null

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 in the SQL editor by reproducing the multi-tab "Fix with AI" flow: trigger the fix in one tab, switch tabs while it runs, and return when it finishes. Trace how the active tab and query content are handled during the AI response, using query_log only as the reported recovery path. Done means the original query remains intact when switching tabs during the fix.

Written by the indexing model from the issue text.

Assessment

Tech stack
sql
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.