Skip to content

[OPIK-7192] [BE][FE] refactor: gate Agent Insights behind the Ollie toggle#7397

Draft
aadereiko wants to merge 1 commit into
mainfrom
aadereiko/OPIK-7192-remove-agent-insights-toggle
Draft

[OPIK-7192] [BE][FE] refactor: gate Agent Insights behind the Ollie toggle#7397
aadereiko wants to merge 1 commit into
mainfrom
aadereiko/OPIK-7192-remove-agent-insights-toggle

Conversation

@aadereiko

Copy link
Copy Markdown
Collaborator

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.

  • FE: dropped AGENT_INSIGHTS_ENABLED from the toggle enum/defaults; the Diagnostics menu item and the Signals/Diagnostics page now gate on ollieEnabled only.
  • BE: removed agentInsightsEnabled from ServiceTogglesConfig and repointed every gate site (freeform-SQL endpoint, report publisher/subscriber, cron job setup, readonly-freeform-sql health check) to isOllieEnabled().
  • Deployment/dev: TOGGLE_AGENT_INSIGHTS_ENABLEDTOGGLE_OLLIE_ENABLED in docker-compose, dev-runner.sh, the readonly-user provisioning script, and the ClickHouse config comment.
  • Regenerated the OpenAPI specs and TypeScript rest_api types without the field.

Note

ollieEnabled was 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

  • User facing
  • Documentation update

Issues

  • Resolves #
  • OPIK-7192

AI-WATERMARK

AI-WATERMARK: yes

  • If yes:
    • Tools: Claude Code
    • Model(s): Claude Opus 4.8
    • Scope: Full change — located both toggles, applied the FE/BE/deployment edits, updated generated artifacts, and authored this description.
    • Human verification: Reviewed by @aadereiko; frontend typecheck run locally.

Testing

  • npx tsc --noEmit in apps/opik-frontend — passes clean (0 errors).
  • Repo-wide grep confirms no remaining references to agentInsightsEnabled / TOGGLE_AGENT_INSIGHTS_ENABLED / AGENT_INSIGHTS_ENABLED.
  • Backend build/tests not run locally (requires JDK 25 + Maven); CI will exercise the updated 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.

…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>
@github-actions github-actions Bot added documentation Improvements or additions to documentation java Pull requests that update Java code Frontend Backend Infrastructure tests Including test files, or tests related like configuration. typescript *.ts *.tsx TypeScript SDK labels Jul 8, 2026
@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

⏱️ pre-commit per-hook timing

Hook Description Result Duration
🌐 typecheck — frontend Whole-project tsc type check 42.80s
📘 typecheck — typescript sdk Whole-project tsc type check 14.64s
☕ spotless — java backend Format Java code 6.44s
🌐 eslint — frontend Lint + autofix JS/TS 3.99s
📘 eslint — typescript sdk Lint + autofix JS/TS 1.05s
Total (5 ran) 68.92s
⏭️ 35 skipped (no matching files changed)
Hook Description Result
🐍 trim trailing whitespace — python sdk Strip trailing whitespace ⏭️
🐍 fix end of files — python sdk Ensure files end in a newline ⏭️
🐍 ruff — python sdk Lint + autofix Python (ruff) ⏭️
🐍 ruff-format — python sdk Format Python code (ruff) ⏭️
🐍 mypy — python sdk Static type check ⏭️
🤖 trim trailing whitespace — optimizer Strip trailing whitespace ⏭️
🤖 fix end of files — optimizer Ensure files end in a newline ⏭️
🤖 check yaml — optimizer Validate YAML syntax ⏭️
🤖 check json — optimizer Validate JSON syntax ⏭️
🤖 check toml — optimizer Validate TOML syntax ⏭️
🤖 check for added large files — optimizer Block large files (>1MB) ⏭️
🔐 detect private key — optimizer Block committed private keys ⏭️
🤖 check for merge conflicts — optimizer Block merge-conflict markers ⏭️
🤖 check for case conflicts — optimizer Block case-only name clashes ⏭️
🤖 pyupgrade — optimizer Modernize Python syntax ⏭️
🤖 ruff — optimizer Lint + autofix Python (ruff) ⏭️
🤖 ruff-format — optimizer Format Python code (ruff) ⏭️
🤖 mypy — optimizer Static type check ⏭️
📓 nbstripout — optimizer notebooks Strip notebook output ⏭️
📝 markdownlint — optimizer Lint Markdown ⏭️
🔤 codespell — optimizer Fix common misspellings ⏭️
📊 radon cc — optimizer Cyclomatic-complexity gate ⏭️
📊 radon raw — optimizer Raw size metrics gate ⏭️
📊 xenon — optimizer Fail on complexity thresholds ⏭️
📊 lizard — optimizer Cyclomatic-complexity gate ⏭️
🧹 vulture — optimizer Find dead code ⏭️
🛡️ trim trailing whitespace — guardrails Strip trailing whitespace ⏭️
🛡️ fix end of files — guardrails Ensure files end in a newline ⏭️
🛡️ ruff — guardrails Lint + autofix Python (ruff) ⏭️
🛡️ ruff-format — guardrails Format Python code (ruff) ⏭️
🛡️ mypy — guardrails Static type check ⏭️
⚓ helm-docs Regenerate Helm chart README ⏭️
block non-public FE plugins Block non-public FE plugins ⏭️
🧪 pre-commit wrapper smoke tests Self-test the wrapper scripts ⏭️
⚙️ actionlint — github workflows Lint GitHub Actions workflows ⏭️

Comment on lines +52 to 55
if (!serviceToggles.isOllieEnabled()) {
log.debug("Agent Insights is disabled, ignoring trigger for project '{}'", projectId);
return Mono.empty();
}

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.

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?

Severity

Want Baz to fix this for you? Activate Fixer

Other fix methods

Fix in Cursor

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.

Comment on lines 69 to 74

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.

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.

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?

Severity

Want Baz to fix this for you? Activate Fixer

Other fix methods

Fix in Cursor

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.

Comment on lines 19 to 24
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,
);

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.

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?

Severity

Want Baz to fix this for you? Activate Fixer

Other fix methods

Fix in Cursor

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.

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

🌿 Preview your docs: https://opik-preview-69968d38-a252-4f05-80e5-d951a20c43e2.docs.buildwithfern.com/docs/opik

⚠️ The link check did not complete (likely a crawl crash or timeout). Please re-run this check.


📌 Results for commit 6000638

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

Labels

Backend baz: pending documentation Improvements or additions to documentation Frontend Infrastructure java Pull requests that update Java code tests Including test files, or tests related like configuration. TypeScript SDK typescript *.ts *.tsx

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant