Conversation
fix(state): self-heal missing session parent row on transcript writes
|
append_message / append_messages_batch insert into messages with a FOREIGN KEY to sessions; a missing parent row (deleted by cleanup or never created after a transient create_session failure) raises FOREIGN KEY constraint failed and aborts the whole turn, surfacing as a misleading 'session storage could not be written' warning. Ensure the parent row exists (INSERT OR IGNORE) before writing messages so a missing row can never destroy a turn.
JoaoMarcos44
added a commit
to JoaoMarcos44/hermes-agent
that referenced
this pull request
Sep 26, 2026
Treat _session_db_created as a creation cache rather than permanent proof that the row still exists. A transcript FK reject can now rebuild the session through AIAgent's canonical metadata path and retry the batch once. If lazy row creation itself fails, stop before the guaranteed-failing message append. Keep raw SessionDB append semantics unchanged. Refs NousResearch#123583 Related: NousResearch#87451 Related: NousResearch#44266
JoaoMarcos44
added a commit
to JoaoMarcos44/hermes-agent
that referenced
this pull request
Sep 26, 2026
Pin the scope boundary for NousResearch#123583: SessionDB itself still rejects a message whose parent session does not exist. Recovery belongs to AIAgent, where the full session identity is available. This distinguishes the fix from the broader state-layer behavior proposed in NousResearch#87451 and from silently dropping the write as in NousResearch#44266.
Author
|
Closing as superseded. The maintainer triage on #123583 (teknium1, 2026-09-26) reviewed this PR directly: right instinct, wrong layer. The store cannot know the row's identity — Since then:
Nothing from this branch is carried into either. Thanks to @teknium1 for the review. |
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
append_message/append_messages_batchinsert intomessageswith a FOREIGN KEY tosessions. A missing parent row — deleted by cleanup, or never created after a transientcreate_sessionfailure — raisesFOREIGN KEY constraint failedand aborts the whole turn, surfacing as a misleading "session storage could not be written" warning.Change
Ensure the parent row exists (
INSERT OR IGNORE INTO sessions) before writing messages in both write paths, so a missing row can never destroy a turn.Context
Observed on a long-running gateway where a session row vanished (cleanup race) and every subsequent transcript write failed until manual repair.