diff --git a/CHANGELOG.md b/CHANGELOG.md index c7d1a1c9..267f2a54 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,6 +34,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Queue manager to use atomic db transactions rather than long lived transaction for the worker lifecycle - Timestamp formats unified to ISO 8601 across the codebase +- Internal get_context method's cutoff value is exclusive now ## [2.2.0] — 2025-08-07 diff --git a/docs/changelog/introduction.mdx b/docs/changelog/introduction.mdx index 9950e53a..6e41d9bd 100644 --- a/docs/changelog/introduction.mdx +++ b/docs/changelog/introduction.mdx @@ -55,6 +55,7 @@ Welcome to the Honcho changelog! This section documents all notable changes to t - Queue manager to use atomic db transactions rather than long lived transaction for the worker lifecycle - Timestamp formats unified to ISO 8601 across the codebase + - Internal get_context method's cutoff value is exclusive now ### Added diff --git a/src/crud/message.py b/src/crud/message.py index c664110d..143f1aa9 100644 --- a/src/crud/message.py +++ b/src/crud/message.py @@ -2,7 +2,7 @@ from logging import getLogger from typing import Any from nanoid import generate as generate_nanoid -from sqlalchemy import ColumnElement, Select, func, select +from sqlalchemy import ColumnElement, Select, and_, func, select from sqlalchemy.ext.asyncio import AsyncSession from src import models, schemas @@ -233,7 +233,9 @@ async def get_messages_id_range( models.Message.session_name == session_name, ] if end_id: - base_conditions.append(models.Message.id.between(start_id, end_id)) + base_conditions.append( + and_(models.Message.id >= start_id, models.Message.id < end_id) + ) else: base_conditions.append(models.Message.id >= start_id)