fix: get context cutoff to be exclusive (#193)

This commit is contained in:
Vineeth Voruganti 2025-08-13 16:16:02 -04:00 committed by GitHub
parent f6e01a6f72
commit 9c8e74bc04
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 6 additions and 2 deletions

View File

@ -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

View File

@ -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
</Update>
<Update label="v2.2.0">
### Added

View File

@ -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)