Role-based permissions DAP - Foreground execute permission check integration for Agentic chat (Web/IDE) including foundational and custom agents

Summary

This issue integrates DAP (Duo Agent Platform) role-based Execute foreground permission checks into agents used in Agentic Chat. It ensures that users can only interact with agents in chat if they have the appropriate role-based permissions configured at the instance or namespace level.

Background

As part of the DAP role-based permissions epic (#19743 (closed)), we need to enforce the Execute permission across all DAP execution points. Agents in Agentic Chat are one of the three main areas where users can execute DAP functionality:

  • Built-in flows
  • Agentic Chat (this issue) in Web UI and IDE
  • Custom agents and flows

The permission attribute we will use for that will be minimum_access_level_execute, as Agentic Chat and the enabled foundational and custom agents are running in the foreground.

Requirements

Permission Check Integration

  • Identify all entry points where agents are invoked in Agentic Chat in Web UI and IDE
  • Ensure permission checks occur before agent execution
  • Handle permission denial gracefully with appropriate error messages
  • Consider service account permission intersections

User Experience

  • Disable or hide agent options in chat Web UI and IDE when user lacks permission
  • Show clear messages when permission is denied
  • Provide guidance on how to request access
  • Ensure chat interface remains responsive

Technical Implementation

Locations to Update

Based on the codebase analysis from issue #578370 (closed), identify and update all locations where agents are invoked in Agentic Chat. This may include:

  • Chat message processing
  • Agent invocation endpoints
  • GraphQL mutations for chat interactions
  • WebSocket handlers for real-time chat

Acceptance Criteria

  • Agentic Chat has permission checks
  • Service account permission intersections are properly enforced
  • Permission checks are performant
  • UI reflects permission state (disabled/hidden options)
  • Integration tests verify permission enforcement in chat context
  • Tests cover both allowed and denied scenarios

Testing Scenarios

  • User with guest+ role can use agents in Agentic Chat
  • Custom permission configuration is respected
  • Service account permissions properly limit agent capabilities
  • Instance-level and namespace-level permissions work correctly
  • Chat UI appropriately reflects permission state
  • Parent Epic: #19743 (closed) - [Backend] Role-based permissions controls for DAP
  • Depends on: #578556 (closed) - Role-based permissions DAP - Execute permission
  • Related: #578553 - Execute permission for built-in flows
  • Related: #578555 - Execute permission for custom flows
  • Related: #578563 (closed) - Execute permission for custom agents

Notes

Agentic Chat is a user-facing feature, so the permission enforcement must provide excellent UX with clear messaging and appropriate UI states.

Edited by 🤖 GitLab Bot 🤖