fix: batch of 5 small contributor fixes — PortAudio, SafeWriter, IMAP, thread lock, prefill - #2466
Merged
Conversation
When sounddevice is installed but libportaudio2 is not present on the system, the OSError was caught together with ImportError and showed a generic 'pip install sounddevice' message that sent users down the wrong path. Split the except clause to give a clear, actionable message for the OSError case, including the correct apt/brew commands to install the system library.
When subagents run in ThreadPoolExecutor threads, the shared stdout handle can close between thread teardown and KawaiiSpinner cleanup. Python raises ValueError (not OSError) for I/O operations on closed files: ValueError: I/O operation on closed file The _SafeWriter class was only catching OSError, missing this case. Changes: - Add ValueError to exception handling in write(), flush(), and isatty() - Update docstring to document the ThreadPoolExecutor teardown scenario Fixes #2428
imap.uid('search') can return data=[] when the mailbox is empty or
has no matching messages. Accessing data[0] without checking len first
raises IndexError: list index out of range.
Fixed at both call sites in gateway/platforms/email.py:
- Line 233 (connect): ALL search on startup
- Line 298 (fetch): UNSEEN search in the polling loop
Closes #2137
…unt() Both methods accessed self._conn without self._lock, breaking the thread-safety contract documented on SessionDB (line 111). All 22 other DB methods use with self._lock — these two were the only exceptions. In the gateway's multi-threaded environment (multiple platform reader threads + single writer) this could cause cursor interleaving, sqlite3.ProgrammingError, or inconsistent COUNT results. Closes #2130
…to prevent prefill rejection
This was referenced Mar 22, 2026
outsourc-e
pushed a commit
to outsourc-e/hermes-agent
that referenced
this pull request
Mar 26, 2026
Reverts the sanitizer addition from PR NousResearch#2466 (originally NousResearch#2129). We already have _empty_content_retries handling for reasoning-only responses. The trailing strip risks silently eating valid messages and is redundant with existing empty-content handling.
angelburgosrosado
pushed a commit
to angelburgosrosado/hermes-agent
that referenced
this pull request
Apr 27, 2026
fix: batch of 5 small contributor fixes — PortAudio, SafeWriter, IMAP, thread lock, prefill
angelburgosrosado
pushed a commit
to angelburgosrosado/hermes-agent
that referenced
this pull request
Apr 27, 2026
Reverts the sanitizer addition from PR NousResearch#2466 (originally NousResearch#2129). We already have _empty_content_retries handling for reasoning-only responses. The trailing strip risks silently eating valid messages and is redundant with existing empty-content handling.
02356abc
pushed a commit
to 02356abc/hermes-agent
that referenced
this pull request
May 14, 2026
fix: batch of 5 small contributor fixes — PortAudio, SafeWriter, IMAP, thread lock, prefill
02356abc
pushed a commit
to 02356abc/hermes-agent
that referenced
this pull request
May 14, 2026
Reverts the sanitizer addition from PR NousResearch#2466 (originally NousResearch#2129). We already have _empty_content_retries handling for reasoning-only responses. The trailing strip risks silently eating valid messages and is redundant with existing empty-content handling.
gweeteve
pushed a commit
to gweeteve/hermes-agent
that referenced
this pull request
Jun 2, 2026
fix: batch of 5 small contributor fixes — PortAudio, SafeWriter, IMAP, thread lock, prefill
gweeteve
pushed a commit
to gweeteve/hermes-agent
that referenced
this pull request
Jun 2, 2026
Reverts the sanitizer addition from PR NousResearch#2466 (originally NousResearch#2129). We already have _empty_content_retries handling for reasoning-only responses. The trailing strip risks silently eating valid messages and is redundant with existing empty-content handling.
waefrebeorn
pushed a commit
to waefrebeorn/slermes
that referenced
this pull request
Jul 2, 2026
fix: batch of 5 small contributor fixes — PortAudio, SafeWriter, IMAP, thread lock, prefill
waefrebeorn
pushed a commit
to waefrebeorn/slermes
that referenced
this pull request
Jul 2, 2026
Reverts the sanitizer addition from PR NousResearch#2466 (originally NousResearch#2129). We already have _empty_content_retries handling for reasoning-only responses. The trailing strip risks silently eating valid messages and is redundant with existing empty-content handling.
Closed
1 task
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.
Batch salvage of 5 small, clean fixes from open PRs:
#2440 (@itenev) — Better error message when PortAudio is missing: shows
apt install libportaudio2/brew install portaudioinstead of generic error.#2431 (@Bartok9) — Catch
ValueErrorin_SafeWriteralongsideOSError. Subagent thread teardown can close stdout between writes, raising "I/O operation on closed file" instead of broken pipe.#2289 (@Mibayy) — Guard IMAP search results:
data and data[0]instead of justdata[0]. PreventsIndexErrorwhen IMAP returns empty list.#2288 (@Mibayy) — Add
self._lockaroundsession_count()andmessage_count()in SessionDB. Other methods already use the lock; these two didn't.#2129 (@ygd58) — Strip trailing empty assistant messages before API calls. Responses API reasoning-only turns leave empty assistant messages that cause prefill rejection on Chat Completions / Anthropic.
All authorship preserved.