# NousResearch/hermes-agent · Fix summary role alternation for strict-template backends

## Open now

- Nothing open on GitHub.

These issues and PRs address a bug where context compaction or compression emits a summary message with the wrong role (e.g., user instead of assistant) on backends that enforce strict role alternation, such as Mistral-template models. The fixes resolve the role by inspecting template-visible predecessors rather than raw message roles.

## TL;DR

- 4 member(s): 0 open issue(s), 1 closed issue(s), 0 open PR(s), 1 merged PR(s), 2 PR(s) closed without merging.
- A fix was merged to main in PR #74087. Verify it addresses your case.
- **Recommended:** read PR #74087 (and any competing PRs below) before filing. Confirm the merged change covers your symptom.

## Maintainer resolution verdict

- Internal-tracker verdict over this cluster's issue members: `resolved` · deciding PR(s): `pr-74087`. This is distinct from the fix status above. Weigh it yourself.

## How this cluster was grouped

- Link evidence (`STRUCTURAL_SPANNING`): every member is connected by structural evidence: shared changed files, or a closing/superseded reference.
- Pairwise link density `0.50`: the share of member pairs that carry a link, counting a structural link in full and a relevance-only link at 0.36. `1.00` means every pair is linked.

## Closed / duplicate issues

- #74086: Context compaction permanently poisons sessions on Mistral-template backends (summary emitted as role:user after a tool-flow head)

## Prior & competing PRs

- **#74087: fix(compression): choose summary role by template-visible alternation**. merged to main · fix tier `verified`
  - maintainer direction: category `merged`
  - files: `agent/context_compressor.py`, `tests/agent/test_summary_role_template_alternation.py`
- **#74111: fix(context-compressor): resolve tool role to semantic predecessor for strict alternation backends**. closed without merge
  - maintainer direction: category `implemented_elsewhere`; implication `superseded`; refs `#74086`, `#74087`
- **#74720: fix(agent): use template-visible roles for summary alternation (#74086)**. closed without merge
  - maintainer direction: category `implemented_elsewhere`; implication `superseded`; refs `7965462d6c6fd680dfd96789f23964a6bb7e0c24`, `#74087`

## Fix status

- Merged to main in PR #74087 (cited above). No release data is tracked. Verify downstream.
- Fix last verified (merged) `2026-07-30`.
- Subsystem: `agent`
