Skip to content

feat: add experimental global AI assistant option#4567

Open
elias-ba wants to merge 11 commits intomainfrom
4532-experimental-global-assistant
Open

feat: add experimental global AI assistant option#4567
elias-ba wants to merge 11 commits intomainfrom
4532-experimental-global-assistant

Conversation

@elias-ba
Copy link
Copy Markdown
Contributor

@elias-ba elias-ba commented Mar 26, 2026

Description

Adds an opt-in checkbox to the AI Assistant UI that routes messages to Apollo's global chat endpoint instead of the separate job_chat/workflow_chat endpoints. The global chat unifies both behind a router that intelligently decides how to handle each request.

Gated behind the existing experimental features preference - only users who have enabled experimental features in their profile see the checkbox.

Closes #4532

Validation steps

  1. Enable experimental features in user profile
  2. Open a workflow in the editor, open the AI assistant panel
  3. Verify "Global assistant (experimental)" checkbox appears next to the PII warning
  4. Check the checkbox - badge should change to "Global (experimental)" in amber
  5. Send a message - verify it routes through global_chat (check Apollo logs for "HTTP stream connected to global_chat")
  6. On the workflow canvas, ask to modify workflow structure - verify "Generated Workflow" card with Apply
  7. Navigate to a job, ask to modify code - verify "Generated Job Code" card with Preview/Apply
  8. Uncheck the checkbox - verify messages go through normal job_chat/workflow_chat as before

Additional notes for the reviewer

AI Usage

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

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

@github-project-automation github-project-automation bot moved this to New Issues in Core Mar 26, 2026
@elias-ba elias-ba marked this pull request as ready for review March 26, 2026 03:07
@elias-ba elias-ba force-pushed the 4532-experimental-global-assistant branch from 54a117e to cda4590 Compare March 26, 2026 03:59
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 26, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.57%. Comparing base (7a47ef2) to head (8a8e32f).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4567      +/-   ##
==========================================
+ Coverage   89.51%   89.57%   +0.06%     
==========================================
  Files         441      441              
  Lines       21205    21257      +52     
==========================================
+ Hits        18982    19042      +60     
+ Misses       2223     2215       -8     

☔ 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.

Base automatically changed from 3585-ai-assistant-streaming to main March 27, 2026 15:25
@elias-ba elias-ba force-pushed the 4532-experimental-global-assistant branch from 8185c5e to 5b5dbda Compare March 27, 2026 16:41
elias-ba added 11 commits March 27, 2026 19:37
- Add global_chat_stream/2 to ApolloClient for /services/global_chat/stream
- Add global_chat?/1 and process_global_message/2 to MessageProcessor
- Route to global_chat when use_global_assistant is in session meta
- Pass use_global_assistant and page through channel message_options
- Add experimental_features_enabled to workflow channel get_context
- Add query_global_stream/3 using process_stream with build_global_message
- build_global_message extracts code from attachments (job_code or workflow_yaml)
- Context-aware: on job step prefers job_code, on overview prefers workflow_yaml
- Resolves job_id from job_key in attachment by matching against workflow jobs
- Add experimental_features_enabled to SessionContextResponseSchema
- Map to experimentalFeaturesEnabled in SessionContextStore
- Add useExperimentalFeaturesEnabled hook
- Add use_global_assistant and page to MessageOptions type
- Add Global assistant (experimental) checkbox to ChatInput with
  localStorage persistence and onGlobalAssistantChange callback
- Pass use_global_assistant and page through AIChannelRegistry buildJoinParams
- Wire checkbox through AIAssistantPanel with showGlobalAssistantOption,
  isGlobalAssistantActive, and onGlobalAssistantChange props
- AIAssistantPanelWrapper includes workflow YAML and page when global
  assistant is active, derives page from workflow/job context
- Badge shows "Global (experimental)" in amber when active
The Zod schema adds a default value for the new optional field,
so the parsed output includes it. Update the test fixture to match.
Split build_global_message into smaller functions to satisfy
credo's complexity threshold.
- ApolloClient: global_chat_stream payload, nil filtering, error handling
- AiAssistant: query_global_stream SSE processing, job_code vs workflow_yaml
  extraction, job resolution from job_key, error handling
- MessageProcessor: global_chat routing when use_global_assistant is set
- AiAssistantChannel: session options and message options with global assistant
- WorkflowChannel: experimental_features_enabled in get_context
Cover workflow_yaml fallback on overview pages, nil job_key handling
in resolve_job_from_key, and non-list attachments.
@elias-ba elias-ba force-pushed the 4532-experimental-global-assistant branch from 5b5dbda to 8a8e32f Compare March 27, 2026 19:38
@hanna-paasivirta
Copy link
Copy Markdown

@elias-ba When I try a conversational turn with no YAML generation in the workflow chat (no experimental features turned on) I get some errors:


Fo Assistant Workflow

Sometimes the streamed answer disappears and it seems to regenerate a new answer, which in this case was malformed:

fn Assistant Wordfow

I'm not sure why at this stage, but I'll continue testing.

@hanna-paasivirta
Copy link
Copy Markdown

@elias-ba When I try a conversational turn in the global chat (experimental features turned on), I get an error similarly:

Fa Assistant Globai (experimental)

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

Labels

None yet

Projects

Status: New Issues

Development

Successfully merging this pull request may close these issues.

Add experimental AI Assistant option

2 participants