fix: SessionDB API signature mismatch in _insert_session_row and append_message#48610
Closed
GauravPatil2515 wants to merge 1 commit into
Closed
Conversation
…end_message - Add **kwargs to _insert_session_row to accept caller kwargs like cwd - Add timestamp parameter to append_message to preserve original timestamps during message replay - Fixes TypeError when callers pass unexpected keyword arguments - References issue NousResearch#48531
Collaborator
|
Duplicate of #47253 — this fix is already on |
Author
23 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Fixes the
SessionDBAPI signature mismatch that causesTypeErrorat runtime when callers pass keyword arguments that the method signatures don't accept.Root cause:
create_session()forwards**kwargsto_insert_session_row(), and callers likerun_agent.pyandgateway/session.pypasstimestamptoappend_message(). Both methods had closed signatures without**kwargsortimestamp, causing:SessionDB._insert_session_row() got an unexpected keyword argument 'cwd'SessionDB.append_message() got an unexpected keyword argument 'timestamp'Changes:
**kwargsto_insert_session_row()signature inhermes_state.py— absorbs extraneous kwargs from callerstimestamp: float = Noneparameter toappend_message()inhermes_state.py— preserves original timestamps during session replay; falls back totime.time()when not providedRelated Issue
Fixes #48531
Type of Change
Changes Made
hermes_state.py— Added**kwargsto_insert_session_row()andtimestampparam toappend_message()tests/test_hermes_state.py— Addedtest_insert_session_row_accepts_kwargsandtest_append_message_accepts_timestampHow to Test
python3 -m pytest tests/test_hermes_state.py::TestMessageStorage::test_insert_session_row_accepts_kwargs -v— passespython3 -m pytest tests/test_hermes_state.py::TestMessageStorage::test_append_message_accepts_timestamp -v— passesTestMessageStoragecontinue to pass (verified)Checklist