fix(memory): guard fetchone() against None in MemoryStore.add_fact and update_fact#23000
Closed
KhanCold wants to merge 2 commits into
Closed
fix(memory): guard fetchone() against None in MemoryStore.add_fact and update_fact#23000KhanCold wants to merge 2 commits into
KhanCold wants to merge 2 commits into
Conversation
added 2 commits
May 10, 2026 12:41
The LF-submit fix for thin PTYs (commit 5044e1c) regressed multiline composition on macOS by binding c-j (LF) to submit unconditionally on POSIX. Shift+Enter is delivered as c-j on many terminals, so it stopped inserting newlines and submitted the message instead. Upstream added install_shift_enter_alias() for CSI-u/modifyOtherKeys terminals, but default macOS Terminal still sends bare LF for Shift+Enter. This change complements upstream's approach. Changes: - _bind_prompt_submit_keys(): only bind 'enter'; remove unconditional c-j binding so the caller can decide based on environment. - In the CLI setup block, bind c-j to newline by default on POSIX local terminals (not WSL/SSH/WT which are handled by _preserve_ctrl_enter_newline). - When HERMES_CLI_SUBMIT_ON_LF=1 is set, bind c-j to submit instead, opt-in for thin PTYs that deliver Enter as LF. Adds regression tests covering: - default POSIX: c-j inserts newline - env HERMES_CLI_SUBMIT_ON_LF=1: c-j submits - WSL/SSH/WT: c-j left untouched (has its own binding) Fixes NousResearch#22908
NousResearch#22660) Two methods in MemoryStore called .fetchone()["field"] without first checking if fetchone() returned None, causing TypeError in race conditions. - add_fact: after sqlite3.IntegrityError, the duplicate row may have been deleted by a concurrent operation before the fallback SELECT executes. → Guard with explicit None check; raise RuntimeError for this impossible-but-observed state. - update_fact: when category is not provided, a second SELECT fetches the current category. If the row was deleted between the first SELECT and this second one, fetchone() returns None. → Guard with explicit None check; return False (row no longer exists). Fixes NousResearch#22660
Collaborator
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.
Closing as this duplicates existing work. Will focus on cleaner, focused PRs going forward.