[OPIK-7192] [BE][FE] refactor: gate Agent Insights behind the Ollie toggle#7397
[OPIK-7192] [BE][FE] refactor: gate Agent Insights behind the Ollie toggle#7397aadereiko wants to merge 1 commit into
Conversation
…oggle Remove the standalone Agent Insights feature toggle and gate the feature solely on the existing Ollie toggle, so a single switch enables/disables it. - FE: drop AGENT_INSIGHTS_ENABLED from the toggle enum/defaults; the Diagnostics menu item and Signals page now gate on ollieEnabled only. - BE: remove agentInsightsEnabled from ServiceTogglesConfig and repoint all gate sites (freeform-SQL endpoint, report publisher/subscriber, cron job setup, readonly-freeform-sql health check) to isOllieEnabled(). - Deployment/dev: TOGGLE_AGENT_INSIGHTS_ENABLED -> TOGGLE_OLLIE_ENABLED in docker-compose, dev-runner, the readonly-user provisioning script and the ClickHouse config comment. - Regenerate the OpenAPI specs and TypeScript rest_api types without the field. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
⏱️ pre-commit per-hook timing
⏭️ 35 skipped (no matching files changed)
|
| if (!serviceToggles.isOllieEnabled()) { | ||
| log.debug("Agent Insights is disabled, ignoring trigger for project '{}'", projectId); | ||
| return Mono.empty(); | ||
| } |
There was a problem hiding this comment.
Disabled trigger still returns 202
enqueue() returns Mono.empty() when serviceToggles.isOllieEnabled() is false, so AgentInsightsJobService.triggerNow() still completes and AgentInsightsJobsResource.trigger() returns Response.accepted() without enqueuing a report or hitting the failure callback — should we surface a non-accepted response or throw in the disabled branch instead?
Want Baz to fix this for you? Activate Fixer
Other fix methods
Prompt for AI Agents
Before applying, verify this suggestion against the current code. In
apps/opik-backend/src/main/java/com/comet/opik/domain/AgentInsightsReportPublisher.java
around lines 49-55 in the enqueue(...) method, the feature-toggle check currently
returns Mono.empty() when !serviceToggles.isOllieEnabled(), which causes the upstream
triggerNow/trigger endpoint to treat it as success (Response.accepted()) without
enqueuing anything. Refactor the disabled branch to emit an explicit error signal (e.g.,
Mono.error with a dedicated exception) or return a distinct non-accepted result that the
caller can map to an appropriate HTTP response. Then update the corresponding caller(s)
(AgentInsightsJobService.triggerNow and the AgentInsightsJobsResource.trigger endpoint)
to handle this error/disabled result so the endpoint returns a non-202 response (or
throws) instead of silently no-oping.
|
|
||
| const AssistantSidebar = usePluginsStore((state) => state.AssistantSidebar); | ||
| const ollieEnabled = useIsFeatureEnabled(FeatureToggleKeys.OLLIE_ENABLED); | ||
| const agentInsightsEnabled = useIsFeatureEnabled( | ||
| FeatureToggleKeys.AGENT_INSIGHTS_ENABLED, | ||
| ); | ||
|
|
||
| // Running / enabling / configuring diagnostics are write actions gated on | ||
| // workspace-settings permission; viewing issues stays open to all. |
There was a problem hiding this comment.
Cannot toggle diagnostics independently
Navigate now sends users back to the project home whenever AssistantSidebar is missing or ollieEnabled is false, so ollieEnabled also gates Agent Insights access and its rollout/rollback — should we switch this return path to an explicit agentInsightsEnabled flag, as the reviewer’s configuration guidance suggests?
Want Baz to fix this for you? Activate Fixer
Other fix methods
Prompt for AI Agents
Before applying, verify this suggestion against the current code. In
apps/opik-frontend/src/v2/pages/SignalsPage/SignalsPage.tsx around lines 69-205 (inside
the SignalsPage component, near the early-return `if (!AssistantSidebar ||
!ollieEnabled) { return <Navigate .../> }`), the diagnostics access is incorrectly gated
on `ollieEnabled`, which couples Agent Insights rollout/rollback to the Ollie feature
toggle. Reintroduce an explicit `agentInsightsEnabled` configuration flag using
FeatureToggleKeys.AGENT_INSIGHTS_ENABLED (as it was in the old code) and change the
guard to return the Navigate only when `!AssistantSidebar || !agentInsightsEnabled`
(remove the Ollie dependency for this return path). Ensure the new flag is used
consistently for any related UI/state gating in this file and update the effect/memo
dependencies if needed to avoid stale renders.
| const activeProjectId = useActiveProjectId(); | ||
| const AssistantSidebar = usePluginsStore((state) => state.AssistantSidebar); | ||
| const ollieEnabled = useIsFeatureEnabled(FeatureToggleKeys.OLLIE_ENABLED); | ||
| const agentInsightsEnabled = useIsFeatureEnabled( | ||
| FeatureToggleKeys.AGENT_INSIGHTS_ENABLED, | ||
| ); | ||
| const projectHomepageEnabled = useIsFeatureEnabled( | ||
| FeatureToggleKeys.PROJECT_HOMEPAGE_ENABLED, | ||
| ); |
There was a problem hiding this comment.
Hidden Agent Insights toggle change
showDiagnostics is now gated by ollieEnabled, so turning on OLLIE_ENABLED also turns on Agent Insights and removes independent rollout/rollback control — should we add an explicit AGENT_INSIGHTS_ENABLED flag, default it to false, and gate the sidebar entry off that instead?
Want Baz to fix this for you? Activate Fixer
Other fix methods
Prompt for AI Agents
Before applying, verify this suggestion against the current code. In
apps/opik-frontend/src/v2/layout/SideBar/SideBarMenuItems.tsx around lines 19-53, inside
the SideBarMenuItems component where `getMenuItems` is called, `showDiagnostics` is
currently set to `!!AssistantSidebar && ollieEnabled`, which incorrectly reuses the
existing `OLLIE_ENABLED` flag for a different feature. Reintroduce an explicit
`AGENT_INSIGHTS_ENABLED` (or similarly named) feature toggle by adding a
`useIsFeatureEnabled(FeatureToggleKeys.AGENT_INSIGHTS_ENABLED)` hook (defaulting to
false by configuration), and change `showDiagnostics` to gate on `!!AssistantSidebar &&
agentInsightsEnabled` instead of `ollieEnabled`. Ensure `FeatureToggleKeys` includes the
flag if missing and keep `showOlliePage` gated only by `OLLIE_ENABLED` so
rollouts/rollbacks can be controlled independently.
|
🌿 Preview your docs: https://opik-preview-69968d38-a252-4f05-80e5-d951a20c43e2.docs.buildwithfern.com/docs/opik 📌 Results for commit 6000638 |
Details
Removes the standalone Agent Insights feature toggle from the frontend and backend and gates the feature solely on the existing Ollie toggle, so a single switch enables/disables it. Motivation: Agent Insights is only usable when Ollie is available, so two independent toggles added configuration surface with no benefit and let the two features drift out of sync.
AGENT_INSIGHTS_ENABLEDfrom the toggle enum/defaults; the Diagnostics menu item and the Signals/Diagnostics page now gate onollieEnabledonly.agentInsightsEnabledfromServiceTogglesConfigand repointed every gate site (freeform-SQL endpoint, report publisher/subscriber, cron job setup, readonly-freeform-sql health check) toisOllieEnabled().TOGGLE_AGENT_INSIGHTS_ENABLED→TOGGLE_OLLIE_ENABLEDin docker-compose,dev-runner.sh, the readonly-user provisioning script, and the ClickHouse config comment.rest_apitypes without the field.Note
ollieEnabledwas previously not read on the backend at all. Enabling Ollie in an environment now also arms the freeform-SQL / ClickHouse read-only path and the report pipeline. That is the intended consolidation, but the two features can no longer be toggled independently.Change checklist
Issues
AI-WATERMARK
AI-WATERMARK: yes
Testing
npx tsc --noEmitinapps/opik-frontend— passes clean (0 errors).agentInsightsEnabled/TOGGLE_AGENT_INSIGHTS_ENABLED/AGENT_INSIGHTS_ENABLED.serviceToggles.ollieEnabled-gated tests (AnalyticsQueriesResourceTest,AnalyticsQueriesResourceDisabledTest,AgentInsightsJobsResourceTest,HealthCheckIntegrationTest,AbstractClickHouseHealthCheckTest).Documentation
No user-facing docs change; the OpenAPI reference is regenerated as part of this PR.