Skip to content

ServiceNow Integration - #640

Merged
Bionic711 merged 43 commits into
microsoft:Developmentfrom
vivche:servicenow-integration
Jan 31, 2026
Merged

ServiceNow Integration#640
Bionic711 merged 43 commits into
microsoft:Developmentfrom
vivche:servicenow-integration

Conversation

@vivche

@vivchevivche commented Jan 24, 2026

Copy link
Copy Markdown
Contributor

ServiceNow Integration Documentation and Bug Fixes

Overview

This PR adds comprehensive documentation for integrating ServiceNow with Simple Chat and fixes four critical bugs that were discovered during the ServiceNow integration testing. The bugs affect OpenAPI actions, group actions, group agents, and Azure AI Search connection testing.

📚 ServiceNow Integration Documentation

What's New

Complete ServiceNow Integration Guide

  • Comprehensive step-by-step integration guide covering both Basic Authentication and OAuth 2.0
  • Detailed OAuth 2.0 setup documentation with production security considerations
  • Agent behavioral instructions optimized for ServiceNow operations
  • 7 OpenAPI specifications for ServiceNow Incident Management and Knowledge Base APIs

Documentation Files:

  • docs/how-to/agents/ServiceNow/SERVICENOW_INTEGRATION.md - Main integration guide (760 lines)
  • docs/how-to/agents/ServiceNow/SERVICENOW_OAUTH_SETUP.md - OAuth 2.0 setup guide (480+ lines)
  • docs/how-to/agents/ServiceNow/servicenow_agent_instructions.txt - Agent instructions (263 lines)
  • docs/how-to/agents/ServiceNow/open_api_specs/ - 7 OpenAPI YAML files (both bearer token and basic auth versions)

Key Features:

  • OAuth 2.0 Resource Owner Password Credential grant type setup with security considerations
  • Basic Authentication setup for testing environments
  • Integration user creation and role assignment guidance
  • Token management and refresh strategies
  • Troubleshooting guide
  • Production deployment considerations

🐛 Bug Fixes

1. OpenAPI Basic Authentication Fix

Issue Behavior:
OpenAPI actions configured with Basic Authentication failed with "session not authenticated" error, even when credentials were correct. The agent would report inability to access the API despite the credentials being stored successfully.

Root Cause:
Mismatch between how the UI stored Basic Auth credentials (as username:password string in auth.key) and how the OpenAPI plugin factory expected them (as separate username and password properties in additionalFields).

Files Modified:

  • application/single_app/semantic_kernel_plugins/openapi_plugin_factory.py

Reference:OPENAPI_BASIC_AUTH_FIX.md


2. Group Action OAuth Schema Merging Fix

Issue Behavior:
Group actions with OAuth bearer token authentication failed with HTTP 401 Unauthorized errors. When editing a group action, the additionalFields property was empty ({}), missing all authentication configuration fields that were present in working global actions.

Root Cause:
Group action backend routes (route_backend_plugins.py) did not call get_merged_plugin_settings() to merge UI form data with OpenAPI schema defaults, while global action routes did. This caused group actions to be saved without authentication configuration fields like auth_method, base_url, and authentication credentials.

Files Modified:

  • application/single_app/route_backend_plugins.py

Reference:GROUP_ACTION_OAUTH_SCHEMA_MERGING_FIX.md


3. Group Agent Loading Fix

Issue Behavior:
Group agents were not appearing in the agent list when per-user semantic kernel mode was enabled. When users selected a group agent, it would fall back to the global "researcher" agent with zero plugins/actions available. Group agents would ask clarifying questions instead of executing available ServiceNow actions.

Root Cause:
The load_user_semantic_kernel() function only loaded personal agents and global agents (when merge enabled), but completely omitted group agents from groups the user is a member of. The function did not fetch or load group agents despite the user having valid group memberships.

Files Modified:

  • application/single_app/semantic_kernel_loader.py

Reference:GROUP_AGENT_LOADING_FIX.md


Reference: [GROUP_ACTION_OAUTH_SCHEMA_MERGING_FIX.md](https://github.com/user-attachments/files/24832463/GROUP_ACTION_OAUTH_SCHEMA_MERGING_FIX.md) [GROUP_AGENT_LOADING_FIX.md](https://github.com/user-attachments/files/24832464/GROUP_AGENT_LOADING_FIX.md) [OPENAPI_BASIC_AUTH_FIX.md](https://github.com/user-attachments/files/24832465/OPENAPI_BASIC_AUTH_FIX.md) AZURE_AI_SEARCH_TEST_CONNECTION_FIX.md


📊 Impact Summary

ServiceNow Integration

  • ✅ Complete documentation for enterprise ServiceNow integration
  • ✅ Support for both OAuth 2.0 (production) and Basic Auth (testing)
  • ✅ Reusable OpenAPI specifications for Incident Management and Knowledge Base
  • ✅ Production-ready agent instructions with best practices

Bug Fixes

  • OpenAPI Basic Auth: Enables basic authentication for OpenAPI actions (critical for testing)
  • Group Action OAuth: Fixes OAuth authentication for all group actions (high severity)
  • Group Agent Loading: Enables group agents in per-user kernel mode (high severity)

🔄 Version Update

Updated version from 0.236.011 to 0.236.012


🧪 Testing

All bugs were discovered and validated during ServiceNow integration testing:

  1. OpenAPI actions tested with both Basic Auth and OAuth 2.0 bearer tokens
  2. Group actions tested with OAuth authentication in workspace context
  3. Group agents tested with per-user semantic kernel mode enabled

📝 Files Changed

Documentation Added:

  • 3 bug fix documentation files (docs/fixes/)
  • 3 ServiceNow integration documentation files
  • 7 OpenAPI specification files
  • 1 agent instructions file

Code Modified:

  • config.py - Version update
  • openapi_plugin_factory.py - Basic auth credential parsing fix
  • route_backend_plugins.py - Schema merging for group actions
  • semantic_kernel_loader.py - Group agent loading in per-user mode

🎯 Related Issues

These fixes were discovered during ServiceNow integration work and are critical for:

  • Enterprise integrations requiring OAuth authentication
  • Multi-tenant deployments using group workspaces
  • Managed identity authentication scenarios
  • OpenAPI-based integrations with basic authentication

Chen, Vivien added 3 commits January 23, 2026 18:06
- Add comprehensive ServiceNow integration guide with OAuth 2.0 setup
- Include OpenAPI specifications for Incident Management and Knowledge Base APIs
- Add agent instructions for ServiceNow support agent
- Fix GROUP_ACTION_OAUTH_SCHEMA_MERGING: Ensure additionalFields preserved during schema merge
- Fix GROUP_AGENT_LOADING: Improve group agent loading reliability
- Fix OPENAPI_BASIC_AUTH: Support basic authentication in OpenAPI actions
- Fix AZURE_AI_SEARCH_TEST_CONNECTION: Improve AI Search connection testing
- Update version to 0.236.012
CopilotAI review requested due to automatic review settings January 24, 2026 00:25

CopilotAI left a comment

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.

Pull request overview

This PR adds comprehensive ServiceNow integration documentation and implements four critical bug fixes discovered during ServiceNow integration testing. The changes enable enterprise integrations with ServiceNow for incident management and knowledge base operations while fixing issues affecting OpenAPI authentication, group workspace functionality, and Azure AI Search connectivity testing.

Changes:

  • Comprehensive ServiceNow integration documentation including OAuth 2.0 setup guide, agent behavioral instructions, and 7 OpenAPI specifications
  • Fix for OpenAPI Basic Authentication credential parsing to support username:password format
  • Fix for group action OAuth authentication by adding schema merging (parity with global actions)
  • Fix for group agent loading in per-user semantic kernel mode to include all workspace agents
  • Fix for Azure AI Search connection testing with managed identity authentication using SDK instead of REST API
  • Infrastructure updates for Azure Speech Service with managed identity support and custom subdomain configuration

Reviewed changes

Copilot reviewed 17 out of 19 changed files in this pull request and generated 9 comments.

Show a summary per file
FileDescription
docs/how-to/azure_speech_managed_identity_manul_setup.mdNew documentation explaining Azure Speech Service managed identity setup requirements (filename has typo)
docs/how-to/agents/ServiceNow/SERVICENOW_INTEGRATION.mdComprehensive ServiceNow integration guide covering setup, configuration, and testing
docs/how-to/agents/ServiceNow/SERVICENOW_OAUTH_SETUP.mdDetailed OAuth 2.0 configuration guide for production ServiceNow deployments
docs/how-to/agents/ServiceNow/servicenow_agent_instructions.txtAgent behavioral instructions optimized for ServiceNow operations
docs/how-to/agents/ServiceNow/open_api_specs/*.yamlSeven OpenAPI specification files for ServiceNow APIs (bearer token and basic auth versions)
application/single_app/semantic_kernel_plugins/openapi_plugin_factory.pyAdds credential format transformation for basic auth, bearer tokens, and OAuth2
application/single_app/semantic_kernel_loader.pyAdds group agent and action loading for per-user semantic kernel mode
application/single_app/route_backend_settings.pyReplaces REST API approach with SDK-based Azure AI Search connection testing
application/single_app/route_backend_plugins.pyAdds schema merging to group action routes for OAuth field population
deployers/terraform/main.tfAdds Speech Service resource with custom subdomain and RBAC role assignments
application/single_app/static/images/custom_logo.pngUpdated custom logo image (binary file)
application/single_app/static/images/custom_logo_dark.pngUpdated dark theme custom logo image (binary file)
application/single_app/config.pyVersion bump from 0.236.011 to 0.236.012

Comment threaddocs/how-to/agents/ServiceNow/servicenow_agent_instructions.txt Outdated
Comment threaddocs/how-to/azure_speech_managed_identity_manul_setup.md Outdated
Comment threadapplication/single_app/semantic_kernel_plugins/openapi_plugin_factory.py Outdated
Comment threadapplication/single_app/semantic_kernel_plugins/openapi_plugin_factory.py Outdated
Comment threadapplication/single_app/config.py Outdated
Comment threaddocs/how-to/agents/ServiceNow/SERVICENOW_INTEGRATION.md
Comment threaddocs/how-to/agents/ServiceNow/SERVICENOW_INTEGRATION.md
Comment threadapplication/single_app/route_backend_settings.py Outdated
CopilotAI review requested due to automatic review settings January 24, 2026 00:52
Chen, Vivienand others added 3 commits January 23, 2026 19:57
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…_incident_api.yaml
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

CopilotAI left a comment

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.

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated 4 comments.

Comment threaddocs/how-to/agents/ServiceNow/SERVICENOW_INTEGRATION.md
Comment threaddocs/how-to/agents/ServiceNow/SERVICENOW_OAUTH_SETUP.md
Comment threaddocs/how-to/azure_speech_managed_identity_manul_setup.md Outdated
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
CopilotAI review requested due to automatic review settings January 24, 2026 01:01

CopilotAI left a comment

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.

Pull request overview

Copilot reviewed 18 out of 18 changed files in this pull request and generated 1 comment.

Comment threadapplication/single_app/semantic_kernel_loader.py Outdated
CopilotAI review requested due to automatic review settings January 24, 2026 01:29

CopilotAI left a comment

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.

Pull request overview

Copilot reviewed 18 out of 18 changed files in this pull request and generated 4 comments.

Comment threaddocs/how-to/azure_speech_managed_identity_manul_setup.md Outdated
Comment threaddocs/explanation/fixes/v0.236.012/OPENAPI_BASIC_AUTH_FIX.md Outdated
Comment threaddocs/how-to/azure_speech_managed_identity_manul_setup.md Outdated
Comment threadapplication/single_app/semantic_kernel_loader.py Outdated
Chen, Vivien added 2 commits January 23, 2026 20:42
- Changed 'indexes = list(...)' to '_ = list(...)'
- Follows Python convention for discarded return values
- AI Search connection test only needs to verify the API call succeeds
CopilotAI review requested due to automatic review settings January 24, 2026 01:45

CopilotAI left a comment

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.

Pull request overview

Copilot reviewed 17 out of 17 changed files in this pull request and generated 4 comments.

Comment threadapplication/single_app/semantic_kernel_plugins/openapi_plugin_factory.py Outdated
Comment threaddocs/explanation/fixes/v0.236.012/GROUP_AGENT_LOADING_FIX.md Outdated
Comment threaddocs/explanation/fixes/v0.236.012/GROUP_ACTION_OAUTH_SCHEMA_MERGING_FIX.md Outdated
Comment threaddocs/how-to/agents/ServiceNow/SERVICENOW_OAUTH_SETUP.md
Reverted route_backend_settings.py to origin/development version and removed
AZURE_AI_SEARCH_TEST_CONNECTION_FIX.md documentation. These changes will be
submitted in a dedicated PR to keep the ServiceNow integration PR focused.
@vivche
vivcheforce-pushed the servicenow-integration branch from 2bb45d7 to 0c23a78CompareJanuary 24, 2026 14:20
…factory.py
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
CopilotAI review requested due to automatic review settings January 24, 2026 14:25
vivcheand others added 3 commits January 24, 2026 09:25
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…RGING_FIX.md
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

CopilotAI left a comment

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.

Pull request overview

Copilot reviewed 15 out of 15 changed files in this pull request and generated 1 comment.

Comment threaddocs/how-to/agents/ServiceNow/SERVICENOW_OAUTH_SETUP.md

@paullizerPaul Lizer (paullizer) left a comment

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.

There are changes to the loader but were not massive, and I dont think they negatively affect the workflow of existing actions.

@Bionic711Bionic711 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I, at this time, cannot approve this PR. The changes to the loader break the separation of duties currently implemented in the active group concepts and allow cross-contamination of group RAG data across different agents/plugins.

I advocate to remove the SKLoader changes and approve everything else.

Chen, Vivien added 2 commits January 30, 2026 14:30
- Add comprehensive ServiceNow integration documentation entry
- Document 4 critical bug fixes:
- OpenAPI Basic Authentication credential parsing fix
- Group Action OAuth schema merging fix
- Group Agent loading in per-user kernel mode fix
- Azure AI Search test connection fix
- Move debug_print import to top-level in openapi_plugin_factory.py
Version: 0.237.005
@paullizer

Copy link
Copy Markdown
Contributor

I, at this time, cannot approve this PR. The changes to the loader break the separation of duties currently implemented in the active group concepts and allow cross-contamination of group RAG data across different agents/plugins.

I advocate to remove the SKLoader changes and approve everything else.

Good catch, vivche. if you want, lets talk about correcting the code if you think its necessary or you can proceed to remove it and test out your changes with it returned to previous state

Chen, Vivien added 4 commits January 31, 2026 08:11
… document and reference to v.0.237.008 folder
WHAT:
- Changed group agent loading from ALL user groups to ACTIVE group only
- Added security validation to prevent cross-group agent access
- Updated import from get_user_groups to require_active_group
WHY:
- Prevents users from accessing group agents outside their active group
- Fixes a security gap where selecting a group agent bypassed the active-group check
- Aligns behavior with the intended single-active-group security model
FILES:
- semantic_kernel_loader.py (approx. lines 11801280)
- GROUP_AGENT_LOADING_FIX.md
VERSION:
- 0.237.008
@Bionic711
Bionic711 merged commit 28a557e into microsoft:DevelopmentJan 31, 2026
4 checks passed
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@vivche@paullizer@Bionic711