Skip to content

Missing CONTROL value in MessageType enum causing validation errors #116

@MykhailoSadruk

Description

@MykhailoSadruk

The Glean Python SDK is missing the CONTROL value in the MessageType enum, which causes Pydantic validation errors when the API returns messages with messageType: "CONTROL".

Steps to Reproduce
Use the Glean Python SDK to retrieve a chat that contains messages with messageType: "CONTROL"

Call client.client.chat.retrieve(id=chat_id)

SDK throws validation error

Expected Behavior
The SDK should successfully parse messages with messageType: "CONTROL" without validation errors.

Actual Behavior
Response validation failed: 1 validation error for Unmarshaller
body.chatResult.chat.messages.4.messageType
Input should be 'UPDATE', 'CONTENT', 'CONTEXT', 'DEBUG', 'DEBUG_EXTERNAL', 'ERROR', 'HEADING', 'WARNING' or 'SERVER_TOOL' [type=enum, input_value='CONTROL', input_type=str]

API Endpoint: /rest/api/v1/getchat

Proposed Fix
Add CONTROL = "CONTROL" to the MessageType enum in glean/api_client/models/chatmessage.py:

class MessageType(str, Enum):
UPDATE = "UPDATE"
CONTENT = "CONTENT"
CONTEXT = "CONTEXT"
DEBUG = "DEBUG"
DEBUG_EXTERNAL = "DEBUG_EXTERNAL"
ERROR = "ERROR"
HEADING = "HEADING"
WARNING = "WARNING"
SERVER_TOOL = "SERVER_TOOL"
CONTROL = "CONTROL" # Missing value

Impact
This is a breaking issue that prevents users from retrieving chat history when messages contain the CONTROL type, which appears to be returned by the Glean API in certain scenarios.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions