Skip to content

[v3] Various chat handler and usability issues in the current jupyterlab-chat #1293

Closed
@srdas

Description

@srdas

References PR #1290

[1] When closing a chat session, a websocket error is thrown, shown in the log:

[I 2025-03-25 13:09:24.720 ServerApp] Saving the content from room text:chat:49f07d46-142c-4549-adee-b6c45d2c751e
[I 2025-03-25 13:09:24.722 YDocExtension] Saving file: sd3.chat
[E 2025-03-25 13:09:32.271 ServerApp] Failed to write message
    Traceback (most recent call last):
      File "/opt/anaconda3/envs/v3/lib/python3.12/site-packages/jupyter_server_ydoc/handlers.py", line 278, in send
        self.write_message(message, binary=True)
      File "/opt/anaconda3/envs/v3/lib/python3.12/site-packages/tornado/websocket.py", line 332, in write_message
        raise WebSocketClosedError()
    tornado.websocket.WebSocketClosedError

[2] Re-using an existing prompt fails to get a response, and throws the following error:
Image

[E 2025-03-25 13:16:34.735 ServerApp] Document Room Exception, (room_id=text:chat:adc2cfd5-df21-4b80-bf12-ab18569413fb):
      + Exception Group Traceback (most recent call last):
      |   File "/opt/anaconda3/envs/v3/lib/python3.12/site-packages/pycrdt_websocket/yroom.py", line 259, in serve
      |     async with create_task_group() as tg:
      |                ^^^^^^^^^^^^^^^^^^^
      |   File "/opt/anaconda3/envs/v3/lib/python3.12/site-packages/anyio/_backends/_asyncio.py", line 772, in __aexit__
      |     raise BaseExceptionGroup(
      | ExceptionGroup: unhandled errors in a TaskGroup (1 sub-exception)
      +-+---------------- 1 ----------------
        | Traceback (most recent call last):
        |   File "/opt/anaconda3/envs/v3/lib/python3.12/site-packages/pycrdt/_base.py", line 198, in observe_callback
        |     callback(*params[:param_nb])  # type: ignore[arg-type]
        |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        |   File "/Users/sanjivda/GitHub/jupyter-ai/packages/jupyter-ai/jupyter_ai/extension.py", line 302, in on_change
        |     message = Message(**message_dict)
        |               ^^^^^^^^^^^^^^^^^^^^^^^
        | TypeError: Message.__init__() got an unexpected keyword argument 'attachments'
        | 
        | The above exception was the direct cause of the following exception:
        | 
        | Traceback (most recent call last):
        |   File "/opt/anaconda3/envs/v3/lib/python3.12/site-packages/pycrdt/_base.py", line 194, in observe_callback
        |     param_nb = count_parameters(callback)
        |                ^^^^^^^^^^^^^^^^^^^^^^^^^^
        | SystemError: <functools._lru_cache_wrapper object at 0x1063a4f60> returned a result with an exception set
        | 
        | The above exception was the direct cause of the following exception:
        | 
        | Traceback (most recent call last):
        |   File "/opt/anaconda3/envs/v3/lib/python3.12/site-packages/pycrdt/_base.py", line 194, in observe_callback
        |     param_nb = count_parameters(callback)
        |                ^^^^^^^^^^^^^^^^^^^^^^^^^^
        | SystemError: <functools._lru_cache_wrapper object at 0x1063a4f60> returned a result with an exception set
        | 
        | The above exception was the direct cause of the following exception:
        | 
        | SystemError: <function put_updates at 0x113f8b880> returned a result with an exception set
        | 
        | The above exception was the direct cause of the following exception:
        | 
        | Traceback (most recent call last):
        |   File "/opt/anaconda3/envs/v3/lib/python3.12/site-packages/pycrdt_websocket/yroom.py", line 286, in serve
        |     reply = handle_sync_message(message[1:], self.ydoc)
        |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        |   File "/opt/anaconda3/envs/v3/lib/python3.12/site-packages/pycrdt/_sync.py", line 299, in handle_sync_message
        |     ydoc.apply_update(update)
        |   File "/opt/anaconda3/envs/v3/lib/python3.12/site-packages/pycrdt/_doc.py", line 163, in apply_update
        |     with self.transaction() as txn:
        |          ^^^^^^^^^^^^^^^^^^
        | SystemError: <function Transaction.__exit__ at 0x10646c040> returned a result with an exception set
        +------------------------------------

[3] Message attachments working for files but not folders:
Image

[4] After attaching a file, and issuing a question, there is no response?

(This is all known and this issue is being opened for tracking purposes.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugBugs reported by users

    Type

    No type

    Projects

    Status

    Done

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions