From 53ef33e46671ffc17cbe273a1ba4915433081886 Mon Sep 17 00:00:00 2001 From: vrtornisiello Date: Tue, 10 Mar 2026 13:59:54 -0300 Subject: [PATCH 1/2] fix: delete threads through the checkpointer --- app/api/routers/chatbot.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/api/routers/chatbot.py b/app/api/routers/chatbot.py index e4c2301..145e7ac 100644 --- a/app/api/routers/chatbot.py +++ b/app/api/routers/chatbot.py @@ -68,7 +68,8 @@ async def delete_thread_and_checkpoints( detail=f"Thread {thread_id} not found", ) - await agent.aclear_thread(thread_id) + if agent.checkpointer is not None: + await agent.checkpointer.adelete_thread(thread_id) @router.get("/threads/{thread_id}/messages") From 3ca26e37859c0aa94d180835c8327bdd5b7cb97d Mon Sep 17 00:00:00 2001 From: vrtornisiello Date: Tue, 10 Mar 2026 14:06:17 -0300 Subject: [PATCH 2/2] fix: chatbot router tests --- tests/app/api/routers/test_chatbot.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/tests/app/api/routers/test_chatbot.py b/tests/app/api/routers/test_chatbot.py index a1dc4ee..7f1cd2a 100644 --- a/tests/app/api/routers/test_chatbot.py +++ b/tests/app/api/routers/test_chatbot.py @@ -30,6 +30,9 @@ def send_feedback(self, feedback: Feedback, created: bool): class MockReActAgent: + def __init__(self): + self.checkpointer = None + def invoke(self, input, config): return {"messages": [AIMessage("Mock response")]} @@ -46,12 +49,6 @@ async def astream(self, input, config, stream_mode): yield "updates", chunk yield "values", chunk - def clear_thread(self, thread_id): - return - - async def aclear_thread(self, thread_id): - return - @pytest.fixture(autouse=True) def disable_auth_dev_mode(monkeypatch: pytest.MonkeyPatch):