mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-11 13:41:53 +00:00
fix(gateway): strip orphan think-tag close tags in progressive stream
When a model emits an inline <think>...</think> block but the opening tag is dropped upstream (thinking-mode toggle, truncated stream, or incomplete upstream filtering), the bare </think> close tag leaked through to the user in the live progressive edit. The agent-side final scrubber (agent/think_scrubber.py) already had _strip_orphan_close_tags; this ports the same logic into GatewayStreamConsumer so the streaming display stays clean too. - _filter_and_accumulate: strip orphan close tags before appending the 'no-opening-tag' branch text to _accumulated. - _flush_think_buffer: same on stream end for held-back partials. - 14 regression tests (TestStripOrphanCloseTags): all 6 close-tag variants, multi-tag, partial-tag-untouched, trailing whitespace, and end-to-end through _filter_and_accumulate / _flush_think_buffer. Only strips KNOWN close-tag names (case-insensitive) — never arbitrary tag-shaped substrings — so comparison operators and unrelated prose are preserved. Salvaged from PR #43192 by @testingbuddies24.
This commit is contained in:
parent
6a6fd42111
commit
e07768a53f
3 changed files with 151 additions and 2 deletions
|
|
@ -45,6 +45,7 @@ ACP_REGISTRY_MANIFEST = REPO_ROOT / "acp_registry" / "agent.json"
|
|||
|
||||
# Auto-extracted from noreply emails + manual overrides
|
||||
AUTHOR_MAP = {
|
||||
"259353979+testingbuddies24@users.noreply.github.com": "testingbuddies24", # PR #43192 salvage (strip orphan think-tag close tags in progressive gateway stream so a bare </think> whose open was dropped upstream can't leak to the user)
|
||||
"5848605+itenev@users.noreply.github.com": "itenev", # PR #22753 salvage (asyncify model-context resolution in gateway message path so blocking requests.get can't starve Discord heartbeats)
|
||||
"arthur.zhang@ingenico.com": "arthurzhang", # PR #34718 salvage (redact Slack App-Level xapp- tokens in agent/redact.py + gateway/run.py)
|
||||
"290873280+rrevenanttt@users.noreply.github.com": "rrevenanttt", # PR #40773 salvage (close hardline rm bypass via quoted paths and ${HOME} brace form)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue