# NousResearch/hermes-agent · Gateway context pin reuse bug after eviction/wake

## Open now

- Nothing open on GitHub.

A bug where internal wakes following eviction, stop, undo, or model changes cause the session-context prompt to be re-rendered incorrectly, breaking prefix cache state. The cluster covers the bug report and related fix attempts addressing context pin rehydration.

## 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 #139865. Verify it addresses your case.
- **Recommended:** read PR #139865 (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-139865`. 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

- #131031: \[Bug\]: gateway: an internal wake after /stop, /undo or /model re-renders the session-context prompt and breaks the prefix cache twice (A→B→A)

## Prior & competing PRs

- **#139865: fix(gateway): synthetic goal/heartbeat turns and post-eviction wakes keep the system prompt byte-stable (#126109, #131031, salvage #131032 #126155)**. merged to main · fix tier `verified`
  - maintainer direction: category `merged`
  - files: `gateway/platforms/event.py`, `gateway/run_agent_cache.py`, `gateway/run_busy.py`, `gateway/run_goals.py`, `gateway/run_turn.py`, `gateway/run_turn_prepare.py`, `gateway/session_envelope.py`, `gateway/slash_commands_goals.py`, `tests/gateway/test_internal_event_pin_wiring.py`, `tests/gateway/test_queue_consumption.py`
- **#131032: fix(gateway): a wake after an agent eviction reuses the session-context pin**. closed without merge
  - maintainer direction: category `uncategorized`; implication `needs_llm`; refs `5ba9d1f12b`, `51609d827b`
- **#132290: fix(gateway): rehydrate context pin for internal wakes after eviction (fixes #131031)**. closed without merge
  - maintainer direction: category `superseded_by_pr`; implication `superseded`; refs `3bc8fb2e957a1d324f46e302b4419b7f7b664e58`, `7533bd2756b9526b52f527f737420a19e57331d7`, `f5a9361dcc66b0b972fd488b83129561509b3486`, `620ceb86fc753ef538fac5151c13edc0623ef1f6`, `5ba9d1f12b15574597122cbe81596ca1ea40745f`, `357f51c49106f47136caf9b01015467b7b633fe8`, `cebeaef4f6b0d15b8334d15f75934a78afa1539b`, `69c12764dfc6e7d8329a7113aa1ae0de84f51307`, `#131031`, `#131032`, `#172554`, `#126167`, `#127208`, `#126137`, `#131118`

## Fix status

- Merged to main in PR #139865 (cited above). No release data is tracked. Verify downstream.
- Fix last verified (merged) `2026-10-16`.
- Subsystem: `gateway`
