Skip to content

fix(ai): disable deep research during active runs - #26636

Merged
sdolidze merged 3 commits into
mainfrom
prod-9372
Jul 31, 2026
Merged

fix(ai): disable deep research during active runs#26636
sdolidze merged 3 commits into
mainfrom
prod-9372

Conversation

@sdolidze

Copy link
Copy Markdown
Contributor

Closes: https://linear.app/lightdash/issue/PROD-9372/disable-deep-research-while-another-run-is-active-in-the-thread

Summary

Disables the Deep research composer control while the current thread has a starting, queued, or running research run. Regular chat stays available, and the control returns when the run completes, partially completes, fails, or is cancelled.

Root cause

The one-click control owned only local composer mode. Although the Deep research registry and server list already tracked thread-scoped run lifecycles, the composer never consumed that state.

<DeepResearchModeControl
    mode={composerMode}
    onModeChange={setComposerMode}
/>

PR #26589 introduced the direct toggle and left same-thread concurrency feedback for this follow-up. Without active-run state, the control stayed interactive throughout an existing run.

Fix

Derives one active state from optimistic registrations and persisted non-terminal runs, then applies it only to the Deep research path.

  • useDeepResearch.ts reconciles optimistic and server runs by UUID and polls while a run remains non-terminal.
  • AgentChatInput.tsx disables duplicate research starts, resets active composers to Ask, and keeps normal messages available.
  • DeepResearchModeControl.tsx exposes an actionless explanation on hover and keyboard focus for both control variants.
  • Backend execution, API contracts, and database state remain unchanged.

Before

same-thread run active
        |
        v
Deep research toggle enabled ---> second start remains selectable

After

same-thread run active
        |
        +--> Deep research disabled + hover/focus explanation
        |
        +--> Ask composer enabled ------> regular message sends

terminal run state ---------------------> Deep research re-enabled

Test plan

  • Focused Vitest: 3 files, 21 tests pass, including the original failing regression.
  • Full frontend Vitest: 241 files, 1,903 tests pass.
  • pnpm -F frontend typecheck
  • pnpm -F frontend lint — zero errors; unrelated existing warnings only.
  • pnpm -F frontend format
  • Verify optimistic and persisted active states, terminal states, thread isolation, no-thread behavior, regular Send, and actionless hover/focus explanation.

@linear-code

linear-code Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

PROD-9372

@github-actions

Copy link
Copy Markdown

🧪 Test Selection

✅ Tests that will run

Test Description
Preview Environment Deploys a preview environment for testing
Frontend E2E Tests Runs Cypress app tests

⏭️ Tests skipped (no relevant file changes detected)

Test How to trigger manually
Backend API Tests Add test-backend to PR description
Timezone Tests Add test-timezone to PR description
CLI Tests Add test-cli to PR description

Tip: Add test-all to your PR description to run all tests.

@sdolidze sdolidze changed the title fix(ai): disable Deep research during active runs fix(ai): disable deep research during active runs Jul 31, 2026
@github-actions

Copy link
Copy Markdown

Your preview environment pr-26636 has been deployed.

Preview environment endpoints are available at:

@github-actions

Copy link
Copy Markdown

Preview Environment

🌐 URL: https://lightdash-preview-pr-26636.lightdash.okteto.dev

📋 Logs: View in GCP Console

🔧 SSH: ./scripts/okteto-ssh.sh 26636

@sdolidze
sdolidze merged commit b553988 into main Jul 31, 2026
22 of 23 checks passed
@sdolidze
sdolidze deleted the prod-9372 branch July 31, 2026 14:21
lightdash-bot pushed a commit that referenced this pull request Jul 31, 2026
# [1.55.0](1.54.0...1.55.0) (2026-07-31)

### Bug Fixes

* **ai:** disable deep research during active runs ([#26636](#26636)) ([b553988](b553988))
* **ai:** keep deep research charts out of artifact sidebar ([#26638](#26638)) ([c02af96](c02af96))
* autofocus the global search input when the omnibar opens ([#26629](#26629)) ([0e9fa7a](0e9fa7a))
* **deps:** bump data app Vite to 8.0.16 ([#26628](#26628)) ([d1b1ed1](d1b1ed1))

### Features

* **ai:** persist Deep Research run metrics ([#26615](#26615)) ([4eb2bd5](4eb2bd5))
* **apps:** build a data app viz from the chart config ([#26338](#26338)) ([7e04541](7e04541))
* **cli:** download the data apps a dashboard references ([#26573](#26573)) ([d520559](d520559))
* **cli:** upload a dashboard's data apps before the dashboard ([#26584](#26584)) ([9c5f5fb](9c5f5fb))
* **content-as-code:** portable data app references in dashboard YAML ([#26566](#26566)) ([4ebf202](4ebf202))
* **data-apps:** add fullscreen presentation mode to the app viewer ([#26633](#26633)) ([d1aa90a](d1aa90a))
@lightdash-bot

Copy link
Copy Markdown
Collaborator

🎉 This PR is included in version 1.55.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants