fix: ignore BrokenPipeError from console prints in gateway mode - #911
Closed
Krlosimc wants to merge 1 commit into
Closed
fix: ignore BrokenPipeError from console prints in gateway mode#911Krlosimc wants to merge 1 commit into
Krlosimc wants to merge 1 commit into
Conversation
Contributor
|
Thanks for the report and patch here. Current main already landed a broader _SafeWriter-based fix for broken stdout during run_conversation, so I pulled the remaining init-time edge case you surfaced into PR #1271 instead of merging this stale branch directly. That follow-up fixes the Honcho init-time print path on current main and keeps the existing _SafeWriter approach as the single mechanism. Credit for surfacing the remaining gap. |
This was referenced Jul 18, 2026
bbasketballer75
added a commit
to bbasketballer75/hermes-agent
that referenced
this pull request
Jul 31, 2026
User messages that quote prior tool output (e.g. 'hermes verified that...'
or 'hermes reported that...') were being passed through to the Honcho
deriver, which then extracted those quoted phrases as Explicit Observations
on the 'hermes' observer peer. Each chat turn added a new
'hermes said/reported/verified/...' observation, feeding the
self-trust loop.
The new _strip_agent_self_quotes function runs over user_content
inside sync_turn() (after sanitize_context), before the content is
written to Honcho. It matches 'hermes <verb> ...' phrases and
replaces each match with a NUL character placeholder so the user's
surrounding prose is preserved but the substring cannot be parsed as
a meaningful sentence by the deriver's extraction prompt.
Patterns stripped:
- 'hermes <said|reported|confirmed|identified|provided|outlined|
created|saved|noted|asked|required|wants|received|believes|
described|added|changed|verifies|verified|wanted|completed|
commits|requires|has|is|was|continues|sent|started> ... [ending in
. ! ? \n or end-of-string]'
- '6631182039 has a long-term memory note stating that ...'
- 'hermes verifies/describes ...'
Verified with 16 test cases (10 pollution patterns stripped, 0 false
positives on non-pollution text). Module loads cleanly, syntax checks
clean. Live install: 60s after gateway restart with this patch
loaded, zero new hermes-observer documents were generated.
Refs: PR NousResearch#66754 (peer-card sanitizer), PR NousResearch#66810 (self-narration
demote), Honcho NousResearch#911 (observation-cleanup API), Honcho NousResearch#913 (asyncio
loop frozen - separate from this fix).
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.
Summary
BrokenPipeErrorRoot cause
In gateway mode,
run_agent.pycan still emit debug/progressprint()calls even withquiet_mode=True. If stdout/stderr is detached or its pipe closes, those prints raiseBrokenPipeError, abort the turn, andgateway/run.pyreturns the generic error message to Telegram.Fix
print()inrun_agent.pybuiltins.print()BrokenPipeErrorso best-effort console output cannot abort the conversationValidation
./venv/bin/python -m py_compile run_agent.pyBrokenPipeErrorinrun_agent.py