Skip to content

Conversation

@lmac-1
Copy link
Collaborator

@lmac-1 lmac-1 commented Feb 7, 2026

Problem

AI Assistant button was clickable when Apollo wasn't configured, causing silent failures where messages sent but never received responses.

Solution

  • Disable AI chat button when APOLLO_ENDPOINT or AI_ASSISTANT_API_KEY are missing
  • Show tooltip: "Your instance does not have build-time AI enabled. Contact your administrator or support@openfn.org to configure it."
  • Disable Cmd+K keyboard shortcut

Closes #4354

Validation steps

  1. Verify that it solves the scenario defined in Regression: AI Assistant still available when Apollo isn't set up #4354
  2. Also locally, comment out APOLLO_ENDPOINT or AI_ASSISTANT_API_KEY environment variables and confirm that AI assistant button is disabled. There should be a tooltip text advising the user. Make sure you can't open panel either with Cmd/Ctrl + K

Additional notes for the reviewer

  1. I haven't been able to replicate the exact case described by Roina re local builds.. so I just want someone else to confirm that this definitely fixes that scenario.

AI Usage

Please disclose whether you've used AI anywhere in this PR (it's cool, we just
want to know!):

  • I have used Claude Code
  • I have used another model
  • I have not used AI

You can read more details in our
Responsible AI Policy

Pre-submission checklist

  • I have performed an AI review of my code (we recommend using /review
    with Claude Code)
  • I have implemented and tested all related authorization policies.
    (e.g., :owner, :admin, :editor, :viewer)
  • I have updated the changelog.
  • I have ticked a box in "AI usage" in this PR

Fixes #4354

When Apollo environment variables (APOLLO_ENDPOINT and
AI_ASSISTANT_API_KEY) are not configured, the AI Assistant
button is now disabled with a clear tooltip message. This
prevents users from attempting to use a feature that cannot
function, avoiding silent failures.

Changes:
- Thread aiAssistantEnabled prop from LiveView through component chain
- Compose disabled state in Header (Apollo unavailable + pinned version)
- Show tooltip: "Your instance does not have build-time AI enabled"
- Disable Cmd+K keyboard shortcut when Apollo unavailable
@github-project-automation github-project-automation bot moved this to New Issues in v2 Feb 7, 2026
@lmac-1 lmac-1 changed the title 4354 apollo unavailable fix: Disable AI Assistant when Apollo not configured Feb 7, 2026
@codecov
Copy link

codecov bot commented Feb 7, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.37%. Comparing base (af21999) to head (016521e).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4392      +/-   ##
==========================================
- Coverage   89.39%   89.37%   -0.02%     
==========================================
  Files         425      425              
  Lines       20051    20052       +1     
==========================================
- Hits        17924    17922       -2     
- Misses       2127     2130       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Changes default from true to false to ensure AI Assistant is disabled
by default when the prop isn't explicitly set. This prevents accidental
exposure of AI features when Apollo isn't configured.

Also extracts disabled message logic to a const for better readability
and makes the prop required in intermediate components to ensure
explicit prop threading.

Tests updated to only specify aiAssistantEnabled={true} where they
specifically test AI button behavior, rather than on every test.
Copy link
Contributor

@elias-ba elias-ba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @lmac-1 this is looking great to me, thanks a lot. Nice job 👏🏽. I left few comments they are details but I think they may be important considerations for UX.


// Determine AI button disabled message based on priority
const aiButtonDisabledMessage = !aiAssistantEnabled
? 'Your instance does not have build-time AI enabled. Contact your administrator or support@openfn.org to configure it.'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we use the expression "build-time AI" here ? Is that clear to the end user ? I know that expression because I have heard it being used internally multiple times. Is it the case for the end user in Lesotho using this app ? Wouldn't they stay minutes thinking about that term and asking themselve what does this mean ? Why not just use the term "AI Assistant" ? cc @taylordowns2000

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@taylordowns2000 I used the message you mentioned on Slack but let me know if it should be changed. I agree that "AI assistant" could be a bit clearer for the user.

This error message will trigger when the env variables aren't set up for AI assistant - can someone also confirm that's the scenario Roina was reporting (with local builds, etc.)?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@theroinaochieng we just need clarification / confirmation of this message. If it's okay we can approve and merge, if not I can make the update.

elias-ba and others added 3 commits February 8, 2026 23:59
The tests were using Object.defineProperty to mock window.location,
which doesn't work with the useURLState hook. Use the existing
urlState mock pattern from other tests instead.
The AIAssistantPanelWrapper component is always called with props,
so the = {} default parameter is no longer needed.
Copy link
Collaborator

@theroinaochieng theroinaochieng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great Lucy!

@theroinaochieng theroinaochieng merged commit e066ed4 into main Feb 11, 2026
6 of 7 checks passed
@theroinaochieng theroinaochieng deleted the 4354-apollo-unavailable branch February 11, 2026 08:24
@github-project-automation github-project-automation bot moved this from New Issues to Done in v2 Feb 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Regression: AI Assistant still available when Apollo isn't set up

3 participants